OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mad Pup on 15 Jun 2010, 07:25:54

Title: Synchronize??
Post by: Mad Pup on 15 Jun 2010, 07:25:54
Hello OFPEC members,
I was wondering is there such a command, used in a script, to synchronize ''Load'', and ''Get In'' waypoints?

Thanks!
~MadPup~
Title: Re: Synchronize??
Post by: bedges on 15 Jun 2010, 08:39:18
There isn't, but the equivalent would be a slowish loop which checks for all of the "getting in" group to be in (http://www.ofpec.com/COMREF/index.php?action=details&id=169&game=OFP) before issuing any move command to the vehicle.
Title: Re: Synchronize??
Post by: Mad Pup on 18 Jun 2010, 22:50:50
Okay, so like in a script I would put
Code: [Select]
? player in _jeepOneCorrect?
Title: Re: Synchronize??
Post by: RKurtzDmitriyev on 19 Jun 2010, 00:27:48
Yeah, or to check if an entire group is in a vehicle,

Code: [Select]
{_x in _jeepOne} count (units _groupOne) == {alive _x} count (units _groupOne)

In other words, "number of groupOne units boarded in jeepOne equals number of alive groupOne units."

And you can also put that in the condition field for a waypoint, or a trigger synchronized to one, of course.
Title: Re: Synchronize??
Post by: savedbygrace on 19 Jun 2010, 00:40:40
The "_" underscore identifies a variable that is local to the script (which means it is unknown outside of the script). In order for it to work, you must pass the name of the jeep to the script through an array and then assign a local to it at the start of the script. But since editor assigned names are global variables (which means they are known in and out of scripts), it's best to refer to the jeeps editor assigned name which is whatever you name it, without the underscore.
Code: [Select]
#wait
? player in jeepOne : goto "proceed"
~1
goto "wait"
#proceed
The words with a # symbol before them are called labels. You use them to jump around within scripts when specific conditions are met. It must be used with a goto command.

Below is an example I'm using in a mission to make sure the player and his group are in a vehicle before executing a cinematic. I have the player separate from the rest of the group just in case he/she boards and then decides at the last minute to get out and do something outside of the vehicle before the rest of his group has boarded.
Code: [Select]
#wait
? vehicle player != vehiclename : exit
? ({alive _x} count units group player) == ({_x in vehiclename} count units group player): goto "proceed"
~1
goto "wait"
#proceed
vehiclename setfuel 1

The ": exit" bit is used to exit the script if the player gets out.
vehiclename must obviously be changed to whatever you desire.

Hope this helps.

Title: Re: Synchronize??
Post by: haroon1992 on 25 Jun 2010, 04:38:58
waypoint the desired chopper to the desired location.
Put a HeliH at the location.

Put a MOVE waypoint for the chopper right beside or on the helih,
type in on act :
Code: [Select]
helicoptername land "land"
Note : just type like that, no changes required!
NOTE: using 'this' instead of helicopter name might not work sometimes.
And put another MOVE waypoint right beside the first MOVE wp.(must be close)
Put the desired condition,in this case :

Code: [Select]
player in helicoptername
NOTE : using 'this' here might not work too!
Go on with the extraction....

Regards,
Haroon1992