Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 7,866
I'm trying to create a system that prevents a unit from interrupting it's own spell casts when issuing orders (with the exception of "stop"). So once a unit starts casting a spell it can't Attack, Move, Patrol, or cast another spell until the current spell's animation is finished playing. The animations are played using SetUnitAnimationIndex and I use a Timer to ensure that the full animation plays. The issue is that the player can interrupt the Animation by issuing an order such as "Move". I'm looking for a way to get around this without straying too far from the normal Warcraft 3 mechanics. Also, remember that "Stop" should remain enabled as this is used to cancel the ability cast.
In other words, i'm looking for something like Cast Time (the Object Editor field) except without it's specific Animation limitations. That's the only thing stopping me from using it.
Things I tried:
1) Cast Stun on the unit. This almost works, as it prevents the unit from interrupting the animation with orders. However, it also prevents the use of the "Stop" order so it's a no go.
2) Disable the Move ("Amov") ability. This for whatever reason disables Move, Patrol, Stop, and Hold Position. So again I can't use this as I need "Stop" to remain enabled.
One idea that comes to mind is to use an ability based on Berserk. This ability would mimic Stop while casting a spell (It would have the "S" hotkey). So I would disable Move, which also disables Stop, then add the Berserk ability, and finally have a trigger to detect if the caster uses Berserk. If Berserk is used while casting then I would treat it as a "Stop" order and interrupt the cast.
Edit: I managed to get it to work with the Berserk ability idea, but it's still not ideal as disabling Move prevents you from issuing orders and thus prevents queuing up orders for your unit to do after the spell is completed.
Ideally, it would work like stun and allow you to queue orders while stunned so once the stun wears off or in this case once the ability finishes casting, the unit will immediately issue the most recent order it had been given.
In other words, i'm looking for something like Cast Time (the Object Editor field) except without it's specific Animation limitations. That's the only thing stopping me from using it.
Things I tried:
1) Cast Stun on the unit. This almost works, as it prevents the unit from interrupting the animation with orders. However, it also prevents the use of the "Stop" order so it's a no go.
2) Disable the Move ("Amov") ability. This for whatever reason disables Move, Patrol, Stop, and Hold Position. So again I can't use this as I need "Stop" to remain enabled.
One idea that comes to mind is to use an ability based on Berserk. This ability would mimic Stop while casting a spell (It would have the "S" hotkey). So I would disable Move, which also disables Stop, then add the Berserk ability, and finally have a trigger to detect if the caster uses Berserk. If Berserk is used while casting then I would treat it as a "Stop" order and interrupt the cast.
Edit: I managed to get it to work with the Berserk ability idea, but it's still not ideal as disabling Move prevents you from issuing orders and thus prevents queuing up orders for your unit to do after the spell is completed.
Ideally, it would work like stun and allow you to queue orders while stunned so once the stun wears off or in this case once the ability finishes casting, the unit will immediately issue the most recent order it had been given.
Last edited: