Hello, I am building an app with a quest, experience, and level system like a video game. Users do X task and get 10x Experience points. At 100 exp they hit level 2 and so on. What I’m trying to figure out is how to set this up for each individual user.
Example:
I have a library function where users can mark books as finished. When they do I want to add +10 to that users EXP total.
When the users EXP total hits a threshold of 100 I want their LEVEL to increase by 1.
I am sure there are a lot of ways to do this. One way is to just have a field for the user called totalPoints. Then just add 10 when they do the task. At this point you can just determine what to show on the screen by how many points they have. If they have over 100 points show Level ‘2’ on the screen.
If you really want to save the Level data in the database you can do that too. When you add points to the total points and the points = 100 then change the level field in the user data type to 2. Or something like that.
What’s the function to add +10 to current users’ experience? Is that a thing?
Then how do I increase the users level at a certain threshold. This is one of the last things I need to figure out. Can you give me an example or mock up?
There is always more than one way to do something.
Here is another option. In the database, create a type for levels. Save something like this in your database:
LEVEL
Level - 1
Name - Beginner
Exp - 100
Level - 2
Name - Novice
Exp - 200
Level - 3
Name - Apprentice
Exp - 300
Etc….
So instead of doing a condition, you could do this:
In the workflow you can just search your database depending on what level you are on and it will return the value. Then you can attach it to your user. Just switch them out as they level up.
Good question, I think when they hit 100, save the level to the user. Don’t change it until they hit 200. Then save the next level to the user. Does that make sense?
that would make sense, but does that mean I have to make a manual workflow for each level? Sorry im sure this is such an easy thing to do, but cant wrap my head around it.
Still looking for a solution, xp is changed through multiple things and my users already have a bunch of “coins” I want to change to xp, so kind of impractical to do once user does an action right now.
When the user’s experience goes hits 100 or over, it triggers a subtraction of 100 and a +1 level
It might need some more fixing to handle if someone’s XP goes from 10 to 200 for example though. Right now I think it would level them up, leave them with 100 XP still. Then the next time something happens to the User datatype it would trigger the level up again.
Here’s version 2 of the workflow action. If their XP is at 221, it leaves 21 XP behind but add 2 to their level. (in theory)
You’ll have to go to your app settings, Version tab, and enable paranthesis.