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

Spell Cooldown problem

Status
Not open for further replies.
Level 11
Joined
Jul 28, 2007
Messages
920
Does anyone know how can i set some variable to 1, when unit is casting ability, and then after few seconds set it again to 0,
or is there any way to detect when cooldown of some spell is done ?

This doesnt works.

When unit casts ability
set (variable),player number of casting unit, to 1
wait 10 sec (time until specific spell gets cooldowned)
set (variable),player number of casting unit, to 0
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
U need local variables for that, because Casting Unit is an Event-reaction wich probally doesnt match after 10 seconds.

Try this, im using a bolean_variable_array, but u can use your integer_array exactly in the same way ;)
  • Spell
    • Events
      • Unit - A unit Beginns casting an ability
    • Conditions
    • Actions
      • Custom script: local unit u=GetSpellAbilityUnit()
      • Custom script: set udg_Bolean[GetPlayerId(GetOwningPlayer(u))+1]=true
      • Wait 10.00 seconds
      • Custom script: set udg_Bolean[GetPlayerId(GetOwningPlayer(u))+1]=false
Many Custom Scripts ;), but like this it will work. I thought u might want boleans as your using 0 and 1 like true and false ;)

Greets Emm-A-
 
Status
Not open for further replies.
Top