OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: _Ross_ on 16 Jun 2003, 07:38:08
-
With a scripted waypoint, does the script happen when the unit is on the way, or when he reaches it, or what?
thanks ;D
-
You can move a unit pretty much any way you want to with a script. For example
unit move getpos gamelogic1
@ unit distance gamelogic1 < 100: unit move getpos gamelogic2
would make a unit go to a game logic object and when he's within 100 meters of it he'd start moving to game logic object number 2.
unit move getpos gamelogic1
@ unitready unit: unit move gamelogic2
would make a unit go to a mage logic and when he's there he'd start going to game logic 2
-
what he means is the script box found in a WP.
I believe it only activiates when a unit has reached the WP
-
Script box will activate when the unit has reached the
waypoint before the waypoint "scripted".
Waypoint is finished, when the script has ended.
entering a scriptname (without the exec command) into the
script box will execute the script and automatically pass a few
parameters with.
Best you use a hint format to figure out all the parameters
All you need to do inside the script is:
hint format ["%1",_this]
and you'll see what's been passed to the script.
AFAIK it's groupname (owner of waypoint), position, target/destination
sample:
create 2 units
unit1
unit2
group them together (F2 drag line)
waypoint1: move
waypoint2: scripted
script: test.sqs
waypoint3: move
<<test.sqs>>
hint "script is running"
@!(alive unit2)
hint "script is over"
exit
Now what happens?
group reaches waypoint1,
hint shows up "script is running"
group will wait at waypoint1 until unit2 is dead.
*player shoots unit2*
hint shows up "script is over"
unit1 starts moving to waypoint3
:note - waypoint2 (the scripted one) will be skipped when it
comes to movement.
Group waits at waypoint1, until wayoint2's condition do match
condition of waypoint2 do match when script has been finished
after script has been finished, the group moves directly from
waypoint1 to waypoint3.
hope this helps
:edit - btw for all those who want to use scripts for moving
units inside the group, but still want to use waypoints aswell,
this is the perfect thingy for you
~S~ CD
-
thanks i get it now ;D