• 🏆 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!

[vJASS] Resetting an Ability's cooldown

Status
Not open for further replies.
Level 19
Joined
Oct 12, 2007
Messages
1,821
I want to do the following but I'm not sure if it's possible:

A unit uses an ability on the ground.
The x and y of the targetted area are called Dat.x and Dat.y.

JASS:
call GroupEnumUnitsInRange(Dat.g, Dat.x, Dat.y, 130., Bool)
    if FirstOfGroup(Dat.g) == null then
        /// Reset Cooldown and give a yellow text message just like you
        /// would get if you tried to cast the spell on a wrong target.
    endif
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Maker beat me :D so dont bother reading this if you read makers post, this is totally the same.

JASS:
call UnitRemoveAbility(..)
call UnitAddAbility(..)
This is one way of resetting cooldown. The other is call UnitResetCooldown(whichunit) but that resets all cooldowns.
I dont know if there is any other way to reset cooldowns.
Also the message is a bit harder, you can use call DisplayTimedTextToPlayer(whichPlayer, x, y, duration, message) but the x and y are resolution dependant I believe. Actually:
Vexorian said:
Edit: Just tested and it isn't resolution independent, so I won't use it.
in post in http://www.wc3c.net/showthread.php?t=101260 but you can use values that he used, 0.52, 0.96
 
Last edited:
Status
Not open for further replies.
Top