Solved Zombie Level System

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Cold

Member
May 1, 2022
29
0
1
Hello.

I want to create a level system where you can get xp from killing zombies and when you have enough xp for a level it will automatically level up to next level.
 
I think this should work. The skript parser returned no errors, but if something doesn't work lmk.
Code:
options:
    xpPerKill: 5
    xpPerLevel: 50

on join:
    if {xp::%player's uuid%} isn't set:
        set {xp::%player's uuid%} to 0
    if {level::%player's uuid%} isn't set:
        set {level::%player's uuid%} to 0

on death of zombie:
    attacker is player
    set {_p} to attacker
    set {_u} to attacker's uuid
    add 5 to {xp::%{_u}%}
    if {xp::%{_u}%} >= {@xpPerLevel}:
        add 1 to {level::%{_u}%}
        remove {@xpPerLevel} from {xp::%{_u}%}
        broadcast "Player %{_p}% has leveled up to %{level::%{_u}%}%!"
 
How do I make so when you get level 2 you need 100 instead of 50 xp and level 3 200 xp and so on
 
You will need to create a custom formula for that. You can set a variable such as {_price} and then set that to 2*{@xpPerLevel} if you want it to go up by 50 each time (as an example).
 
Status
Not open for further replies.