Solved Check if mob died, add 1 to players xp

  • 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.

BatDev0

Member
May 16, 2020
25
2
3
Code:
on load:
    set {_playerXP} to 0


on death:
    if attacker is a player:
        set {_playerXP} to {_playerXP} + 1
        message "+1"

command /xp:
    trigger:
        message "%{_playerXP}% is the current xp"

On death isnt getting called, with my test of +1 it doesnt send the message. And messaging the player the current xp shows <none>. How do I fix it so my on death: gets called.
 
Code:
on load:
    set {playerXP::%attacker%}

on death:
    victim is #whatevermobyouwant:
        if attacker is player:
            add 1 to {playerXP::%attacker%}
            send "+1" to attacker

command xp:
    trigger:
        send "%{playerXP::%attacker}% is the current xp."

this should work. havent tested it tho.​
 
Code:
on join:
    set {playerXP::%player%} to 0

on death:
    victim is Zombie:
        if attacker is player:
            add 1 to {playerXP::%player%}
            send "+1" to attacker
   
command xp:
    trigger:
        send "%{playerXP::%player%}% is the current xp."

this should work. havent tested it tho.​

Is there anyway I could do all mobs? @Stefqnutz
It also doesnt add the xp
 
Last edited:
I know this is mighty spoon feeding but i got bored and wanted to do something that was semi decent
Code:
on death of monster:
    if attacker is player:
        add 1 to {XP::%attacker's uuid%}
        
on first join:
    set {XP::%player's uuid%} to 0
    
command /xp [<text>] [<offline player>]:
    trigger:
        if arg-1 is set:
            if player has permission "skxp.admin":
                if arg-1 = "reset":
                    if arg-2 is set:
                        if arg-2 = "all":
                            delete {XP::*}
                            send "&c[!] You have deleted everyone's XP level!"
                        else:
                            delete {XP::%arg-2's uuid%}
                            send "&c[!] You have deleted %arg-2%'s XP"
                    else:
                        send "&c[!] You need to have a player or all as your second argument!"
                else:
                    send "&c[!] Invalid Argument! Valid: reset [<player/all>]"
            else:
                send "&c[!] Invalid command! Usage: /xp"
        else:
            send "&c[!] Your XP Level is: &a%{XP::%player's uuid%}%"

If anything doesn't make sense/doesn't work feel free to ask and i'll explain it to you:emoji_slight_smile:
 
I know this is mighty spoon feeding but i got bored and wanted to do something that was semi decent
Code:
on death of monster:
    if attacker is player:
        add 1 to {XP::%attacker's uuid%}
       
on first join:
    set {XP::%player's uuid%} to 0
   
command /xp [<text>] [<offline player>]:
    trigger:
        if arg-1 is set:
            if player has permission "skxp.admin":
                if arg-1 = "reset":
                    if arg-2 is set:
                        if arg-2 = "all":
                            delete {XP::*}
                            send "&c[!] You have deleted everyone's XP level!"
                        else:
                            delete {XP::%arg-2's uuid%}
                            send "&c[!] You have deleted %arg-2%'s XP"
                    else:
                        send "&c[!] You need to have a player or all as your second argument!"
                else:
                    send "&c[!] Invalid Argument! Valid: reset [<player/all>]"
            else:
                send "&c[!] Invalid command! Usage: /xp"
        else:
            send "&c[!] Your XP Level is: &a%{XP::%player's uuid%}%"

If anything doesn't make sense/doesn't work feel free to ask and i'll explain it to you:emoji_slight_smile:
Ty! I will try this later. But thanks for the help. I feel like understand everything.
 
Status
Not open for further replies.