HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

detecting when units moves?

03-23-2006, 02:47 AM#1
Linera
How can I detect when a unit moves?
03-23-2006, 02:54 AM#2
Vexorian
the most bullet proof way I know is a periodic timer and detecting the difference in distance between the last position and the current one.

Of course if it is just a channeling spell you can use the 'Stops casting an ability' event
03-23-2006, 02:58 AM#3
Dalten
Set PointA = current loc
If x and y of PointA = x and y of PointB, then unit is not moving
Set PointB = PointA

That logic sets the current location of the unit, compares it to the previous location and then updates the previous location to the current location so the next time the script runs the "current" location is the true previous location.

I think you'll need to store reals if you use this method and not the actual points.

I'm sure there's a better way but I know this will work.
03-23-2006, 02:59 AM#4
Linera
is this correct?
Trigger:
Moves
Collapse Events
Unit - A unit Stops casting an ability
Collapse Conditions
(Ability being cast) Equal to Attack
Collapse Actions
Set Moves[(Player number of (Owner of (Triggering unit)))] = True
03-23-2006, 04:37 AM#5
jigrael
Quote:
Originally Posted by Vexorian
Of course if it is just a channeling spell you can use the 'Stops casting an ability' event
can u PLZ tell me the name of that function or its real gui name(or where can I find it)

EDIT:oops, found it, sorry. BUT is there a way to detect if a unit is casting a chaneling spell using conditions?
03-23-2006, 09:36 AM#6
Anitarf
Try the oder comparison - current order of unit.
03-23-2006, 11:33 AM#7
Vexorian
well the problem is that sometiemes unit move and they don't have any order
03-23-2006, 11:39 AM#8
Anitarf
Well, but if they're channeling a spell, wouldn't their order still be that of the spell?
03-23-2006, 01:14 PM#9
Blade.dk
Yes, it would.