• 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.

[JASS] Quick help with unit life

Status
Not open for further replies.
Level 6
Joined
Mar 20, 2008
Messages
208
Having some problems with this code.
It increases a random stat by 1.
It increases the maximum health of the caster by 3 per level.

I can get the stats to increase just fine. However, I can't seem to get the max life to increase at all. Any help is appreciated.


Code:
function Trig_Natures_Growth_Actions takes nothing returns nothing
    local unit spellcaster = GetSpellAbilityUnit()
    local integer spelllevel = GetUnitAbilityLevel(spellcaster,'ANbr') 
    local integer statdice = GetRandomInt(0, 2)
    local real temp = GetUnitState(spellcaster, UNIT_STATE_MAX_LIFE) + (spelllevel*3)

    call SetUnitState(spellcaster, UNIT_STATE_LIFE, temp)
    call SetUnitState(spellcaster, UNIT_STATE_MAX_LIFE, temp)    
     
    if (statdice == 0) then
        call SetHeroStr(spellcaster, GetHeroStr(spellcaster, false)+1, true)
    else
        if (statdice == 1) then
           call SetHeroAgi(spellcaster, GetHeroAgi(spellcaster, false)+1, true)  
        else
           call SetHeroInt(spellcaster, GetHeroInt(spellcaster, false)+1, true)
        endif 
    endif

    spellcaster = null
endfunction
 
Status
Not open for further replies.
Top