Home   Help Search Login Register  

Author Topic: How do I keep a trigger over a specific unit?  (Read 526 times)

0 Members and 1 Guest are viewing this topic.

Swatdog

  • Guest
How do I keep a trigger over a specific unit?
« 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)

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How do I keep a trigger over a specific unit?
« Reply #1 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"

Swatdog

  • Guest
Re:How do I keep a trigger over a specific unit?
« Reply #2 on: 24 May 2005, 07:59:10 »
Ah ok, I thought there was a more complicated way than that.

Thanks.

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:How do I keep a trigger over a specific unit?
« Reply #3 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