Aller au contenu

Chest refill avec un loop


Messages recommandés

Posté(e)

Le code de base :

on load:
   delete {random.item.list::*}
   add 2 diamond to {random.item.list::*}
   add 2 iron ingot to {random.item.list::*}
   add 2 leather to {random.item.list::*}
   add 2 tnt to {random.item.list::*}
   add 1 flint and steel to {random.item.list::*}
   add 1 golden apple to {random.item.list::*}
   add 4 cooked beef to {random.item.list::*}
   add 32 stone to {random.item.list::*}
   add 32 cobblestone to {random.item.list::*}
   add 4 cooked porkchop to {random.item.list::*}
   add 32 planks to {random.item.list::*}
   add 2 apple to {random.item.list::*}
   add 1 stone sword to {random.item.list::*}
   add 1 stone pickaxe to {random.item.list::*}
   add 1 stone axe to {random.item.list::*}
   add 1 leather leggings to {random.item.list::*}
   add 1 leather boots to {random.item.list::*}
   add 1 leather chestplate to {random.item.list::*}
   add 1 leather helmet to {random.item.list::*}
   add 4 snowball to {random.item.list::*}
   add 4 arrow to {random.item.list::*}
   add 1 bow to {random.item.list::*}
   add 1 iron sword to {random.item.list::*}
   add 1 iron pickaxe to {random.item.list::*}
   add 1 iron axe to {random.item.list::*}
   add 1 iron leggings to {random.item.list::*}
   add 1 iron boots to {random.item.list::*}
   add 1 iron chestplate to {random.item.list::*}
   add 1 iron helmet to {random.item.list::*}
   add 1 diamond sword to {random.item.list::*}
   add 1 diamond pickaxe to {random.item.list::*}
   add 1 diamond axe to {random.item.list::*}
   add 1 diamond boots to {random.item.list::*}
   add 1 diamond leggings to {random.item.list::*}
   add 1 diamond helmet to {random.item.list::*}
   add 1 diamond chestplate to {random.item.list::*}
   wait 1 tick
   execute console command "/chest"
command /chest:
   trigger:
       if executor is console:
           loop blocks in radius 100 around {chestloc}:
               if loop-block is a chest:
                   clear loop-block's inventory
                   set {_item} to a random number between 3 and 6
                   loop {_item} times:
                       set {_randomitem} to random element out of {random.item.list::*}
                       add {_randomitem} to the loop-block's inventory
command /setloc:
   trigger:
       set {chestloc} to player's position

 

J'aimerais donc une version avancée de celui-ci , le problème avec celui-ci c'est les mini lags . J'aimerais donc savoir si au lieu de cela , on pourrait loop une fois la map et donc sauvegarder tout les coffres de la map dans une variable est ainsi remplir juste les coffres plutôt que de re loop la map pour les remplir ! J’espère avoir était assez clair x)))

Posté(e)

Et voila :) Tu ne vas plus avoir de probléme de lag avec ça :

- Petit ajout : j'ai fais en sorte que le slot de l'objet soit aléatoire pour pas avoir les objets alignés dans le coffre

- Tu dois set la position des coffres avec la commande "/chest add" (en ciblant le coffre) et tu peux enlever un coffre si besoin avec "/chest remove" (en le ciblant toujours).

- "/chest clear" pour supprimer tous les coffres de la liste

- "/chest refill" pour refill les coffres manuellement

 

Voila le code, bonne soirée:

Dit moi si tu as un problème avec le code ou tout autre demande :)

 

on load:
   delete {random.item.list::*}
   add 1 diamond to {random.item.list::*}
   add 2 iron ingot to {random.item.list::*}
   add 2 leather to {random.item.list::*}
   add 2 tnt to {random.item.list::*}
   add 1 flint and steel to {random.item.list::*}
   add 1 golden apple to {random.item.list::*}
   add 4 cooked beef to {random.item.list::*}
   add 32 stone to {random.item.list::*}
   add 32 cobblestone to {random.item.list::*}
   add 4 cooked porkchop to {random.item.list::*}
   add 32 planks to {random.item.list::*}
   add 2 apple to {random.item.list::*}
   add 1 stone sword to {random.item.list::*}
   add 1 stone pickaxe to {random.item.list::*}
   add 1 stone axe to {random.item.list::*}
   add 1 leather leggings to {random.item.list::*}
   add 1 leather boots to {random.item.list::*}
   add 1 leather chestplate to {random.item.list::*}
   add 1 leather helmet to {random.item.list::*}
   add 4 snowball to {random.item.list::*}
   add 4 arrow to {random.item.list::*}
   add 1 bow to {random.item.list::*}
   add 1 iron sword to {random.item.list::*}
   add 1 iron pickaxe to {random.item.list::*}
   add 1 iron axe to {random.item.list::*}
   add 1 iron leggings to {random.item.list::*}
   add 1 iron boots to {random.item.list::*}
   add 1 iron chestplate to {random.item.list::*}
   add 1 iron helmet to {random.item.list::*}
   add 1 diamond sword to {random.item.list::*}
   add 1 diamond pickaxe to {random.item.list::*}
   add 1 diamond axe to {random.item.list::*}
   add 1 diamond boots to {random.item.list::*}
   add 1 diamond leggings to {random.item.list::*}
   add 1 diamond helmet to {random.item.list::*}
   add 1 diamond chestplate to {random.item.list::*}
   wait 2 second
   make console execute command "/chest refill"

command /chest [<text>]:
   permission: chest.use
   trigger:
       if arg 1 is not set:
           message "&7&m&l---------------------------"
           message "&8[&a&lChest&8] &b➡ Commandes  :"
           message "&c● &e/chest add &7> Ajouter un coffre"
           message "&c● &e/chest remove &7> Supprimer un coffre"
           message "&c● &e/chest clear &7> Supprimer tous les coffres"
           message "&c● &e/chest refill &7> Refill les coffres"
           message "&cPour ajouter/supprimer un coffre"
           message "&cil faut le regarder et faire la commande"
           message "&7&m&l---------------------------"
       else:
           if arg 1 is not "add" or "remove" or "refill" or "clear":
               make player execute command "/chest"
           else:
               if arg 1 is "clear":
                   clear {Chest.location::*}
                   message "&8[&a&lChest&8] &a➡ &eVous avez supprimé tous les coffres de la liste"
               if arg 1 is "add":
                   if targeted block is a chest:
                       loop {Chest.location::*}:
                           if loop-value is location of targeted block:
                               message "&8[&a&lChest&8] &c➡ Le coffre est déjà dans la liste"
                               stop
                       add location of targeted block to {Chest.location::*}
                       message "&8[&a&lChest&8] &a➡ &eVous avez bien ajouté ce coffre, il y a maintenant &a%size of {Chest.location::*}% &ecoffres"

                   else:
                       message "&8[&a&lChest&8] &c➡ Vous devez cibler un coffre"
               if arg 1 is "remove":
                   if targeted block is a chest:
                       loop {Chest.location::*}:
                           if loop-value is location of targeted block:
                               message "&8[&a&lChest&8] &a➡ &eVous avez bien supprimé ce coffre, il y a maintenant &a%size of {Chest.location::*}% &ecoffres"
                               remove location of targeted block from {Chest.location::*}
                               stop
                       message "&8[&a&lChest&8] &c➡ Le coffre n'est pas dans la liste"
                   else:
                       message "&8[&a&lChest&8] &c➡ Vous devez cibler un coffre"
               if arg 1 is "refill":
                   loop {Chest.location::*}:
                       set {_slot::*} to ""
                       loop 27 times:
                           add loop-number to {_number::*}
                       clear inventory of block at loop-value
                       set {_nbr} to a random number between 3 and 6
                       loop {_nbr} times:
                           set {_item} to a random element out of {random.item.list::*}
                           set {_slot} to a random element out of {_number::*}
                           add {_item} to slot ({_slot} - 1) of block at loop-value-1
                       message "&8[&a&lChest&8] &a➡ &eLes &a%size of {Chest.location::*}% &eont été refill"


Posté(e)
Et voila :) Tu ne vas plus avoir de probléme de lag avec ça :

- Petit ajout : j'ai fais en sorte que le slot de l'objet soit aléatoire pour pas avoir les objets alignés dans le coffre

- Tu dois set la position des coffres avec la commande "/chest add" (en ciblant le coffre) et tu peux enlever un coffre si besoin avec "/chest remove" (en le ciblant toujours).

- "/chest clear" pour supprimer tous les coffres de la liste

- "/chest refill" pour refill les coffres manuellement

 

Voila le code, bonne soirée:

Dit moi si tu as un problème avec le code ou tout autre demande :)

 

on load:
   delete {random.item.list::*}
   add 1 diamond to {random.item.list::*}
   add 2 iron ingot to {random.item.list::*}
   add 2 leather to {random.item.list::*}
   add 2 tnt to {random.item.list::*}
   add 1 flint and steel to {random.item.list::*}
   add 1 golden apple to {random.item.list::*}
   add 4 cooked beef to {random.item.list::*}
   add 32 stone to {random.item.list::*}
   add 32 cobblestone to {random.item.list::*}
   add 4 cooked porkchop to {random.item.list::*}
   add 32 planks to {random.item.list::*}
   add 2 apple to {random.item.list::*}
   add 1 stone sword to {random.item.list::*}
   add 1 stone pickaxe to {random.item.list::*}
   add 1 stone axe to {random.item.list::*}
   add 1 leather leggings to {random.item.list::*}
   add 1 leather boots to {random.item.list::*}
   add 1 leather chestplate to {random.item.list::*}
   add 1 leather helmet to {random.item.list::*}
   add 4 snowball to {random.item.list::*}
   add 4 arrow to {random.item.list::*}
   add 1 bow to {random.item.list::*}
   add 1 iron sword to {random.item.list::*}
   add 1 iron pickaxe to {random.item.list::*}
   add 1 iron axe to {random.item.list::*}
   add 1 iron leggings to {random.item.list::*}
   add 1 iron boots to {random.item.list::*}
   add 1 iron chestplate to {random.item.list::*}
   add 1 iron helmet to {random.item.list::*}
   add 1 diamond sword to {random.item.list::*}
   add 1 diamond pickaxe to {random.item.list::*}
   add 1 diamond axe to {random.item.list::*}
   add 1 diamond boots to {random.item.list::*}
   add 1 diamond leggings to {random.item.list::*}
   add 1 diamond helmet to {random.item.list::*}
   add 1 diamond chestplate to {random.item.list::*}
   wait 2 second
   make console execute command "/chest refill"

command /chest [<text>]:
   permission: chest.use
   trigger:
       if arg 1 is not set:
           message "&7&m&l---------------------------"
           message "&8[&a&lChest&8] &b➡ Commandes  :"
           message "&c● &e/chest add &7> Ajouter un coffre"
           message "&c● &e/chest remove &7> Supprimer un coffre"
           message "&c● &e/chest clear &7> Supprimer tous les coffres"
           message "&c● &e/chest refill &7> Refill les coffres"
           message "&cPour ajouter/supprimer un coffre"
           message "&cil faut le regarder et faire la commande"
           message "&7&m&l---------------------------"
       else:
           if arg 1 is not "add" or "remove" or "refill" or "clear":
               make player execute command "/chest"
           else:
               if arg 1 is "clear":
                   clear {Chest.location::*}
                   message "&8[&a&lChest&8] &a➡ &eVous avez supprimé tous les coffres de la liste"
               if arg 1 is "add":
                   if targeted block is a chest:
                       loop {Chest.location::*}:
                           if loop-value is location of targeted block:
                               message "&8[&a&lChest&8] &c➡ Le coffre est déjà dans la liste"
                               stop
                       add location of targeted block to {Chest.location::*}
                       message "&8[&a&lChest&8] &a➡ &eVous avez bien ajouté ce coffre, il y a maintenant &a%size of {Chest.location::*}% &ecoffres"

                   else:
                       message "&8[&a&lChest&8] &c➡ Vous devez cibler un coffre"
               if arg 1 is "remove":
                   if targeted block is a chest:
                       loop {Chest.location::*}:
                           if loop-value is location of targeted block:
                               message "&8[&a&lChest&8] &a➡ &eVous avez bien supprimé ce coffre, il y a maintenant &a%size of {Chest.location::*}% &ecoffres"
                               remove location of targeted block from {Chest.location::*}
                               stop
                       message "&8[&a&lChest&8] &c➡ Le coffre n'est pas dans la liste"
                   else:
                       message "&8[&a&lChest&8] &c➡ Vous devez cibler un coffre"
               if arg 1 is "refill":
                   loop {Chest.location::*}:
                       set {_slot::*} to ""
                       loop 27 times:
                           add loop-number to {_number::*}
                       clear inventory of block at loop-value
                       set {_nbr} to a random number between 3 and 6
                       loop {_nbr} times:
                           set {_item} to a random element out of {random.item.list::*}
                           set {_slot} to a random element out of {_number::*}
                           add {_item} to slot ({_slot} - 1) of block at loop-value-1
                       message "&8[&a&lChest&8] &a➡ &eLes &a%size of {Chest.location::*}% &eont été refill"


Je t'aime tellement , moi qui voulait faire le système de vide aléatoire :x !

×
×
  • 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.