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

[Spell] Set unit damage?

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2012
Messages
63
I want to set the damage of my unit that was created, like is there a function for that? (in vjass)
JASS:
scope Wolf initializer Init
globals
      private constant integer ABI_ID = 'A00K'
      private constant integer WOLF = 'h00C'
endglobals

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

private function Actions takes nothing returns nothing
    local unit hero    = GetTriggerUnit()
    local player owner = GetOwningPlayer(hero)
    local integer pid  = GetPlayerId(owner) + 1 
    local real str     = GetHeroStr(hero,true)
    local unit wolf

    call CreateUnit(pid, WOLF, GetUnitX(hero), GetUnitY(hero), 0)
    set wolf = GetLastCreatedUnit()
    call SetUnitState(wolf, UNIT_STATE_MAX_LIFE, (str * 2) + (str * 0.75)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger WolfTrg = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( WolfTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( WolfTrg, Condition( function Conditions ) )
    call TriggerAddAction( WolfTrg, function Actions )
endfunction
endscope

That's what i wrote, but I also want to set the damage of my wolf that I made, any suggestions will be appreciated.
 
Status
Not open for further replies.
Top