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

[Solved] Stats System not working,but no syntax errors

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2012
Messages
63
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.

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.
 
Status
Not open for further replies.
Top