playMaker

Author Topic: EXP slider/levelling conundrum  (Read 1616 times)

JoeGameDev

  • Playmaker Newbie
  • *
  • Posts: 21
EXP slider/levelling conundrum
« on: August 26, 2024, 10:32:16 AM »
Hi everybody! I'll include a screenshot of my FSM, but in case it doesn't load or isn't clear, here's a summary of my problem:

I am using a slider to display my EXP progress. It's a simple system, just collect little EXP orbs and the slider fills up. When the slider completely fills, it resets to 0 and starts again.

What I am attempting to do is have the player "level up" after each time they fill the bar. Meaning, I want the max value of the slider to go up each time it resets. This is where I'm having a problem.




If you can see the first image (or can't) I have a collision event, which triggers a transition to the Add to Score state, where I have an Int Operater add a value of 1 to to the Object Score variable. The next state has two Int Compare actions (i'm just trying to get the proof of concept going here) which, when certain thresholds are reached, will transition to a Level Up state, where the exp bar is reset.

The second image shows one of these states. If you can't see it (because I'm dumb) I have three actions active: UI Slider Set Value, which I've reset to 0; UI Slider Set Min Max, which I've set the Max value to the higher value in the variable "level 2"; and Set Int Value, which I've put Object Score at 0.

The problem I kept running into was that the bar would reset to 0, but since my Object Score had retained the score from the first level, the bar would jump to 1/3 filled as soon as I gained another exp point, to reflect the value of the variable Object Score. My solution was to simply reset the Object Score variable to 0. It isn't a great solution even if it worked, because I'm losing the player's score, but the new issue is that with the Object Score reset to 0, it reaches the Int Check threshold from the previous level, meaning the bar only fills up 1/3 of the way before it resets.

I imagine I could simply build 30 (or 40, or 50...) of these little cycles to avoid the issue, setting the thresholds higher in each Int Check state, but I want to be sure I'm not missing a simpler solution. Any ideas, friends?

Thanks in advance.

JoeGameDev

  • Playmaker Newbie
  • *
  • Posts: 21
Re: EXP slider/levelling conundrum
« Reply #1 on: August 26, 2024, 03:31:12 PM »
Okay so, as these things tend to go, in the process of going over the process while posting, I figured out a possible solution. I don't know if this is good or elegant, but here it is:

I have tied the EXP bar to a second variable -- "EXP" -- which I tally as an Int Operator alongside the Object Score. This way I can keep the score while also not have all the issues involved with tying it to the EXP bar.

I'm open to other ideas if anyone knows a better system!