HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting a rooted unit?

03-15-2011, 10:40 PM#1
Ignitedstar
This may be an oversight upon my part, but alas I am running out of time before I have to do stuff.

I know that you can detect when a unit uses the root and unroot order ids, but is possible to detect whether or a unit is already rooted? I have a passive ability that should only work if the Ancient is rooted. Any help is much appreciated. Thanks, guys.
03-16-2011, 05:13 AM#2
Fledermaus
Assuming all the units will either come into the game as rooted or unrooted, set a boolean array (e.g. called Rooted) to true or false accordingly when they're created. Update it whenever they root/unroot. Then you can just check the array.
03-16-2011, 06:37 AM#3
Ignitedstar
Yes, of course... I've done that so many times that it should have come naturally. Oh well. Thank you.
03-16-2011, 06:46 PM#4
chobibo
Try ordering the unit to move, I guess it will return false (IssuePointOrder).
03-16-2011, 09:47 PM#5
Fledermaus
Then you need LastOrder and setup something to catch the move order and issue the previous order so stuff doesn't get messed up. Also I'd assume that since it's a passive it'd be called a lot, so seems simpler to me to just use the boolean array.
03-17-2011, 01:56 AM#6
Nuclear Arbitor
chobibo's works if some start rooted and some start not though. and you might be able to call it once on particular units to set the true/false for that particular unit.
03-17-2011, 03:57 AM#7
chobibo
Can't you get the current order by using the GetUnitCurrentOrder? Also using a boolean is fast, but that value needs to get attached to the said unit, so you would need to index units, or use the hashtable to attach the boolean data to the unit.

It's not as simple as you think, no offense dude.

Another way to do this is by making a dummy ability, base it on something like item armor bonus and clear the bonuses, detect when a unit is ordered to "root" then add the said ability to the unit. To check if a unit is rooted, check if the dummy has the ability. Don't forget to remove the dummy ability once the unit is ordered to "unroot".
03-17-2011, 05:37 AM#8
Nuclear Arbitor
i don't have a clue how simple its, my experience with programing is pretty limited; I'm just spewing ideas and bumping my post count.
03-17-2011, 05:55 AM#9
Ignitedstar
Quote:
Originally Posted by chobibo
Can't you get the current order by using the GetUnitCurrentOrder? Also using a boolean is fast, but that value needs to get attached to the said unit, so you would need to index units, or use the hashtable to attach the boolean data to the unit.
This will work, because only one type of this particular Ancient can be put on the map at any point in time. He obtains an index the instantly it is made. The passive not only checks for the boolean, but whether or not the unit type of the index is the said Ancient because that same unit index is used for a multitude of units.

Even though that's true, it's still not working. It works in the fact that it works, but it's not working the right way. This is not worth the time I thought it was going to take.

EDIT: Hmm... Maybe I can just remove the passive ability when he's rooted? But then I'd need another variable to keep track of the level of the passive... It would work, though. I think.
03-17-2011, 02:06 PM#10
chobibo
So what's not working properly?

EDIT: I stand corrected, Fledermaus' solution would be better since you're already using an indexer. Oh and sorry Nuclear Arbitor, I was replying to Fledermaus' post, I wasn't implying anything about yours.
03-17-2011, 06:55 PM#11
Ignitedstar
The passive is working in the fact that the effect is working. It just doesn't only work when the Ancient is rooted.
I will try using LastOrder and will tell the results when I get them.
03-17-2011, 08:43 PM#12
chobibo
could you post the code you're using, maybe I could help.
03-17-2011, 09:30 PM#13
PurgeandFire111
Is your ancient able to create units? If so, an easy method would be to see if its rally point is null. If it is not null, it is rooted. Else it is unrooted.

Otherwise, it is a bit more complicated to detect it. You would probably use Fledermaus' method, but since you can't detect when the actual root is taking place, you would need to run something along the lines of a timer to detect if it has reached the area or not, and cancel the timer if it is issued another order.

The LastOrder library works for the most part, but when issuing the order, it will lose its recursiveness and fail. IssueLastOrder() doesn't get reset as the last order, afaik, so then the next last order will point to the "testing" issue you made. So overall, this method might become pretty complicated as well.

Buffs also do not work, as it doesn't apply buffs on the unit when it casts the root ability. It is weird. :(
03-17-2011, 09:42 PM#14
Ignitedstar
Bleh... I tried debugging and it looks like the trigger doesn't even trigger when Root is used.

Okie... This is not worth the time to get this to work. It's alright, you guys. I'll just nerf the ability and make it work 24/7. Thanks for the help, though.
03-18-2011, 02:01 AM#15
Nuclear Arbitor
oh, lol. and i thought i could finally RAGE