• 🏆 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] Cooldown reset

Status
Not open for further replies.
Level 3
Joined
May 10, 2010
Messages
6
Hey people, can someone tell me what's wrong with my trigger?

I want the hero to cast an ability. If he kills a unit with it, the cooldown is reset. If he doesn't kill a unit, the cooldown isn't reset.

  • KBReset
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Killing Blow
    • Actions
    • If - Conditions
      • ((Target unit of ability being cast) is dead) Equal to True
    • Then - Actions
      • Set KBinteger = (Level of Killing Blow for (Triggering unit))
      • Unit - Remove Killing Blow from (Triggering unit)
      • Wait 0.01 seconds
      • Unit - Add Killing Blow to (Triggering Unit)
      • Unit - Set level of Killing Blow for (Triggering unit) to KBinteger
      • Else - Actions
        • Do nothing
i'm kinda new, sorry if this is a bad question
 
Last edited by a moderator:
Level 13
Joined
Jun 3, 2011
Messages
1,058
Hey people, can someone tell me what's wrong with my trigger?

I want the hero to cast an ability. If he kills a unit with it, the cooldown is reset. If he doesn't kill a unit, the cooldown isn't reset.

  • KBReset
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Killing Blow
    • Actions
    • If - Conditions
      • ((Target unit of ability being cast) is dead) Equal to True
    • Then - Actions
      • Set KBinteger = (Level of Killing Blow for (Triggering unit))
      • Unit - Remove Killing Blow from (Triggering unit)
      • Wait 0.01 seconds
      • Unit - Add Killing Blow to (Triggering Unit)
      • Unit - Set level of Killing Blow for (Triggering unit) to KBinteger
      • Else - Actions
        • Do nothing
i'm kinda new, sorry if this is a bad question

Don't use the triggering unit use Casting unit or so
 
The unit isn't going to die right away from the trigger. At the time that it is finished, I think it is still before damage has been applied.

I recommend that you either use a countdown timer of a short length and then check if it is dead, or see if the target has health that is less than or equal to how much damage the spell does. (just remember to factor in immunities if your spell map has any)
 
@Legendary

You are making things worse :\

Triggering Unit is faster than GetSpellAbilityUnit or anything that is event-related

@arfus

The minimum average wait value is 0.27,so setting it to 0.01 is useless.
Why do you need a wait in the first place even though you want to reset it quickly?

Okay.First,do the damage via triggers not object editor.
Second,before damaging the unit,check if the life of the target is less than the damage.If less than,do damage and do reset,if not,don't reset
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I used Damage Engine by Bribe, this should work.

  • DamageCheck
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Level of Inventory (Hero) for DamageEventSource) Greater than 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Life of DamageEventTarget) - DamageEventAmount) Less than 0.41
        • Then - Actions
          • Game - Display to Player Group - Player 1 (Red) for 3.00 seconds the text: Killing Blow
        • Else - Actions
Change the ability in the condition and remove/add ablity if it is the killing blow.

Copy the Damage Engine and Unit Indexer triggers into your map for this to work.
 

Attachments

  • Damage Engine v2.2.1.0.w3x
    32.7 KB · Views: 81
Status
Not open for further replies.
Top