• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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