- Joined
- Feb 27, 2007
- Messages
- 5,578
I want to be able to detect when a player is in the 'middle' of casting a (non-channeled) point-/object-targeted spell. Specifically after pressing the spell hotkey (or clicking) but before clicking on a target point or object, so while the player is choosing a target for the ability. I don't need an event to fire when this occurs (obviously that's impossible since the unit hasn't been ordered to cast the spell on a target point/object yet), I just want to be able to check at a particular time if Player(N) is in the middle of choosing a target for a spell.
Can any of you think of a way to do this other than:
Can any of you think of a way to do this other than:
- Store each of their currently selected units' current order so they can be restored later
- Add a no-art/animations, black icon, no-target dummy ability with a unique orderstring to or enable such an ability for their currently selected units
- Call ForceUIKey() on that spell's hotkey (maybe over time more than once?)
- If one of the units is ordered to do the dummy ability's unique orderstring within X milliseconds (orders ForceUIKey takes some non-zero to happen) then the player was not casting
- Restore the order of the unit that attempted to cast
- If none of the units are ordered to do the orderstring within X milliseconds then the player was casting
- Remove/disable the dummy ability from/on all selected units
- All the while check for other orders issued to those units and update their last orders as necessary.
Last edited: