Hello everyone I'm a Skript rookie. I've been trying to code a script when a player dies it drops half of his nether stars ( along with his other items ) and keeps the other half after respawning.
I have faced 2 errors and couldn't get any help from AI.
I appreciate any kind of help, Thanks.
I have faced 2 errors and couldn't get any help from AI.
Code:
on death of player:
set {_count} to number of nether star in victim's inventory # <-- Use SINGULAR "nether star"
if {_count} > 0:
# Calculate halves
set {_kept} to ({_count} + 1) div 2 # Rounded up for kept
set {_dropped} to {_count} - {_kept} # Rounded down for dropped
# Remove stars, drop half, keep half
clear nether star from victim's inventory # <-- Singular "nether star" here too
drop {_dropped} of nether star at victim's location
set {netherstar::%victim's uuid%} to {_kept}
on respawn:
if {netherstar::%player's uuid%} is set:
give {netherstar::%player's uuid%} of nether star to player
delete {netherstar::%player's uuid%}
I appreciate any kind of help, Thanks.