[Trigger] How to detect movement?!

Status
Not open for further replies.
I don't know if it's this you're looking at.

I made this very quick, because I'm in a hurry, but it should work.

It uses three variables (Ctrl + B, while in trigger editor (F4))
> Unit Variable[Array] (u)
> Point Variable[Array] (p)
> Real Variable[Array] (r)

With this trigger the number 2 unit will move exactly as the number 1 unit, the same distance and direction.


  • Move Units
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Triggering unit) Equal to u[1]
    • Actions
      • Set u[1] = Paladin 0000 <gen>
      • Set u[2] = Paladin 0001 <gen>
      • Set p[0] = (Position of (Triggering unit))
      • Set p[1] = (Target point of issued order)
      • Set r[0] = (Distance between p[0] and p[1])
      • Set r[1] = (Angle from p[0] to p[1])
      • Set p[3] = (Position of u[2])
      • Set p[2] = (p[3] offset by r[0] towards r[1] degrees)
      • Unit - Order u[2] to Move To p[2]
      • Custom script: call RemoveLocation(udg_p[0])
      • Custom script: call RemoveLocation(udg_p[1])
      • Custom script: call RemoveLocation(udg_p[2])
      • Custom script: call RemoveLocation(udg_p[3])
 
Level 2
Joined
Jul 19, 2009
Messages
14
uhm,, i already tried that, my problem is when the 1st unit stops, the other should stop too, without ordering the 1st to stop. you see, the 1st unit is a normal unit with the collision on, while the other one's collision is off, their distance from each other is 500, and when the 1st unit is blocked by an obstacle the ghost should stop too, instead, it keeps moving. T_T
 
Level 2
Joined
Jul 19, 2009
Messages
14
Thanks cokemonkey11, i'll try that, but in GUI, i dont know how to make JASS triggers .xD
 
Make an periodic trigger [0.03] second, that checks for real value inside if/then/else

so the make like 5 if/then/else and if speed is 500 then do... if it's 400 the ndo... if it's 300 then do...

if it's 0 then stop the unit. Ofcourse you'll have to assign a global variable to everything [ms checker = real value, unit1 = unit1, unit2 = unit2...]
 
Status
Not open for further replies.
Top