OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Swatdog on 24 May 2005, 05:43:43

Title: How do I keep a trigger over a specific unit?
Post by: Swatdog on 24 May 2005, 05:43:43
How do I keep a trigger over a specific unit? Basically what I want to do is create an "arresting" script. So like when you approach a certain unit the trigger will detect you are near him and it activates a script to determine randomly if he will run for it, or put hsi hands in the air. (I believe I know how to do the random reaction)
Title: Re:How do I keep a trigger over a specific unit?
Post by: THobson on 24 May 2005, 05:53:29
You need to have a script that is looping and keeps repositioning the trigger.

Give the trigger a name, say trig1
Give the unit a name, say unit1

the script should look something like:

#loop
~2
trig1 setPos getPos unit1
goto"loop"
Title: Re:How do I keep a trigger over a specific unit?
Post by: Swatdog on 24 May 2005, 07:59:10
Ah ok, I thought there was a more complicated way than that.

Thanks.
Title: Re:How do I keep a trigger over a specific unit?
Post by: ACF on 25 May 2005, 23:18:41
There is a simpler way that may be adequate - just a boring old stationary trigger with a condition like:

you Distance certainunit < 5

and an OnActivation that runs your script.  This saves you the looping script and whatever script you need to extract certainunit from the trigger list