Jump to content

Could anyone help me with some code?


CuteLittleSpark

Recommended Posts

#this is the working skript i have so far. #

on death:

attacker is a player:

victim is a player:

if {armorlevel::%victim's uuid%} is not set:

set {armorlevel::%victim's uuid%} to 0

else if {armorlevel::%victim's uuid%} >= 2:

remove 2 from {armorlevel::%victim's uuid%}

else:

set {armorlevel::%victim's uuid%} to 0

if {armorlevel::%attacker's uuid%} ? 0 < 29:

add 1 to {armorlevel::%attacker's uuid%}

setArmor(attacker)

else:

send action bar "&eArmor &8| &cMax. level reached!" to attacker

 

on respawn:

setArmor(player)

 

function setArmor(p: player):

set {_pid} to uuid of {_p}

set {_amlv} to {armorlevel::%{_pid}%} ? 0

set {_p}'s helmet to air

set {_p}'s chestplate to air

set {_p}'s leggings to air

set {_p}'s boots to air

if {_amlv} < 5:

if {_p}'s inventory doesn't contain wooden sword:

loop all items in inventory of {_p}:

"%loop-item%" contains "sword":

remove loop-item from inventory of {_p}

set slot 0 of {_p}'s inventory to wooden sword

loop 5 times:

if {_amlv} = 1, 2, 3 or 4:

set {_diff} to difference between {_amlv} and 1

set {_mat} to "leather"

if {_amlv} = 6, 7, 8 or 9:

set {_diff} to difference between {_amlv} and 6

set {_mat} to "chain"

if {_amlv} = 11, 12, 13 or 14:

set {_diff} to difference between {_amlv} and 11

set {_mat} to "gold"

if {_amlv} = 16, 17, 18 or 19:

set {_diff} to difference between {_amlv} and 16

set {_mat} to "iron"

if {_amlv} = 21, 22, 23 or 24:

set {_diff} to difference between {_amlv} and 21

set {_mat} to "diamond"

if {_amlv} = 26, 27, 28 or 29:

set {_diff} to difference between {_amlv} and 26

set {_mat} to "netherite"

if {_amlv} = 1, 6, 11, 16, 21 or 26:

set {_p}'s boots to "%{_mat}% boots" parsed as itemtype

if {_amlv} = 2, 7, 12, 17, 22 or 27:

set {_p}'s leggings to "%{_mat}% leggings" parsed as itemtype

if {_amlv} = 3, 8, 13, 18, 23 or 28:

set {_p}'s chestplate to "%{_mat}% chestplate" parsed as itemtype

if {_amlv} = 4, 9, 14, 19, 24 or 29:

set {_p}'s helmet to "%{_mat}% helmet" parsed as itemtype

if {_diff} > 0:

remove 1 from {_amlv}

loop all items in inventory of {_p}:

"%loop-item%" contains "sword":

remove loop-item from inventory of {_p}

if {_amlv} >= 5:

set {_mat} to "stone"

if {_amlv} >= 10:

set {_mat} to "gold"

if {_amlv} >= 15:

set {_mat} to "iron"

if {_amlv} >= 20:

set {_mat} to "diamond"

if {_amlv} >= 25:

set {_mat} to "netherite"

set slot 0 of {_p}'s inventory to "%{_mat}% sword" parsed as itemtype

 

# i was trying to make it so that when a player has a different exp level they get a different armor experience (for example if ur exp lvl 1 u gain 2 armour per kill but lose 3 . and if your exp 2 u gain 3 but lose 4 etc (only needed up for lvl 3)#

#this is what i have so far. which doesn't work properly# 

on death:
 attacker is a player:
  victim is not a player:
   if {armorlevel::%victim's uuid%} is not set:
    set {armorlevel::%victim's uuid%} to 0
   else:
    set {_expLvl} to experience level of victim
    switch {_expLvl}:
        case 1:
            remove 3 from {armorlevel::%victim's uuid%}
            add 2 to {armorlevel::%attacker's uuid%}
            setArmor(attacker)
        case 2:
            remove 4 from {armorlevel::%victim's uuid%}
            add 3 to {armorlevel::%attacker's uuid%}
            setArmor(attacker)
        case 3:
            remove 5 from {armorlevel::%victim's uuid%}
            add 4 to {armorlevel::%attacker's uuid%}
            setArmor(attacker)

function setArmor(p: player):
 set {_pid} to uuid of {_p}
 set {_amlv} to {armorlevel::%{_pid}%} ? 0
#please let me know what i can do or if you have time to correct any of my mistakes i would be eternally greatfull for any and all help.#

Link to comment
Share on other sites

Moved to the Skript forum.

Please keep posts in the proper categories.

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...