• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] How to check if an ability is ready to cast?

Status
Not open for further replies.
Level 13
Joined
Mar 19, 2010
Messages
870
ok, that is an workaround but is it possible without it?

For example:

if i call this here:
JASS:
call IssueTargetOrder(.hero, DO_ORDER, .target)
, it gives true or false back. but as i suspect if it gives "true" back it will also cast the ability, right?
 
ok, that is an workaround but is it possible without it?

For example:

if i call this here:
JASS:
call IssueTargetOrder(.hero, DO_ORDER, .target)
, it gives true or false back. but as i suspect if it gives "true" back it will also cast the ability, right?

I have no idea, I don't use jass. Anyway I created a test map for you. Use water elemental ability and wait until the cooldown is over.
 

Attachments

  • cooldown.w3x
    16.4 KB · Views: 67
Level 24
Joined
Aug 1, 2013
Messages
4,657
If that function returns true, you are able to cast it.
Units that can cast those abilities instantly (0 cast time, 0 cast point, 0 rotation delay, etc) will have cast it before you can order them to stop casting it.
Then you also have abilities like berserk, defend, etc.

But that is not the only thing...
When it returns false, the reason may be from many different things.
It could be the ability is on cooldown, but it could also be that the unit hasnt got enough mana, the target that is used is untargetable, the caster is stunned/silenced/whatever, etc.

So keeping track of the cooldowns and stuff is the best thing to do.
 
Status
Not open for further replies.
Top