This is like a statistic system when a hero gains a level he is able to choose a stat that he wants, if he picks vitality it is supposed to give +15 hit points and spirit + 15 mana points but this isn't working, there is no syntax errors.
Any ideas will be appreciated.
JASS:
scope StatsAdd initializer Init
private function Actions takes nothing returns nothing
local unit hero = GetTriggerUnit()
local real currenthp = GetUnitState(hero, UNIT_STATE_MAX_LIFE)
local real currentmp = GetUnitState(hero, UNIT_STATE_MAX_MANA)
local real currentstr = GetHeroStr(hero, true)
local real currentagi = GetHeroAgi(hero, true)
local real currentint = GetHeroInt(hero, true)
local real plusmp = currentmp + 15
local real plushp = currenthp + 15
local real plusstr = currentstr + 1
local real plusagi = currentagi + 1
local real plusint = currentint + 1
if GetLearnedSkill() == 'A00V' then
call SetUnitState(hero, UNIT_STATE_MAX_LIFE, plushp)
elseif GetLearnedSkill() == 'A00W' then
call SetUnitState(hero, UNIT_STATE_MAX_MANA, plusmp)
elseif GetLearnedSkill() == 'A00X' then
call SetHeroStr(hero,R2I( plusstr), true)
elseif GetLearnedSkill() == 'A00Y' then
call SetHeroAgi(hero,R2I( plusagi), true)
elseif GetLearnedSkill() == 'A00Z' then
call SetHeroInt(hero,R2I( plusint), true)
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger StatsAddTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( StatsAddTrg, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction(StatsAddTrg, function Actions )
endfunction
endscope
Any ideas will be appreciated.