I’m using event system when character level up
when character level up I get buttons to choose upgrade
It works well but when character gets lots of xp at once and level up 2 of 3 at same time
button selection only appear once
I want to player to have chance of selection same as player level
Is there any way to get multiple chance to select when I got lots of level up?
Whenever you have things jammed up like this, the solution is to pull things apart a bit, make each step of the process accessible on its own with its own controlling data structures.
In other words, if you smack an enemy and get XP, this is the ONLY thing that should happen:
- give XP
- check if XP means level-up and set a level-up flag
Now check the level-up flag:
- if level-up flag is set, increase the level by 1 and process everything you need for that
- check if XP means level-up and set a level-up flag
That way it only handles one level-up event at a time, even if you level up multiple times.