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