• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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