# Quest and level system

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.

How would I go about doing this?

Hey there

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.

Does that make sense?

Hope that helps!

For All Your No-Code Education Needs:

• One-on-One Tutoring
• eLearning Hub
• Video Tutorials
• No-Code Classes

Thank you! That seems exactly like what I want to do. How do I add to make a button click add 10 to the user’s data field?

Right now I have it set up under the user like this.

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?

So on a press of a button you can do:

Step 1: Make changes to a current user > Experience = Current User’s Experience + 10

Step 2: Make changes to a current user (Only when experience = 100) > Level = 2

Does that make sense?

So how do we manage this if we want 100 levels? Do we have to make a change workflow 100 times manually?

1 Like

Hey @xtechaus

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.

Does that make sense?

thankyou!

1 Like

running into an issue, if level 1 is 100 xp, and level 2 is 200xp, how do I make sure the user is on level 1 when he has something like 134 xp?

1 Like

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.

No worries. What does your workflow look like now?

it looks like nothing

Ok. How will your user earn points?

after they enter a journal entry, on my account I already have 100 “xp” and can change it anytime.

Bumping

Do you change their xp after they press a button? Screenshots might help us understand exactly what is going on.

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.

Sounds simple enough, try setting up this database trigger:

With this action:

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.

1 Like

Here’s a quick example of it in my test app