If a player dies from hands of another player(for example the sword was the last hit), the chest spawns in the place they died with 50% of items the victim had. But when the player gets killed via skript, the chest doesnt spawn. Could you help me? Skript:
code_language.skript:
on join:
set {combat.%player%} to false
on damage:
if {combat.%victim%} is false:
attacker is player
if victim isn't wearing armor:
cancel event
stop
if {combat.%victim%} is false:
attacker is player
if attacker isn't wearing armor:
cancel event
stop
attacker is player
victim is player
set {combat.attacker.%{_p}%} to "%attacker%"
set {combat.victim.%{_p}%} to "%victim%"
combat(victim)
combat(attacker)
function combat(p: player):
if {combat.%{_p}%} is false:
set {combat.%{_p}%} to true
set {combat.cooldown.%{_p}%} to 16
while {combat.cooldown.%{_p}%} is not 0:
remove 1 from {combat.cooldown.%{_p}%}
send actionbar "&4&lIn combat &6for &4&l%{combat.cooldown.%{_p}%}% &6seconds. Don't log out." to {_p}
if {combat.cooldown.%{_p}%} is 0:
set {combat.%{_p}%} to false
send actionbar "&6You are no longer in &4&lcombat&6. You can &4&llog out &6now." to {_p}
delete {combat.attacker.%{_p}%}
delete {combat.victim.%{_p}%}
wait 1 second
else:
set {combat.cooldown.%{_p}%} to 16
command /ct:
permission: sc.clearCombatLog
trigger:
set {combat.cooldown.%player%} to 0
set {combat.%player%} to false
on quit:
if {combat.%player%} is true:
kill player
set {combat.%player%} to false
set {combat.cooldown.%player%} to 0
on death:
if victim's world is "World1":
set {_loc} to victim's location
set block at location at {_loc} to chest
loop all items in victim's inventory:
chance of 50%:
add loop-item to {_items::*}
loop all blocks in radius 2 around victim:
if loop-block is chest:
loop {_items::*}:
add loop-value-2 to loop-block's inventory
remove loop-value-2 from {_items::*}
remove loop-value-2 from victim's inventory
wait 30 seconds
set block at location at {_loc} to air
on death:
if {combat.%victim%} is true:
send actionbar "&6You are no longer in &4&lcombat&6. You can &4&llog out &6now." to attacker and victim
set death message to "%victim% got &4&lkilled &fby %attacker%"
set {combat.%victim%} to false
set {combat.cooldown.%victim%} to 0
on command:
if {combat.%player%} is true:
if command isn't "ct":
send actionbar "&4&lYou are not allowed to use commands during combat!"
cancel event
on step on lime carpet:
if {combat.%player%} is false:
push player north at speed 3
push player up at speed 2
on damage:
if damage was caused by void:
if {combat.%victim%} is true:
if {combat.attacker.%{_p}%} isn't victim:
teleport victim to location of ({combat.attacker.%{_p}%} parsed as a player)
wait 1 ticks
kill victim
else:
teleport victim to location of ({combat.victim.%{_p}%} parsed as a player)
wait 1 ticks
kill victim
else if {combat.%victim%} is false:
set {_p} to victim's world
teleport victim to location(-37.5, 28, -91.5, {_p}, 0, 0)
cancel event
Last edited: