- Joined
- Sep 14, 2009
- Messages
- 284
Hi. Sometimes in my map when heroes face boss units, the experience gain is quite large, so large in fact that the heroes gain 2 levels at once.
This is a problem since it messes up the skill points gained, since my map uses this skill point code:
As you can see the heroes are supposed to only gain 1 skill point at level 4, 8, 12, 16 and 20. And all other levels the skill points are substracted by 1.
But when the hero gain2 levels at once the event fails to detect both levels and ends up with 1 skill point at an invalid level.
So my question is how can I solve this problem?
All experience gained is gained from triggers.
This is a problem since it messes up the skill points gained, since my map uses this skill point code:
JASS:
function CharacterLvlUpSkillPoint_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = GetHeroLevel(u)
if i != 20 and i != 16 and i != 12 and i != 8 and i != 4 then
call ModifyHeroSkillPoints(u, bj_MODIFYMETHOD_SUB, 1)
endif
set u = null
endfunction
//===========================================================================
function InitTrig_CharacterLvlUpSkillPoint takes nothing returns nothing
set gg_trg_CharacterLvlUpSkillPoint = CreateTrigger()
call TriggerRegisterPlayerUnitEventSimple(gg_trg_CharacterLvlUpSkillPoint, Player(8), EVENT_PLAYER_HERO_LEVEL)
call TriggerAddAction(gg_trg_CharacterLvlUpSkillPoint, function CharacterLvlUpSkillPoint_Actions)
endfunction
As you can see the heroes are supposed to only gain 1 skill point at level 4, 8, 12, 16 and 20. And all other levels the skill points are substracted by 1.
But when the hero gain2 levels at once the event fails to detect both levels and ends up with 1 skill point at an invalid level.
So my question is how can I solve this problem?
All experience gained is gained from triggers.