Please help me

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

Flxme

Member
Jun 9, 2022
1
0
1
23
Hi, after several attempts they managed to make this script of mine. As soon as an arrow is shot at a player, the bow disappears for a few seconds and is only returned when time runs out. I would need that if the player in possession of the bow does not have it in their inventory while dying, it is not returned to them after time runs out and given to whoever killed it.

on command "/krypticskills help":
cancel event
send "&4Kry&cptic&fSkills &8| &7Usa /krypticskills give <player> <tipo>"
send "&4Kry&cptic&fSkills &8| &7Tipo &eTeleportBow, SlownessBow, ZombieBow"
send "&4Kry&cptic&fSkills &8| &7Powered by &bLethqls"

on damage:
if name of attacker's held item is "&2Zom&abie &8| &fBow":
if victim is a zombie:
cancel event
if victim is a baby zombie:
cancel event
if victim is a creeper:
cancel event
if victim is a witch:
cancel event
if victim is a cow:
cancel event
if victim is a blaze:
cancel event
if victim is a zombie pigman:
cancel event
if victim is a silverfish:
cancel event
if victim is a bat:
cancel event
if victim is a endermite:
cancel event
if victim is a pig:
cancel event
if victim is a sheep:
cancel event
if victim is a chicken:
cancel event
if victim is a wolf:
cancel event
if victim is a ocelot:
cancel event
if victim is a villager:
cancel event
if victim is a squid:
cancel event
if victim is a ghast:
cancel event
if victim is a rabbit:
cancel event
if victim is a horse:
cancel event
if victim is a guardian:
cancel event
if victim is a player:
remove 1 bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&2Zom&abie &8| &fBow" with lore "&8&m-----------------------------------" and "&7Questo arco ti permette di &7spawnare un" and "&7Baby Zombie&7 potenziato per colpire il" and "&7Nemico ed uscire dalla combo!" and " " and "&cUltimate &8| &8(&4✯✯✯✯&c✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-----------------------------------" from shooter's inventory
spawn a baby zombie
set display name of last spawned baby zombie to "&cCombo &8| &fZombie"
apply speed 2 to the spawned entity for 9999 minutes
add victim to {arcopazzo::*}
send action bar "&cTempo &8| &f1 minuto" to shooter
wait 1 second
send action bar "&cTempo &8| &f59 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f58 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f57 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f56 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f55 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f54 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f53 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f52 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f51 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f50 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f49 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f48 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f47 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f46 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f45 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f44 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f43 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f42 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f41 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f40 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f39 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f38 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f37 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f36 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f35 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f34 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f33 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f32 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f31 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f30 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f29 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f28 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f27 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f26 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f25 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f24 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f23 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f22 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f21 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f20 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f19 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f18 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f17 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f16 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f15 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f14 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f13 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f12 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f11 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f10 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f9 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f8 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f7 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f6 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f5 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f4 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f3 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f2 secondi" to shooter
wait 1 second
send action bar "&cTempo &8| &f1 secondo" to shooter
wait 1 second
send action bar "&4Kry&cptic&fSkills &8| &fArco restituito" to shooter
give a bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&2Zom&abie &8| &fBow" with lore "&8&m-----------------------------------" and "&7Questo arco ti permette di &7spawnare un" and "&7Baby Zombie&7 potenziato per colpire il" and "&7Nemico ed uscire dalla combo!" and " " and "&cUltimate &8| &8(&4✯✯✯✯&c✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-----------------------------------" to shooter



on damage:
if name of attacker's held item is "&8Slow&7ness &8| &fBow":
if victim is a zombie:
cancel event
if victim is a baby zombie:
cancel event
if victim is a creeper:
cancel event
if victim is a witch:
cancel event
if victim is a cow:
cancel event
if victim is a blaze:
cancel event
if victim is a zombie pigman:
cancel event
if victim is a silverfish:
cancel event
if victim is a bat:
cancel event
if victim is a endermite:
cancel event
if victim is a pig:
cancel event
if victim is a sheep:
cancel event
if victim is a chicken:
cancel event
if victim is a wolf:
cancel event
if victim is a ocelot:
cancel event
if victim is a villager:
cancel event
if victim is a squid:
cancel event
if victim is a ghast:
cancel event
if victim is a rabbit:
cancel event
if victim is a horse:
cancel event
if victim is a guardian:
cancel event
if victim is a player:
remove 1 bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&8Slow&7ness &8| &fBow" with lore "&8&m-------------------------------------" and "&7Questo arco ti permette di &7givvare l'effetto" and "&7Slowness al player colpito permettendoti di" and "&7Combarlo oppure in alternativa scappare" and " " and "&cUltimate &8| &8(&4✯✯✯✯✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-------------------------------------" from shooter's inventory
apply slowness 1 to victim for 60 seconds
send action bar "&cSlowness &8| &f1 minuto" to shooter
wait 1 second
send action bar "&cSlowness &8| &f59 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f58 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f57 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f56 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f55 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f54 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f53 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f52 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f51 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f50 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f49 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f48 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f47 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f46 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f45 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f44 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f43 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f42 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f41 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f40 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f39 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f38 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f37 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f36 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f35 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f34 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f33 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f32 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f31 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f30 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f29 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f28 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f27 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f26 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f25 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f24 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f23 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f22 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f21 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f20 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f19 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f18 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f17 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f16 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f15 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f14 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f13 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f12 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f11 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f10 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f9 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f8 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f7 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f6 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f5 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f4 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f3 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f2 secondi" to shooter
wait 1 second
send action bar "&cSlowness &8| &f1 secondo" to shooter
wait 1 second
send action bar "&4Kry&cptic&fSkills &8| &fArco restituito" to shooter
give 1 bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&8Slow&7ness &8| &fBow" with lore "&8&m-------------------------------------" and "&7Questo arco ti permette di &7givvare l'effetto" and "&7Slowness al player colpito permettendoti di" and "&7Combarlo oppure in alternativa scappare" and " " and "&cUltimate &8| &8(&4✯✯✯✯✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-------------------------------------" to shooter

on death of shooter:
clear drops
give 1 bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&8Slow&7ness &8| &fBow" with lore "&8&m-------------------------------------" and "&7Questo arco ti permette di &7givvare l'effetto" and "&7Slowness al player colpito permettendoti di" and "&7Combarlo oppure in alternativa scappare" and " " and "&cUltimate &8| &8(&4✯✯✯✯✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-------------------------------------" to attacker


command /krypticskills give [<player>] [<text>]:
permission: KrypticSkills.give
permission message: &4Kry&cptic&fSkills &8| &7Non hai il permesso!
trigger:
if arg-2 is "ZombieBow":
send "&4Kry&cptic&fSkills &8| &7Hai ricevuto uno ZombieBow"
give a bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&2Zom&abie &8| &fBow" with lore "&8&m-----------------------------------" and "&7Questo arco ti permette di &7spawnare un" and "&7Baby Zombie&7 potenziato per colpire il" and "&7Nemico ed uscire dalla combo!" and " " and "&cUltimate &8| &8(&4✯✯✯✯&c✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-----------------------------------" to player
add item to {arco::*}
give a arrow to player
if arg-2 is "SlownessBow":
send "&4Kry&cptic&fSkills &8| &7Hai ricevuto uno SlownessBow"
give a bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&8Slow&7ness &8| &fBow" with lore "&8&m-------------------------------------" and "&7Questo arco ti permette di &7givvare l'effetto" and "&7Slowness al player colpito permettendoti di" and "&7Combarlo oppure in alternativa scappare" and " " and "&cUltimate &8| &8(&4✯✯✯✯✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-------------------------------------" to player
give a arrow to player
 
Code:
on damage:
if name of attacker's held item is "&2Zom&abie &8| &fBow":
if victim is a zombie:
cancel event
if victim is a baby zombie:
cancel event
if victim is a creeper:
cancel event
if victim is a witch:
cancel event
if victim is a cow:
cancel event
if victim is a blaze:
cancel event
if victim is a zombie pigman:
cancel event
if victim is a silverfish:
cancel event
if victim is a bat:
cancel event
if victim is a endermite:
cancel event
if victim is a pig:
cancel event
if victim is a sheep:
cancel event
if victim is a chicken:
cancel event
if victim is a wolf:
cancel event
if victim is a ocelot:
cancel event
if victim is a villager:
cancel event
if victim is a squid:
cancel event
if victim is a ghast:
cancel event
if victim is a rabbit:
cancel event
if victim is a horse:
cancel event
if victim is a guardian:
cancel event

This, as well as the countdown, is very inefficient, you can cut these to just a few lines.


I don't recommend reusing items with long lores: long lines will slow down reloading and startup proccess significantly, what I did instead is I created variables {slowbow} and {zombiebow} for the bows and reused them when needed.


If you're working with any projectiles like arrow or fireball, don't ever use player's held item: this allows the shooter to swap between the items when the projectile is still in air and hasn't reached the target. Also, shooter inside on damage events never works. You can go around this by assigning a variable to an arrow and then checking if the arrow has one set when it damages the target.

Code:
on load:
    set {slowbow} to bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&8Slow&7ness &8| &fBow" with lore "&8&m-------------------------------------" and "&7Questo arco ti permette di &7givvare l'effetto" and "&7Slowness al player colpito permettendoti di" and "&7Combarlo oppure in alternativa scappare" and " " and "&cUltimate &8| &8(&4✯✯✯✯✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-------------------------------------"
    set {zombiebow} to bow of power 6, unbreaking 3, punch 2, flame 1, infinity 1 named "&2Zom&abie &8| &fBow" with lore "&8&m-----------------------------------" and "&7Questo arco ti permette di &7spawnare un" and "&7Baby Zombie&7 potenziato per colpire il" and "&7Nemico ed uscire dalla combo!" and " " and "&cUltimate &8| &8(&4✯✯✯✯&c✯&8)" and "&cTempo &8| &f1 minuto" and "&8&m-----------------------------------"

on shoot:
    if shooter's held item = {slowbow}:
        set {type::%uuid of projectile%} to "SlownessArrow"
    if shooter's held item = {zombiebow}:
        set {type::%uuid of projectile%} to "ZombieArrow"

on damage:
    projectile exists:
        type of event-projectile is arrow:
            if {type::%uuid of projectile%} = "SlownessArrow":
                delete {type::%uuid of projectile%}
                if victim is a player:
                    remove {slowbow} from attacker's inventory
                    apply slowness 1 to victim for 60 seconds
                    set {_t} to 1 minute
                    send action bar "&cSlowness &8| &f1 minuto" to attacker
                    wait 1 second
                    loop 59 times:
                        if {death::%attacker%} = true:
                            clear {death::%attacker%}
                            give {slowbow} to victim
                            stop
                        remove 1 second from {_t}
                        set {_tx} to "%{_t}%"
                        replace all " seconds" in {_tx} with " secondi"
                        if {_t} = 1 second:
                            replace all " secondi" in {_tx} with " secondo"
                        send action bar "&cSlowness &8| &f%{_tx}%" to attacker
                        wait 1 second
                    wait 1 second
                    send action bar "&4Kry&cptic&fSkills &8| &fArco restituito" to attacker
                    give {slowbow} to attacker
            if {type::%uuid of projectile%} = "ZombieArrow":
                delete {type::%uuid of projectile%}
                if victim is a player:
                    remove {zombiebow} from attacker's inventory
                    spawn a baby zombie
                    set display name of last spawned baby zombie to "&cCombo &8| &fZombie"
                    apply speed 2 to the spawned entity for 9999 minutes
                    set {_x} to uuid of last spawned entity parsed as entity
                    add {_x} to {arcopazzo::*}
                    set {_t} to 1 minute
                    send action bar "&cTempo &8| &f1 minuto" to attacker
                    wait 1 second
                    loop 59 times:
                        if {death::%attacker%} = true:
                            clear {death::%attacker%}
                            give {zombiebow} to victim
                            stop
                        remove 1 second from {_t}
                        set {_tx} to "%{_t}%"
                        replace all " seconds" in {_tx} with " secondi"
                        if {_t} = 1 second:
                            replace all " secondi" in {_tx} with " secondo"
                        send action bar "&cSlowness &8| &f%{_tx}%" to attacker
                        wait 1 second
                    wait 1 second
                    send action bar "&4Kry&cptic&fSkills &8| &fArco restituito" to attacker
                    give {zombiebow} to attacker

on death:
    if victim is a player:
        if attacker is a player:
            clear drops
            if victim has {slowbow}:
                broadcast "a"
                set {death::%victim%} to true
                remove {slowbow} from victim
                give {slowbow} to attacker
            if victim has {zombiebow}:
                set {death::%victim%} to true
                remove {zombiebow} from victim
                give {zombiebow} to attacker
    if {arcopazzo::*} contains victim:
        remove victim from {arcopazzo::*}

on command "/krypticskills help":
    cancel event
    send "&4Kry&cptic&fSkills &8| &7Usa /krypticskills give <player> <tipo>"
    send "&4Kry&cptic&fSkills &8| &7Tipo &eTeleportBow, SlownessBow, ZombieBow"
    send "&4Kry&cptic&fSkills &8| &7Powered by &bLethqls"

command /krypticskills give [<player>] [<text>]:
    permission: KrypticSkills.give
    permission message: &4Kry&cptic&fSkills &8| &7Non hai il permesso!
    trigger:
        if arg-2 is "ZombieBow":
            send "&4Kry&cptic&fSkills &8| &7Hai ricevuto uno ZombieBow"
            give {zombiebow} to player
            give an arrow to player
        if arg-2 is "SlownessBow":
            send "&4Kry&cptic&fSkills &8| &7Hai ricevuto uno SlownessBow"
            give {slowbow} to player
            give an arrow to player