ok i’m pretty much a newb here and have been tearing my hair out over this for almost a week now. i have set up a blue print experience system in the image below but the big thing i cant get to work is getting the extra exp to carry over to the next level correctly
the part in the red box is where i am doing the math to carry the exp over to next level and it works for the first level up only then for some reason it adds 1200 extra exp to the exp current for level agility variable per new level gained i have tried swapping the math area around with the change current agility which makes it go into negative exp for current level.
if theres any explanation of the variables and what they do needed just ask i’ll do my best to explain everything in the image
oh side note on paper the maths works correctly but for some reason its not transfering to the blueprint math calculations. thanks in advance
Hello,
why not only do simply current xp = current xp + new xp won on each xp won and then with a var “level” check if current xp > to xp needed to new level (in an array where index is the level and value the xp value) with branch : true: level = new level ?
thanks for answering altho i’m not quite sure what you mean . sorry i am pretty new to blue prints and not sure how i would set up an array like that i think i understand what you mean tho…
in the array you have all levels exp amount to get to that level and then i would compare current exp against that array to decide which level i am at and then carry the excess over to the current for level variable is that about what you mean? if so i’ll do some research and see if i can figure out how to set that up…thanks for the suggestion it looks like it has good possibilities
This isn’t a question regarding blueprints specifically. This question is more related to simply understanding code logic in general. An experience points system can work in one of multiple ways, either by having a requirement level be reached by the player, and then resetting that experience back down to 0, and changing the new goal to the next index in an array of level requirements, or a convoluted way achieved using a massively long integer. (you could still easily determine total experience to display to the player by checking the experience required per level up to the player’s current level, and then add the current experience points)
Simply have an experience variable for the player. Each time experience is gained, run a check to see if the experience has reached the array index corresponding to the player’s current level; for simplicity, you can assume a player starts at level 0, so the check would find index 0 of the array, which would have the requirement that the player needs to fulfill to level up. If the experience points are greater than or equal to the corresponding index value for experience, then take the current experience (after the check) and subtract the required experience amount, which would be the ‘carried over’ experience. (just add this number to the recently reset experience count variable) After that, add a value to the player’s level variable, and when the check is run next time, it will check the second value in the array (index 1) which should, if you’re making leveling up exponentially harder, be a value larger than the first check. You could run a second check as well after the experience is carried over as well and check it against the new level requirement, because the player may have gained enough experience to level up twice.
This entire system would require an experience variable that would be restricted to the largest integer in the level requirements array, the level requirements array, which would have as many indexes as you have levels, and a player level variable. There’s other ways to do this, and tons of better ways to do it as well, but this would work and you should be able to understand the logic behind it as well, which should hopefully explain basic maths principles.
thank you both so much although i dont think i fully grasped what you meant, as i am not very experienced with coding or blue prints yet it did put me on to a path that has done what i set out to do now the experience gained tallies up in a total exp variable aswell as a current for this level variable and when the level increases by 1 the excess carries over again thank you both for your help :D:D:D:D
again thank you for pionting me in the right direction. if anyone wants to see the blue print for the working set up here it is
current agility --is the level of the agility skill(this is what i am leveling up) exp needed to level this level agility – is the experience from start to finish the level agility is at should cost in experience total exp agility – is the total amount of exp gained for the agility skill exp current for level agility – is the experience you have in the current level of agility
**exp level array ** – is the array which holds the amount of experience every level requires to achieve it(this took a while to do all the inputing for 100 seperate levels and i took an attempt or 2 to realise that each level is that levels requirements plus the requirements from each and every level before it)
edit-- forgot to put clamps in for max agility level and max exp the total exp variable can hold but that should be pretty simple for people to figure out