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

Item that refreshes

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Refreshes? You mean restore level back to a previous level or something? Use the set unit level action. Create data structures of all abilities on a certain hero type and the level they should be restored to.

If you mean refresh as in cooldown the ability then this is not possible in WC3 with hero abilities. With normal abilities (not hero abilities) you can do so by removing them and adding them again (this is why it does not work on hero abilities). You may wish to migrate to SC2 where this is possible for all abilities, behaviours and even weapons.
 
Level 4
Joined
Dec 13, 2010
Messages
70
Well, I have found a way refreshing everything but the "Refresher":
JASS:
scope ItemCheese initializer Init

globals
    private constant string CheeseSpellOrder = "web"
    private constant integer CheeseSpellID = 'A01K'
    private boolean justUsed = false
endglobals

private function Conditions takes nothing returns boolean
     return ( GetSpellAbilityId() == CheeseSpellID )
endfunction

private function Actions takes nothing returns nothing
    
    if (justUsed == false) then
        call UnitResetCooldown(GetTriggerUnit())
        set justUsed = true
        call IssueImmediateOrder(GetTriggerUnit(), CheeseSpellOrder)
    else
        set justUsed = false
    endif
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Actions )
    set t = null
endfunction

endscope // ItemCheese

I have tested it and it works. Hopefully there wont be anymore complications.
When I started creating this item, I thought it would be quite simple, but as it turns around, I had to do pretty much :grin:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Oh you mean resetting ability cooldowns. That makes much more sense now.

Like I said, it is impossible to selectively choose which abilities get reset in WC3. You can reset specific abilities by removing them and adding them again but this will break hero abilities (as they will not be learnable afterwards).
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Lol man trust me and just do this.:thumbs_up:

  • Refresher
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Refresher
    • Actions
      • Unit - Reset ability cooldowns for (Triggering unit)
This won't reset the "Refresher" ability cooldown.Because Blizzard is boss.
 
Status
Not open for further replies.
Top