I was working on an event and i tried making a supply drop.
i wanted it to set a random slot in the chest to something i want but the chest is always empty and it doesnt say anything like that there isnt a chest that loaded or that it finished thanks heres my function :
Im on 1.21.10 Paper
I have skript 2.13.2
and these are my addons for skript :
skript-simple-voice-chat = 1.0.3
skRayFall = 1.9.28
skNoise = 1.0
SkBee = 3.13.2
skript-logs = 0.1.3
SkJson = 5.4.1
Skent = 3.4.0
SkQuery = 4.3.2
i wanted it to set a random slot in the chest to something i want but the chest is always empty and it doesnt say anything like that there isnt a chest that loaded or that it finished thanks heres my function :
code_language.skript:
function EventSpawnLootDrop(x: number, z: number):
send "&c[Function : ""SpawnLootDrop""] &2: Spawning Supply Drop!" to {Event.Owner}
send "&c[Function : ""SpawnLootDrop""] &2: %{_x}% %{_z}%" to {Event.Owner}
set {_chunkloc} to location({_x}, 64, {_z}, world "Event")
load chunk at {_chunkloc}
wait 0.1 seconds
set {_loc} to location({_x}, 255, {_z}, world "Event")
set {_topLoc} to highest block at {_loc}
set {_chestLoc} to block above {_topLoc}
set block at {_chestLoc} to chest
wait 10 ticks
set {_inv} to inventory of block at {_chestLoc}
if {_inv} is not set:
send "&c[Function : ""SpawnLootDrop""] &2: Couldnt Spawn Loot Drop : Loot drop's inventory varible has been deleted or null!" to {Event.Owner}
stop
clear {_inv}
set {_r} to random integer between 3 and 6
loop {_r} times:
wait 1 ticks
if {_inv} is not set:
stop
chance of 20%:
set {_slot} to random integer between 0 and 26
while slot {_slot} of {_inv} is not air:
wait 2 ticks
set {_slot} to random integer between 0 and 26
set {_amt} to random integer between 1 and 5
EventAbilitySlot({_slot}, {_amt}, {_inv})
wait 3 tick
chance of 100%:
set {_slot} to random integer between 0 and 26
while slot {_slot} of {_inv} is not air:
wait 2 ticks
set {_slot} to random integer between 0 and 26
set {_amt} to random integer between 1 and 5
set slot {_slot} of {_inv} to {_amt} of iron ingot
wait 3 tick
chance of 20%:
set {_slot} to random integer between 0 and 26
while slot {_slot} of {_inv} is not air:
wait 2 ticks
set {_slot} to random integer between 0 and 26
set {_amt} to random integer between 5 and 20
set slot {_slot} of {_inv} to {_amt} of cooked beef
wait 3 tick
chance of 10%:
set {_slot} to random integer between 0 and 26
while slot {_slot} of {_inv} is not air:
wait 3 ticks
set {_slot} to random integer between 0 and 26
set {_amt} to random integer between 1 and 5
set slot {_slot} of {_inv} to {_amt} of golden apple
wait 5 tick
send "&c[Function : ""SpawnLootDrop""] &2: Spawned Loot Drop!" to {Event.Owner}
wait 0.2 seconds
EventChat("&2Supply drop at : %{_x}% %y-coordinate of {_chestLoc}% %{_z}%")
Im on 1.21.10 Paper
I have skript 2.13.2
and these are my addons for skript :
skript-simple-voice-chat = 1.0.3
skRayFall = 1.9.28
skNoise = 1.0
SkBee = 3.13.2
skript-logs = 0.1.3
SkJson = 5.4.1
Skent = 3.4.0
SkQuery = 4.3.2