XP multiplier and unmultiplier depending on kills/deaths

  • 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 comminuty!

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

bewf

Member
Apr 19, 2024
30
0
6
24
Category:
Skript needed
Suggested name:
xpmultiplier
Spigot/Skript Version:
2.8.4
What I want:
I would like a skript/plugin for an exp multiplier based on your kills/deaths.

DETAILED EXPLANATION:

a player will start at a 1x exp multiplier, which will be 1 point (similair to the strength plugin). Basically the player can go to -5 and to 5x EXP. Every EXP will change your exp multiplier by 0.2
5: 2x
4: 1.8x
3: 1.6x
2: 1.4x
1: 1.2x
0: 1x
-1: 0.8x
-2: 0.6x
-3: 0.4x
-4: 0.2x
-5: 0x

1 death will equal to -1 EXP
1 kill with equal to +1 EXP

I'd also like an item called
&a+1 ᴇxᴘ

that will you you 1 more exp

Id also like the action bar to show your current EXP multiplier

Only player kills/deaths should count
optional: Killing the same player 3x in a row wont give any more multipliers

A similair plugin to this is the strength smp plugin

Ideas for commands:
/withdraw exp

takes away 1 of your EXP increments and gives you the
+1 exp item



When I'd like it by: Friday May 2nd
(later date is fine)

my discord is bewff incase anyone prefers talking over discord
Thank you :emoji_grinning:
 
theres an open source levels smp plugin that does this [if ur tryna add it to levelsgen] also hi bewf im Yushaa
 
theres an open source levels smp plugin that does this [if ur tryna add it to levelsgen] also hi bewf im Yushaa
hi, yah gonna add the multiplier to levelsgen ill look into the plug-in ty
 
theres an open source levels smp plugin that does this [if ur tryna add it to levelsgen] also hi bewf im Yushaa
Couldn't rlly find one that had what I was looking for that's similair to the strength smp plugin
 
I can absolutely make this.

Also what's the strength SMP and do you prefer it as a plugin, mod, or skript?
the strength smp is basically when you kill a player, you get +1 strength (not the effect but more damage) up to 4 or 5, and the same way with player deaths, i just want that with an exp multiplier, PLUGIN or SKRIPT whichever you're more comfortable with. thank you lots
 
this requires skript-reflect
tell me if it works
code_language.skript:
on death:
    if damager is a player:
        set {_a} to {exp::%uuid of damager%.multiplier}
        if {exp::%uuid of damager%.multiplier} is not set:
            set {_a} to 0
        set {_multi} to ({_a} + 5) / 5
        set {_xp} to event.getDroppedExp()
        event.setDroppedExp({_xp}*{_multi})
    else:
        stop
    if victim is not a player:
        stop
    add 1 to {exp::%uuid of damager%.multiplier}
    if {exp::%uuid of damager%.multiplier} is greater than 5:
        set {exp::%uuid of damager%.multiplier} to 5
    else if {exp::%uuid of damager%.multiplier} is less than -5:
        set {exp::%uuid of damager%.multiplier} to -5
    send "&aNew EXP Multiplier: &f%({exp::%uuid of damager%.multiplier} + 5) / 5%x" to damager
    
every 2 seconds:
    loop all players:
        set {_a} to {exp::%uuid of loop-player%.multiplier}
        if {exp::%uuid of loop-player%.multiplier} is not set:
            set {_a} to 0
        set {_multi} to ({_a} + 5) / 5
        set action bar of loop-player to "&aEXP Multiplier: &f%{_multi}%x"
        
command /giveorb [player]:
    permission: op
    trigger:
        set {_arg} to arg-1
        if arg-1 is not set:
            set {_arg} to player
        give player 1 heart of the sea named "&b+1 EXP" with lore "&eRight-Click &7to redeem a +1 EXP multiplier"
        
on right click:
    if player's tool is heart of the sea named "&b+1 EXP" with lore "&eRight-Click &7to redeem a +1 EXP multiplier":
        if {exp::%uuid of player%.multiplier} is 5:
            send "&4You are already at max multiplier!" to player
            stop
        add 1 to {exp::%uuid of player%.multiplier}
        remove player's tool from player's inventory
        send "&aNew EXP Multiplier: &f%({exp::%uuid of player%.multiplier} + 5) / 5%x"

command /withdrawexp <number=1>:
    if {exp::%uuid of player%.multiplier} is -5:
        send "&4You can't withdraw any more" to player
        stop
    remove 1 from {exp::%uuid of player%.multiplier}
    give player 1 heart of the sea named "&b+1 EXP" with lore "&eRight-Click &7to redeem a +1 EXP multiplier"
 
Okay, I'll check it out when the owner is on and let you know. thank you
 
A couple lines longer but this should work better due to using NBT tags and MetaData.
Requires SkBee and skript-reflect.


NOTE:
This is NOT tested and was written on the SkUnity Parser, so it may not work. I will rewrite it on a more recent Skript version if necessary


AppleScript:
options:
    max-multiplier: 5  #can't be bigger than 127
    min-multiplier: -5 #don't make this higher than max
    # this ^ can't be smaller than -128

on death of player:
    metadata tag "xpm" of victim is not set:
        byte tag "XPM" of nbt compound of victim is set:
            set metadata tag "xpm" of victim to byte tag "XPM" of nbt compound of victim
            wait 1 tick
            set {_d} to metadata tag "xpm" of victim
            {@min-multiplier} < {_d}:
                set metadata tag "xpm" of victim to -1+{_d}
            delete byte tag "XPM" of nbt compound of victim
        else:
            send action bar "&cYou have no saved XP multiplier. Resetting to 0." to victim
            set metadata tag "xpm" of victim to 0
    attacker is a player:
        metadata tag "xpm" of attacker is not set:
            byte tag "XPM" of nbt compound of attacker is set:
                set metadata tag "xpm" of attacker to byte tag "XPM" of nbt compound of attacker
                wait 1 tick
                set {_d} to metadata tag "xpm" of attacker
                {@max-multiplier} > {_d}:
                    set metadata tag "xpm" of attacker to 1+{_d}
                delete byte tag "XPM" of nbt compound of victim
            else:
                send action bar "&cYou have no saved XP multiplier. Resetting to 0." to attacker
                set metadata tag "xpm" of attacker to 0
    metadata tag "xpm" of attacker is set:
        metadata tag "xpm" of attacker is not 0
        set {_xp} to metadata tag "xpm" of attacker
        event.setDroppedExp(event.getDroppedExp()*{_xp})

on leave:
    set byte tag "XPM" of nbt compound of player to metadata tag "xpm" of player
    
on join:
    while player is online:
        set {_d} to metadata tag "xpm" of player
        send action bar "&aXP Multiplier: &6%{_d}%" to player
        wait 2 seconds

command givexpitem <player=%player%>:
    permission: *
    trigger:
        give arg-1 heart of the sea named "&b+1 EXP" with lore "&eRight-Click &7to redeem a +1 EXP multiplier"

on right click:
    name of 1 of player's tool contains "&b+1 EXP":
        set {_d} to metadata tag "xpm" of player
        {@max-multiplier} > {_d}:
            set metadata tag "xpm" of player to 1+{_d}
            remove 1 of player's tool from player
            send action bar "&bYou reedemed +1 XP multipler!" to player
        else:
            send action bar "&bYou have hit the max XP multipler!" to player
 
A couple lines longer but this should work better due to using NBT tags and MetaData.
Requires SkBee and skript-reflect.


NOTE:
This is NOT tested and was written on the SkUnity Parser, so it may not work. I will rewrite it on a more recent Skript version if necessary


AppleScript:
options:
    max-multiplier: 5  #can't be bigger than 127
    min-multiplier: -5 #don't make this higher than max
    # this ^ can't be smaller than -128

on death of player:
    metadata tag "xpm" of victim is not set:
        byte tag "XPM" of nbt compound of victim is set:
            set metadata tag "xpm" of victim to byte tag "XPM" of nbt compound of victim
            wait 1 tick
            set {_d} to metadata tag "xpm" of victim
            {@min-multiplier} < {_d}:
                set metadata tag "xpm" of victim to -1+{_d}
            delete byte tag "XPM" of nbt compound of victim
        else:
            send action bar "&cYou have no saved XP multiplier. Resetting to 0." to victim
            set metadata tag "xpm" of victim to 0
    attacker is a player:
        metadata tag "xpm" of attacker is not set:
            byte tag "XPM" of nbt compound of attacker is set:
                set metadata tag "xpm" of attacker to byte tag "XPM" of nbt compound of attacker
                wait 1 tick
                set {_d} to metadata tag "xpm" of attacker
                {@max-multiplier} > {_d}:
                    set metadata tag "xpm" of attacker to 1+{_d}
                delete byte tag "XPM" of nbt compound of victim
            else:
                send action bar "&cYou have no saved XP multiplier. Resetting to 0." to attacker
                set metadata tag "xpm" of attacker to 0
    metadata tag "xpm" of attacker is set:
        metadata tag "xpm" of attacker is not 0
        set {_xp} to metadata tag "xpm" of attacker
        event.setDroppedExp(event.getDroppedExp()*{_xp})

on leave:
    set byte tag "XPM" of nbt compound of player to metadata tag "xpm" of player
   
on join:
    while player is online:
        set {_d} to metadata tag "xpm" of player
        send action bar "&aXP Multiplier: &6%{_d}%" to player
        wait 2 seconds

command givexpitem <player=%player%>:
    permission: *
    trigger:
        give arg-1 heart of the sea named "&b+1 EXP" with lore "&eRight-Click &7to redeem a +1 EXP multiplier"

on right click:
    name of 1 of player's tool contains "&b+1 EXP":
        set {_d} to metadata tag "xpm" of player
        {@max-multiplier} > {_d}:
            set metadata tag "xpm" of player to 1+{_d}
            remove 1 of player's tool from player
            send action bar "&bYou reedemed +1 XP multipler!" to player
        else:
            send action bar "&bYou have hit the max XP multipler!" to player
This does look a lot better, ill try it out and I appreciate it, will i need any addons for it?
 
That awkward moment when the addons you need are right at the top of the message.
anyways ill lyk if it works in a few hours when the owner is on

I ran the skript through SKeditor's analyzer and there are (not sure how accurate it is) 5 errors on lines:

8:
15
20
27
36

its prolly tweaking tho so ill check with the server in a few