Aller au contenu
KacilioE

[Survie]Coffre qui spawn aléatoirement dans une zone choisi

Messages recommandés

Posté(e) (modifié)

Bonjour, aujourd'hui je vous appel à l'aide pour la création d'un skript je pense réalisable 🙂

Version de Minecraft : 1.11.2

Version de Skript : 2.3.6

Type du Skript : Coffre aléatoire

Je vais commencer par vous mettre dans le contexte de réalisation de ce skript :

Nous sommes sur un serveur survie, nous voudrions rajouté des éléments qui permettront de rajouter plus de "fun", nous avons donc pensé qu'un coffre qui spawnerai dans une zone choisi au préalable par nos soins avec un contenu aussi choisi par nos soins serait une bonne idée ! Je voudrais donc que ce skript fasse ceci :

  • Un coffre qui spawn aléatoirement dans une zone choisi ( Par World Edit ou autre à vous de voir comment choisir cette zone)
  • Ce coffre doit spawn au sol et non pas en l'air ou sous terre
  • Il doit spawn tout les "x" temps si et seulement si plus de 2 joueurs sont connecté
  • Son contenu doit pouvoir être choisi par nos soins (Par une commande ou directement changeable dans le skript)
  • Un message doit annoncer les coordonnées du coffre*
  • Une commande pour pouvoir faire spawner de force le coffre (/coffre ou autre avec une permission de préférence, execute.command.coffre ou autre)
  • Si c'est aussi possible j'aimerai que tout les joueurs soit tp a 300 blocks autour du coffre 😃

Voila je crois n'avoir rien oublié je vous remercie d'avoir lu et remercie d'avance à la personne qui voudra bien crée ce skript pour moi ! 😃

Modifié par KacilioE

Partager ce message


Lien à poster
Partager sur d’autres sites
options:
	monde: world
	message_sans_permission: Tu n'a pas la permission !
	All: 49
	Common: 35
	Rare: 10
	Rare+: 5
	Rare++: 1
	rayon: 10
	timing: 20
		
command /coffrealéatoire <string>:
	trigger:
		if arg-1 is "baton":
			if player is op:
				give 1 stick named "&4&lBaton de zone" to player
		if arg-1 is "coffre":	
			if player is op:
				set {_r} to 1
				while {_r} = 1:
					set {_randomx} to a random integer between {xpost1} and {xpost2}
					set {_randomz} to a random integer between {zpost1} and {zpost2}
					set {_y} to 40
					while {_y} is not 100:
						if block at location ({_randomx}, {_y}, {_randomz}) is air or tall grass:
							if block under block at location ({_randomx}, {_y}, {_randomz}) is not air or water or lava or trapped chest:
								if block above block at location ({_randomx}, {_y}, {_randomz}) is air:
									set {_reely} to {_y}
									set {_y} to 99
									set {_r} to 0
						add 1 to {_y}
				set block at location ({_randomx}, {_reely}, {_randomz}) to chest
				add {_randomx} to {xchest::*}
				add {_randomz} to {zchest::*}
				wait 1 tick
				delete {chance::*}
				delete {chance.All::*}
				delete {chance.Common::*}
				delete {chance.Rare::*}
				delete {chance.Rare+::*}
				delete {chance.Rare++::*}
				loop {@All} times:
					add "All" to {chance::*}
				loop {@Common} times:
					add "Common" to {chance::*}
				loop  {@Rare} times:
					add "Rare" to {chance::*}
				loop  {@Rare+} times:
					add "Rare+" to {chance::*}
				loop  {@Rare++} times:
					add "Rare++" to {chance::*}
				add "32 stone:&8Ultra Commun" to {chance.All::*}
				add "32 dirt:&8Ultra Commun" to {chance.All::*}
				add "leather chestplate:&aCommun" to {chance.Common::*}
				add "stone sword:&aCommun" to {chance.Common::*}
				add "iron sword:&bRare" to {chance.Rare::*}
				add "golden chestplate:&bRare" to {chance.Rare::*}
				add "diamond sword of sharpness 2:&5Rare+" to {chance.Rare+::*}
				add "iron chestplate:&5Rare+" to {chance.Rare+::*}
				add "diamond chestplate of protection 2:&6Rare++" to {chance.Rare++::*} 
				delete {slot::*}
				set {n} to 0
				loop 26 times:
					add {n} to {slot::*}
					add 1 to {n}
				set {l} to a random integer between 1 and 6
				loop {l} times:
					set {c} to a random element of {chance::*}
					set {i} to a random element of {chance.%{c}%::*}
					set {_bp::*} to {i} split at ":"
					set {_b} to {_bp::1}
					set {_b} to {_b} parsed as item type
					set {_p} to {_bp::2}
					set {n} to a random element of {slot::*}
					remove {n} from {slot::*}
					set slot {n} of inventory of block at location ({_randomx}, {_reely}, {_randomz}) to {_b} named "%{_p}%"
				broadcast "creation du coffre en x : %{_randomx}% y : %{_reely}% z : %{_randomz}% "
				loop all players:
					if gamemode of loop-player is survival:
						if distance between loop-player's location and location ({_randomx}, {_reely}, {_randomz}) > 10:
							message "-----------------------------------------------------" to loop-player
							message "&6un coffre est apparu &7x : %{_randomx}% y : %{_reely}% z : %{_randomz}%" to loop-player
							message "<tooltip:Téléportation à {@rayon} blocks du coffre><command:/coffrealéatoire tp>&2[Se téléporter]<reset>" to loop-player
							message "-----------------------------------------------------" to loop-player
		if arg-1 is "tp":
			set {_n} to size of {xchest::*}
			set {_randomx} to {xchest::%{_n}%}
			set {_randomz} to {zchest::%{_n}%}
			broadcast "%{_randomx}% %{_randomz}%"
			set {_rc} to {@rayon} * {@rayon}
			broadcast "r = %{_rc}%"
			set {_sqrtrc} to sqrt of {_rc}
			broadcast "r root = %{_sqrtrc}%"
			set {_x} to a random number between {_randomx} - {_sqrtrc} and {_randomx} + {_sqrtrc}
			set {_zc} to {_x} * {_x} - 2 * {_randomx} * {_x} + {_randomx} * {_randomx}
			set {_rc} to {@rayon} * {@rayon}
			set {_z} to {_rc} - {_zc}
			broadcast "%{_z}%"
			set {_z} to sqrt of {_z}
			set {_opp} to a random integer between 0 and 1
			if {_opp} = 0:
				set {_z} to {_randomz} + {_z}
			if {_opp} = 1:
				set {_z} to {_randomz} - {_z}
			set {%player%.nodamagechute} to 1
			teleport player at location ({_x}, 100, {_z})
		if arg-1 is "on":
			set {auto} to 1
		if arg-1 is "off":
			set {auto} to 0
		if arg-1 is "reset":
			delete {xchest::*}
			delete {zchest::*}
	
on damage:
	if {%victim%.nodamagechute} = 1:
		if damage cause is fall:
			cancel event
			set {%victim%.nodamagechute} to 0
			
every {@timing} seconds:
	set {_r} to 1
	if 1 = {auto}:
		if 3 = 3:
			if 2 = 2: 
				while {_r} = 1:
					set {_randomx} to a random integer between {xpost1} and {xpost2}
					set {_randomz} to a random integer between {zpost1} and {zpost2}
					set {_y} to 40
					while {_y} is not 100:
						if block at location ({_randomx}, {_y}, {_randomz}) in world "{@monde}" is air or tall grass:
							if block under block at location ({_randomx}, {_y}, {_randomz}) in world "{@monde}" is not air or water or lava or chest or trapped chest:
								if block above block at location ({_randomx}, {_y}, {_randomz}) in world "{@monde}" is air:
									set {_reely} to {_y}
									set {_y} to 99
									set {_r} to 0
						add 1 to {_y}
				set block at location ({_randomx}, {_reely}, {_randomz}) in world "{@monde}" to chest
				add {_randomx} to {xchest::*}
				add {_randomz} to {zchest::*}
				wait 1 tick
				delete {chance::*}
				delete {chance.All::*}
				delete {chance.Common::*}
				delete {chance.Rare::*}
				delete {chance.Rare+::*}
				delete {chance.Rare++::*}
				loop {@All} times:
					add "All" to {chance::*}
				loop {@Common} times:
					add "Common" to {chance::*}
				loop  {@Rare} times:
					add "Rare" to {chance::*}
				loop  {@Rare+} times:
					add "Rare+" to {chance::*}
				loop  {@Rare++} times:
					add "Rare++" to {chance::*}
				add "32 stone:&8Ultra Commun" to {chance.All::*}
				add "32 dirt:&8Ultra Commun" to {chance.All::*}
				add "leather chestplate:&aCommun" to {chance.Common::*}
				add "stone sword:&aCommun" to {chance.Common::*}
				add "iron sword:&bRare" to {chance.Rare::*}
				add "golden chestplate:&bRare" to {chance.Rare::*}
				add "diamond sword of sharpness 2:&5Rare+" to {chance.Rare+::*}
				add "iron chestplate:&5Rare+" to {chance.Rare+::*}
				add "diamond chestplate of protection 2:&6Rare++" to {chance.Rare++::*} 
				delete {slot::*}
				set {n} to 0
				loop 26 times:
					add {n} to {slot::*}
					add 1 to {n}
				set {l} to a random integer between 1 and 6
				loop {l} times:
					set {c} to a random element of {chance::*}
					set {i} to a random element of {chance.%{c}%::*}
					set {_bp::*} to {i} split at ":"
					set {_b} to {_bp::1}
					set {_b} to {_b} parsed as item type
					set {_p} to {_bp::2}
					set {n} to a random element of {slot::*}
					remove {n} from {slot::*}
					set slot {n} of inventory of block at location ({_randomx}, {_reely}, {_randomz}) in world "{@monde}" to {_b} named "%{_p}%"
				loop all players:
					if gamemode of loop-player is survival:
						if distance between loop-player's location and location ({_randomx}, {_reely}, {_randomz}) in world "{@monde}" > 10:
							message "-----------------------------------------------------" to loop-player
							message "&6un coffre est apparu &7x : %{_randomx}% y : %{_reely}% z : %{_randomz}%" to loop-player
							message "<tooltip:Téléportation à {@rayon} blocks du coffre><command:/coffrealéatoire tp>&2[Se téléporter]<reset>" to loop-player
							message "-----------------------------------------------------" to loop-player
	
								
				
on break:
	if gamemode of player is creative:
		if player's tool is a stick named "&4&lBaton de zone":
			cancel event
			set {zpost1} to z-coordinate of location of block
			set {xpost1} to x-coordinate of location of block
			broadcast "Les coordonée ont bien été prise en compte"
			
on rightclick:
	if clicked block is set:
		if gamemode of player is creative:
			if player's tool is a stick named "&4&lBaton de zone":
				set {zpost2} to z-coordinate of location of block
				set {xpost2} to x-coordinate of location of block
				broadcast "Les coordonée ont bien été prise en compte"
		

 

  • Merci 1

Partager ce message


Lien à poster
Partager sur d’autres sites
Le 19/05/2019 à 16:00, geforce a dit :
options:
	monde: world
	message_sans_permission: Tu n'a pas la permission !
	All: 49
	Common: 35
	Rare: 10
	Rare+: 5
	Rare++: 1
	rayon: 10
	timing: 20
		
command /coffrealéatoire <string>:
	trigger:
		if arg-1 is "baton":
			if player is op:
				give 1 stick named "&4&lBaton de zone" to player
		if arg-1 is "coffre":	
			if player is op:
				set {_r} to 1
				while {_r} = 1:
					set {_randomx} to a random integer between {xpost1} and {xpost2}
					set {_randomz} to a random integer between {zpost1} and {zpost2}
					set {_y} to 40
					while {_y} is not 100:
						if block at location ({_randomx}, {_y}, {_randomz}) is air or tall grass:
							if block under block at location ({_randomx}, {_y}, {_randomz}) is not air or water or lava or trapped chest:
								if block above block at location ({_randomx}, {_y}, {_randomz}) is air:
									set {_reely} to {_y}
									set {_y} to 99
									set {_r} to 0
						add 1 to {_y}
				set block at location ({_randomx}, {_reely}, {_randomz}) to chest
				add {_randomx} to {xchest::*}
				add {_randomz} to {zchest::*}
				wait 1 tick
				delete {chance::*}
				delete {chance.All::*}
				delete {chance.Common::*}
				delete {chance.Rare::*}
				delete {chance.Rare+::*}
				delete {chance.Rare++::*}
				loop {@All} times:
					add "All" to {chance::*}
				loop {@Common} times:
					add "Common" to {chance::*}
				loop  {@Rare} times:
					add "Rare" to {chance::*}
				loop  {@Rare+} times:
					add "Rare+" to {chance::*}
				loop  {@Rare++} times:
					add "Rare++" to {chance::*}
				add "32 stone:&8Ultra Commun" to {chance.All::*}
				add "32 dirt:&8Ultra Commun" to {chance.All::*}
				add "leather chestplate:&aCommun" to {chance.Common::*}
				add "stone sword:&aCommun" to {chance.Common::*}
				add "iron sword:&bRare" to {chance.Rare::*}
				add "golden chestplate:&bRare" to {chance.Rare::*}
				add "diamond sword of sharpness 2:&5Rare+" to {chance.Rare+::*}
				add "iron chestplate:&5Rare+" to {chance.Rare+::*}
				add "diamond chestplate of protection 2:&6Rare++" to {chance.Rare++::*} 
				delete {slot::*}
				set {n} to 0
				loop 26 times:
					add {n} to {slot::*}
					add 1 to {n}
				set {l} to a random integer between 1 and 6
				loop {l} times:
					set {c} to a random element of {chance::*}
					set {i} to a random element of {chance.%{c}%::*}
					set {_bp::*} to {i} split at ":"
					set {_b} to {_bp::1}
					set {_b} to {_b} parsed as item type
					set {_p} to {_bp::2}
					set {n} to a random element of {slot::*}
					remove {n} from {slot::*}
					set slot {n} of inventory of block at location ({_randomx}, {_reely}, {_randomz}) to {_b} named "%{_p}%"
				broadcast "creation du coffre en x : %{_randomx}% y : %{_reely}% z : %{_randomz}% "
				loop all players:
					if gamemode of loop-player is survival:
						if distance between loop-player's location and location ({_randomx}, {_reely}, {_randomz}) > 10:
							message "-----------------------------------------------------" to loop-player
							message "&6un coffre est apparu &7x : %{_randomx}% y : %{_reely}% z : %{_randomz}%" to loop-player
							message "<tooltip:Téléportation à {@rayon} blocks du coffre><command:/coffrealéatoire tp>&2[Se téléporter]<reset>" to loop-player
							message "-----------------------------------------------------" to loop-player
		if arg-1 is "tp":
			set {_n} to size of {xchest::*}
			set {_randomx} to {xchest::%{_n}%}
			set {_randomz} to {zchest::%{_n}%}
			broadcast "%{_randomx}% %{_randomz}%"
			set {_rc} to {@rayon} * {@rayon}
			broadcast "r = %{_rc}%"
			set {_sqrtrc} to sqrt of {_rc}
			broadcast "r root = %{_sqrtrc}%"
			set {_x} to a random number between {_randomx} - {_sqrtrc} and {_randomx} + {_sqrtrc}
			set {_zc} to {_x} * {_x} - 2 * {_randomx} * {_x} + {_randomx} * {_randomx}
			set {_rc} to {@rayon} * {@rayon}
			set {_z} to {_rc} - {_zc}
			broadcast "%{_z}%"
			set {_z} to sqrt of {_z}
			set {_opp} to a random integer between 0 and 1
			if {_opp} = 0:
				set {_z} to {_randomz} + {_z}
			if {_opp} = 1:
				set {_z} to {_randomz} - {_z}
			set {%player%.nodamagechute} to 1
			teleport player at location ({_x}, 100, {_z})
		if arg-1 is "on":
			set {auto} to 1
		if arg-1 is "off":
			set {auto} to 0
		if arg-1 is "reset":
			delete {xchest::*}
			delete {zchest::*}
	
on damage:
	if {%victim%.nodamagechute} = 1:
		if damage cause is fall:
			cancel event
			set {%victim%.nodamagechute} to 0
			
every {@timing} seconds:
	set {_r} to 1
	if 1 = {auto}:
		if 3 = 3:
			if 2 = 2: 
				while {_r} = 1:
					set {_randomx} to a random integer between {xpost1} and {xpost2}
					set {_randomz} to a random integer between {zpost1} and {zpost2}
					set {_y} to 40
					while {_y} is not 100:
						if block at location ({_randomx}, {_y}, {_randomz}) in world "{@monde}" is air or tall grass:
							if block under block at location ({_randomx}, {_y}, {_randomz}) in world "{@monde}" is not air or water or lava or chest or trapped chest:
								if block above block at location ({_randomx}, {_y}, {_randomz}) in world "{@monde}" is air:
									set {_reely} to {_y}
									set {_y} to 99
									set {_r} to 0
						add 1 to {_y}
				set block at location ({_randomx}, {_reely}, {_randomz}) in world "{@monde}" to chest
				add {_randomx} to {xchest::*}
				add {_randomz} to {zchest::*}
				wait 1 tick
				delete {chance::*}
				delete {chance.All::*}
				delete {chance.Common::*}
				delete {chance.Rare::*}
				delete {chance.Rare+::*}
				delete {chance.Rare++::*}
				loop {@All} times:
					add "All" to {chance::*}
				loop {@Common} times:
					add "Common" to {chance::*}
				loop  {@Rare} times:
					add "Rare" to {chance::*}
				loop  {@Rare+} times:
					add "Rare+" to {chance::*}
				loop  {@Rare++} times:
					add "Rare++" to {chance::*}
				add "32 stone:&8Ultra Commun" to {chance.All::*}
				add "32 dirt:&8Ultra Commun" to {chance.All::*}
				add "leather chestplate:&aCommun" to {chance.Common::*}
				add "stone sword:&aCommun" to {chance.Common::*}
				add "iron sword:&bRare" to {chance.Rare::*}
				add "golden chestplate:&bRare" to {chance.Rare::*}
				add "diamond sword of sharpness 2:&5Rare+" to {chance.Rare+::*}
				add "iron chestplate:&5Rare+" to {chance.Rare+::*}
				add "diamond chestplate of protection 2:&6Rare++" to {chance.Rare++::*} 
				delete {slot::*}
				set {n} to 0
				loop 26 times:
					add {n} to {slot::*}
					add 1 to {n}
				set {l} to a random integer between 1 and 6
				loop {l} times:
					set {c} to a random element of {chance::*}
					set {i} to a random element of {chance.%{c}%::*}
					set {_bp::*} to {i} split at ":"
					set {_b} to {_bp::1}
					set {_b} to {_b} parsed as item type
					set {_p} to {_bp::2}
					set {n} to a random element of {slot::*}
					remove {n} from {slot::*}
					set slot {n} of inventory of block at location ({_randomx}, {_reely}, {_randomz}) in world "{@monde}" to {_b} named "%{_p}%"
				loop all players:
					if gamemode of loop-player is survival:
						if distance between loop-player's location and location ({_randomx}, {_reely}, {_randomz}) in world "{@monde}" > 10:
							message "-----------------------------------------------------" to loop-player
							message "&6un coffre est apparu &7x : %{_randomx}% y : %{_reely}% z : %{_randomz}%" to loop-player
							message "<tooltip:Téléportation à {@rayon} blocks du coffre><command:/coffrealéatoire tp>&2[Se téléporter]<reset>" to loop-player
							message "-----------------------------------------------------" to loop-player
	
								
				
on break:
	if gamemode of player is creative:
		if player's tool is a stick named "&4&lBaton de zone":
			cancel event
			set {zpost1} to z-coordinate of location of block
			set {xpost1} to x-coordinate of location of block
			broadcast "Les coordonée ont bien été prise en compte"
			
on rightclick:
	if clicked block is set:
		if gamemode of player is creative:
			if player's tool is a stick named "&4&lBaton de zone":
				set {zpost2} to z-coordinate of location of block
				set {xpost2} to x-coordinate of location of block
				broadcast "Les coordonée ont bien été prise en compte"
		

 

Voila alors après test j'ai rencontrer 3 erreurs les voici

EWZFRK7.png

Si quelqu'un pourrait me les corriger ça serait vraiment cool, je vois pas trop à quoi elles sont dues ^^ 😃

Partager ce message


Lien à poster
Partager sur d’autres sites

il te faut l'addon skquery car la fonction racine carrée n'existe pas sur le skript de base.

Modifié par geforce

Partager ce message


Lien à poster
Partager sur d’autres sites
il y a 11 minutes, geforce a dit :

il te faut l'addon skquery car la fonction racine carrée n'existe pas sur le skript de base.

D'ac merci et la troisième c'étais juste les espaces tout en bas du skript x) Merci bcp !

Partager ce message


Lien à poster
Partager sur d’autres sites

Bonjour,

Merci de mettre le topic en "Résolu" si tu n'as pas d'autres problèmes.

Cordialement,

Partager ce message


Lien à poster
Partager sur d’autres sites

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant

×

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.