Soulbound no drop on death! Help!

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

Lukkeeh

Member
Jun 24, 2017
11
0
1
on death of a player:
loop drops:
if lore of loop-item contains "&cSoulbound":
remove loop-item from drops

on respawn:
???


So i want to make that if an item got soulbound it wont drop and u will get it back on respawn. but i can only make it so it wont drop. i cant make it so i get it back on respawn. anyone that can help me ?
 
Code:
else:
    stop
I really wish you guys would stop abusing "stop" and learn how to correctly use it, you can literally remove the "else" and "stop" since they do LITERALLY nothing.
on death of a player:
loop drops:
if lore of loop-item contains "&cSoulbound":
remove loop-item from drops

on respawn:
???


So i want to make that if an item got soulbound it wont drop and u will get it back on respawn. but i can only make it so it wont drop. i cant make it so i get it back on respawn. anyone that can help me ?
the best way to do it, is add the item to a list variable specific to the player, and when they respawn, give the item back to the player like so:
(I have tested this, and it works
code_language.skript:
on death of player:
    loop drops:
        if lore of loop-item contains "&cSoulbound":
            add loop-item to {soulbound::%uuid of player%::*}
            remove loop-item from drops
 
on respawn:
    loop {soulbound::%uuid of player%::*}:
        give loop-value to player
    delete {soulbound::%uuid of player%::*}
 
I will never stop using stop, since I pretty much have been taught to always return even on a void function (Even if the teacher was wrong or not it works)

Correct me if I'm wrong but the stop is the same as return in Skript I believe
Yes its basically the same thing. But in Skript it just looks god awful.
Also, in Java you dont return a void if theres no need, so the same thing for Skript, no need to return or "stop" your code from doing nothing

Ex: in java

Java:
private void removePlayersTool(Player player) {
    if (player.getInventory().getItemInMainHand() != null) {
        player.getInventory().setItemInMainHand(null);
    }
}
in this example, I wouldnt return in an else statement, its just pointless since Java basically takes care of that for you.

Its the same in Skript, you dont need to return/stop "nothing" from happening
 
I will never stop using stop, since I pretty much have been taught to always return even on a void function (Even if the teacher was wrong or not it works)

Correct me if I'm wrong but the stop is the same as return in Skript I believe
If you think you should always return in Skript, then you shouldn't have put the stop effect in the the else section, because if the condition is true, it wouldn't return (the else section wouldn't be ran). If you should always return in Skript, you should've also added the stop in the first trigger, but ya didn't. And as Shane said, you don't have to (and shouldn't) do it in Skript, since it's completely useless.
 
  • Like
Reactions: Deleted member 5254
Ok that's pretty cute text and all but "and shouldn't" and "it's completely useless" don't seem to mix
If something is useless, you shouldn't do it. Is that not clear?
 
Code:
on death of player:
    loop drops:
        if lore of loop-item contains "&cSoulbound":
        remove loop-item from drops
        set {SOULBOUND::%player%} to true

on respawn:
    if {SOULBOUND::%player%} is true:
        give whatever-item named "Soulbound" to player
        set {SOULBOUND::%player%} to false
    else:
        stop
Thanks!
 
Status
Not open for further replies.