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

[Solved] Ability won't trigger cooldown

Status
Not open for further replies.
Level 6
Joined
May 15, 2009
Messages
191
Hello every1, im asking for help... Yet again. This time I can't seem to get the cooldown of my ability to work, everything else seems to work just fine, but the cooldown is non-exsistent.
  • Blade Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blade Charge
    • Actions
      • Set BladeCharge_Caster = (Triggering unit)
      • Set BladeCharge_CasterLoc = (Position of (Triggering unit))
      • Set BladeCharge_Target = (Target unit of ability being cast)
      • Set BladeCharge_TargetLoc = (Position of BladeCharge_Target)
      • Animation - Change BladeCharge_Caster's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Unit - Move BladeCharge_Caster instantly to BladeCharge_TargetLoc
      • Custom script: call RemoveLocation(udg_BladeCharge_TargetLoc)
      • Custom script: call RemoveLocation(udg_BladeCharge_CasterLoc)
      • Animation - Play BladeCharge_Caster's attack animation
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Blade Charge for BladeCharge_Caster) Equal to 1
        • Then - Actions
          • Unit - Cause BladeCharge_Caster to damage BladeCharge_Target, dealing (90.00 + (Real((Agility of BladeCharge_Caster (Include bonuses))))) damage of attack type Hero and damage type Normal
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Blade Charge for BladeCharge_Caster) Equal to 2
            • Then - Actions
              • Unit - Cause BladeCharge_Caster to damage BladeCharge_Target, dealing (100.00 + (Real((Agility of BladeCharge_Caster (Include bonuses))))) damage of attack type Hero and damage type Normal
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Blade Charge for BladeCharge_Caster) Equal to 3
                • Then - Actions
                  • Unit - Cause BladeCharge_Caster to damage BladeCharge_Target, dealing (110.00 + (Real((Agility of BladeCharge_Caster (Include bonuses))))) damage of attack type Hero and damage type Normal
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Blade Charge for BladeCharge_Caster) Equal to 4
                    • Then - Actions
                      • Unit - Cause BladeCharge_Caster to damage BladeCharge_Target, dealing (120.00 + (Real((Agility of BladeCharge_Caster (Include bonuses))))) damage of attack type Hero and damage type Normal
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Blade Charge for BladeCharge_Caster) Equal to 5
                        • Then - Actions
                          • Unit - Cause BladeCharge_Caster to damage BladeCharge_Target, dealing (130.00 + (Real((Agility of BladeCharge_Caster (Include bonuses))))) damage of attack type Hero and damage type Normal
                        • Else - Actions
      • Special Effect - Create a special effect attached to the chest of BladeCharge_Caster using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Animation - Change BladeCharge_Caster's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency

Thx in advance.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You move unit instantly thus it interrupts the order-cast a spell and therefore spell 'won't be used'.

EDIT your trigger can be much simpler.
  • Blade Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blade Charge
    • Actions
      • Set BladeCharge_Caster = (Triggering unit)
      • Set BladeCharge_CasterLoc = (Position of (Triggering unit))
      • Set BladeCharge_Target = (Target unit of ability being cast)
      • Set BladeCharge_TargetLoc = (Position of BladeCharge_Target)
      • Animation - Change BladeCharge_Caster's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Unit - Move BladeCharge_Caster instantly to BladeCharge_TargetLoc
      • Custom script: call RemoveLocation(udg_BladeCharge_TargetLoc)
      • Custom script: call RemoveLocation(udg_BladeCharge_CasterLoc)
      • Animation - Play BladeCharge_Caster's attack animation
      • Set damage = (80.00 + ((Real(10 x (Level of Blade Charge for (Triggering unit)))) + (Real((Agility of BladeCharge_Caster (Include bonuses))))))
      • Unit - Cause BladeCharge_Caster to damage BladeCharge_Target, dealing damage damage of attack type Hero and damage type Normal
      • Special Effect - Create a special effect attached to the chest of BladeCharge_Caster using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Animation - Change BladeCharge_Caster's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
 
  • Like
Reactions: Kam

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Use the SetUnitX and SetUnitY natives.

JASS:
native SetUnitX takes unit whichUnit,real newX returns nothing
native SetUnitY takes unit whichUnit,real newY returns nothing

example of use (for above code)...

JASS:
call SetUnitX(udg_BladeCharge_Caster,GetLocationX(udg_BladeCharge_TargetLoc))
call SetUnitY(udg_BladeCharge_Caster,GetLocationY(udg_BladeCharge_TargetLoc))

These natives change a unit's position on a play field without interupting its orders. Replacing the conventional GUI move with the 2 example lines above should hopefully fix the problem.
 
Level 6
Joined
May 15, 2009
Messages
191
Well the spell is based off of channel, with no Follow Through time, unit target and no casting time either. Sorry for not telling in the first place, I was kind of in a hurry writing the first post.

And by thx Dr Super Good, I used your script and the ability works perfectly. rep already added.
 
Status
Not open for further replies.
Top