Aller au contenu
  • 0

Coffre après la mort


Question

Posté(e)

Version; 1.12.2

Version skript: v37c

Addons: SkQuery, SkRayFall, SKelett

Bonjour j'ai fait une fonction pour quand on meurt lors d'un abttle royal elle n'a pas d'erreur mais ne fonctionne pas il y'a bien le coffre a la mort mais quand on l'ouvre il n'y a pas le stuff du joueur.

function bg_death(p: player):
	metadata value "BG-DEATH" of {_p} is not set:
		set metadata value "BG-DEATH" of {_p} to "SET"	
		set {_uuid} to uuid of {_p}
		add 1 to {bg.stats.deaths::%{_uuid}%}
		metadata value "LAST-HIT" of {_p} is not set:
			set {_y} to "unknown"
		else:
			set {_y} to metadata value "LAST-HIT" of {_p}
			set {_uuid} to uuid of {_y}
			add 1 to {bg.stats.kills::%{_uuid}%}	
			set {_o-o} to {BG::CONFIG::COMMANDS.KILL}
			replace all "{player}" in {_o-o} with "%{_y}%"
			make console execute command "%{_o-o}%"
		set {_msg} to {BG::CONFIG::MESSAGES.KILL-MESSAGE}
		replace all "{victim}" in {_msg} with "%{_p}%"
		replace all "{killer}" in {_msg} with "%{_y}%"				
		send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}	
		add {_p} to {bg.arena.%{bg.player::%{_uuid}%.arena}%.bad-ninjas::*}
		send victim title "&e&l##%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}% &c&lFIN" with subtitle "&eVANOZIA ROYALE" for 5 seconds with 0 second fade in and 0 second fade out 
		send {_p} title "&e&l##%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}% &c&lFIN" with subtitle "&eVANOZIA ROYALE" for 5 seconds with 0 second fade in and 0 second fade out 
		bg_remove({_p}, {bg.player::%{_uuid}%.arena})
		set {_p}'s gamemode to spectator
		set {_helmet} to {_p}'s helmet		
		set {_chestplate} to {_p}'s chestplate
		set {_leggings} to {_p}'s leggings
		send {_p} title "&e&l##%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}% &c&lFIN" with subtitle "&eVANOZIA ROYALE" for 5 seconds with 0 second fade in and 0 second fade out 
		set {_boots} to {_p}'s boots	
		loop blocks in radius 1 of {_p}:
			loop-block is air
			set loop-block to chest
			set {bg.arena.%{bg.player::%{_uuid}%.arena}%.CHESTS::%location of loop-block%} to location of loop-block
			add {_helmet}, {_chestplate}, {_leggings} and {_boots} to loop-block
			loop items in {_p}'s inventory:
				add loop-item to loop-block
			add 1 golden apple to loop-block
			add location of loop-block to {bg.arena.%{bg.player::%{_uuid}%.arena}%.KILL-ME-PLS::*}
			set {_block} to true
			stop	
		loop items in {_p}'s inventory:
			drop loop-item at {_p}

Sa fonctionne juste le coffre qui est vide et qui ne fonctionne pas.

4 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Salut ! 

C'est pas forcément le plus "optimisé" mais ça devrait fonctionner 
-Ton sujet n'étant pas "Résolu" je considères encore ouvert-

 

loop all items in victim's inventory:
                add loop-item to {_inventory.%victim%::*}

Ensuite il te suffit d'ajouter {_inventory.%{_p}%::*} [Dans ton cas] à l'inventaire du bloc :

 

add {_inventory.%player%::*} to inventory of block at {_giftblock}

Ce qui implique de définir la position du coffre comme étant une variable [Attention, la position du coffre, si tu la considères comme étant la position du joueur n'est pas sur une coordonnée entière ! [Il le site à 0.5 du bloc, donc la moitié, l'inventaire ne peut alors pas être ajouté !]

Je me permets de te donner un exemple de ce que j'ai fais il y a peu, pour l'adapter à ton skript |Ayant du mal à comprendre la totalité de tes lignes|

 

on death:
	if victim is in world "HC":
		victim is a player:
			loop all items in victim's inventory:
				add loop-item to {_inventory.%victim%::*}
			clear drops
			wait 1.4 second
			broadcast "&e##&6HardCore&e## &6%player% &fa trouvé la rédemption..."
			set {_loc} to location of victim
			set {_xcoo} to x-coordinate of block above block at {_loc}
			set {_ycoo} to y-coordinate of block above block at {_loc}
			set {_zcoo} to z-coordinate of block above block at  {_loc}
			add 0.5 to {_xcoo}
			add 0.5 to {_ycoo}
			add 0.5 to {_zcoo}
			make player run command "/setblock %{_xcoo}% %{_ycoo}% %{_zcoo}% minecraft:player_head{ExtraType:""%victim%"",SkullType:3}" as op
			remove 1 from {_ycoo}
			set block at location at {_xcoo}, {_ycoo}, {_zcoo} in world "HC" to chest
			set {_giftblock} to block at location at {_xcoo}, {_ycoo}, {_zcoo} in world "HC"
			add {_inventory.%player%::*} to inventory of block at {_giftblock}

Le setblock est le positionnement de la tête du joueur

Invité
Ce sujet ne peut plus recevoir de nouvelles réponses.
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.