Resetting variables?

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

Warpedtimes

New Member
Feb 12, 2021
4
0
1
23
So I wanted players to reciver souls when they kill someone. I implemented this to give them the soul (uses essentials to make the item) and it works but when they jumped into the void or were hit the players wouldn't receive a soul. So I used the loop someone else made but now if someone jumps or falls into the void without being hit again they will still die to the damager and the damager will still get the soul. Is there anyway to reset who the damager and victim are to not do this?

Code:
on death:
    if damage cause is not void:
        victim is a player
        damager is a player
        execute console command "give %damager% ghast_tear 1 name:&4Soul lore:&cA_human_soul"
        send "&aYou killed &4%victim%" to damager
        send "&e&l<&c&l!&e&l>&b You have gained a Soul" to damager
        send "&aYou were killed by &4%damager%" to victim

every 1 second:
    loop all players:
        if loop-player's y coordinate is below 1:
            set loop-player's health to -1
 
Code:
every 1 second:
    loop all players:
        if loop-player's y coordinate is below 1:
            set loop-player's health to -1

Nonononoonno .... nononononoono... ^this line is why everyone remotely skilled in java things skript is garbage. This will kill your servers TPS in no time.

I really don't understand what you are trying to do. Should people get souls when dying from the void or not?

Code:
execute console command "give %damager% ghast_tear 1 name:&4Soul lore:&cA_human_soul"

^here I'd also just use the vanilla skript give function:

Code:
give 1 of ghast tear named "&4Soul" with lore "&cA human soul" and "newlineinlore" and "newline2"

Please elaborate, since I'm certain your issue is easily fixed, but is hard to understand from you description :emoji_slight_smile:
 
Thanks for replying. What I want is for players to get give when they are hit into the void by another player. The loop was for instantly killing players who fell into the void so they wouldnt take ages to die. Im running a sky mining server so its common to be hit into the void or fall. With the loop implemented players would receive souls from killing someone but they would still continue to receive the souls and kill credit whenever someone jumped into the void again.

Basically I just wanted players to instantly die when falling into the void and to have a system where players receive souls on kill.