Detect Unload vs Un-Defend

Status
Not open for further replies.
Level 20
Joined
Mar 16, 2008
Messages
824
Using the un-defend thing inspired from Bribe's system to detect if unit dies to track Ankh cooldowns and stuff. Problem is when unit is unloaded from transport it casts un-defend. Can anyone think of a way to detect if the unit is being unloaded from transport as opposed to dying?
 
Level 28
Joined
Sep 26, 2009
Messages
2,544
From testing this on latest version, the undefend is ordered when unit enters transport, not when it leaves it (at least in case of zeppelin).
The 'cast' of Load ability can be detected and there is also an event for when unit enters a transport.
Events are fired in this order:
1. Casting Load
  • Zeppelin Load
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Load (Goblin Zeppelin)
    • Actions
      • ...
2. Footman ordered 'undefend'
  • Footman Undefend
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(undefend))
    • Actions
      • ...
3. Unit loaded into transport
  • Zeppelin Loaded
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
    • Actions
      • ...
So what you could do is:
1. When unit casts 'Load', flag the target as 'Being loaded' for example in hashtable
2. When unit casts 'undefend', check the 'Being loaded' flag
3. When unit is actually loaded into the transport, clear the flag (that is mainly to prevent unit boarding the transport with inactive defend already and then falsely evaluation step #2 when unit is ordered 'undefend')
 
Status
Not open for further replies.
Top