• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How can I get if a unit successfully casted a spell?

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,587
Maybe I'm not understanding but you know a spell is successful when this Event happens:
  • Unit - A unit Starts the effect of an ability
I don't think you can detect when the Targets Allowed failed, because that happens before Order/Spell Events.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Maybe I'm not understanding but you know a spell is successful when this Event happens:
  • Unit - A unit Starts the effect of an ability
I don't think you can detect when the Targets Allowed failed, because that happens before Order/Spell Events.
Thinking well, I could do something like:
1) Issues the order: set a boolean to false.
2) Spell Effect: set that boolean to true.
3) Spell Finish: check the value of the boolean.
But you just said that the fail happens before the Order/Spell Events, right?
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
The order onto unit function returns a boolean, which tells you if the order is going to be done (Mana, cooldown, valid target, silenced, ....).
Oh, really?
Maybe a better way to approach this is by figuring out a different path to what you want. What do you intend to do with this information if you had it?
I'm creating a system that when you press a button, a dummy caster cast a spell to the main selected unit, but I have to know that it happened because the button could be wasted in nothing, and need to know if there is a general way to achieve that.

If you are curious this thread is connected with these other 3:
 
Level 39
Joined
Feb 27, 2007
Messages
5,036
Then yes checking that the order issued to the dummy returned true will confirm that the unit was able to cast the spell at the time it was issued. If, say, the unit gets stunned between the order and when it is actually cast (and then reordered something else so the spell is never cast)… then the order would have returned true but the spell was never cast. That seems unlikely with dummy units but in principle it could happen with an immobile dummy unit and the target leaving vision before the cast goes off.
 
Status
Not open for further replies.
Top