Aller au contenu

2 loop en même temps pour systeme de coffre aléatoire


Messages recommandés

Posté(e)

Bonjours,

Avant tout merci de prendre du temps et de lire cette requête.

Mon problème étant le suivant : je doit loop 2 variable en même temps

 

Tenez le code :

loop {_listitem::*}:
   loop {_listslot::*}:
       set slot loop-value-2 of inventory of loop-block to loop-value-1

 

Voila donc dans la variable listitem il y a des items et dans la variable listslot il y a les slots (mais je pence que vous vous en doutiez ^^)

Le problème c'est que sa va loop bien jusqu'au dernier item de la variable listitem qui ce dernier va remplacer tout les items dans le coffre (enfin je crois que sa se passe comme sa puisque dans mon coffre il n'y a qu'un seul item alors qu'il devrait y avoir entre 4 à 19 items)

Voilà en espérant que je me sois bien exprimer et que vous pourrez résoudre mon problème

 

Cordialement

death_xXX

P.S.: Je suis en 1.7.10 et la version de mon skript je l'a connais pas mais je sais que c'est la version la plus fonctionnelle et avec le moins de bug

Posté(e)

Bonjours,

D’accord je te l'envoie tout de suite

 

on rightclick on chest:
   loop all players:
       loop all blocks in radius 10 around loop-player:
           if loop-block is a chest:
               if {chest.%location of loop-block%.time} is not set:
                   set {chest.%location of loop-block%.time} to now
               if difference between now and {chest.%location of loop-block%.time} is bigger than 1 minutes:
                   set {_a} to 1
                   chance of 100%:
                       add 1 golden apple to {_listitem::*}
                       add 1 to {_a}
                   chance of 50%:
                       add 4 billet1000 to {_listitem::*}
                       add 1 to {_a}
                   chance of 80%:
                       add 3 bread to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 cleaver to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 lead pipe to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 wrench to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 crowbar to {_listitem::*}
                       add 1 to {_a}
                   chance of 80%:
                       add paper crown to {_listitem::*}
                       add 1 to {_a}
                   chance of 80%:
                       add tactical vest to {_listitem::*}
                       add 1 to {_a}
                   chance of 70%:
                       add leather skirt to {_listitem::*}
                       add 1 to {_a}
                   chance of 1%:
                       add antiinfection to {_listitem::*}
                       add 1 to {_a}
                   chance of 10%:
                       add silversec to {_listitem::*}
                       add 1 to {_a}
                   chance of 5%:
                       add silversec ammo to {_listitem::*}
                       add 1 to {_a}
                   chance of 5%:
                       add makote to {_listitem::*}
                       add 1 to {_a}
                   chance of 5%:
                       add makote ammo to {_listitem::*}
                       add 1 to {_a}
                   chance of 90%:
                       add phone to {_listitem::*}
                       add 1 to {_a}
                   chance of 60%:
                       add pendant to {_listitem::*}
                       add 1 to {_a}
                   chance of 70%:
                       add ring to {_listitem::*}
                       add 1 to {_a}
                   chance of 70%:
                       add necklace to {_listitem::*}
                       add 1 to {_a}
                   set {_a} to 0
                   loop {_listitem::*}:
                       add 1 to {_a}
                       set {_slot.%{_a}%} to a random integer between 0 and 27
                       while {_listslot::*} contains {_slot.%{_a}%}:
                           set {_slot.%{_a}%} to a random integer between 0 and 27
                       add {_slot.%{_a}%} to {_listslot::*}
                   loop {_listitem::*}:
                       loop {_listslot::*}:
                           set slot loop-value-2 of inventory of loop-block to loop-value-1
#                set {chest.%location of loop-block%.time} to now

on break of chest:
   if {chest.%location of event-block%.time} is set:
       delete {chest.%location of event-block%.time}

 

Voila (les mots comme cleaver ect... je les ai rajouté dans le aliases-english.sk ne t'inquiète pas)

Posté(e)

Finalement en me remuant les méninges je me suis rendu compte que la solution était très simple

je vous envoie le code en entier pour ceux que sa intéresse (les modifications sont a la ligne 8-11; 77-79) :

 

every second:
   loop all players:
       loop all blocks in radius 10 around loop-player:
           if loop-block is a chest:
               if {chest.%location of loop-block%.time} is not set:
                   set {chest.%location of loop-block%.time} to now
               if difference between now and {chest.%location of loop-block%.time} is bigger than 15 minutes:
                   set {_c} to -1
                   loop 27 times:
                       add 1 to {_c}
                       set slot {_c} of inventory of loop-block to air
                   set {_a} to 1
                   chance of 1%:
                       add 1 golden apple to {_listitem::*}
                       add 1 to {_a}
                   chance of 80%:
                       add 3 bread to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 cleaver to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 lead pipe to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 wrench to {_listitem::*}
                       add 1 to {_a}
                   chance of 20%:
                       add 1 crowbar to {_listitem::*}
                       add 1 to {_a}
                   chance of 80%:
                       add paper crown to {_listitem::*}
                       add 1 to {_a}
                   chance of 80%:
                       add tactical vest to {_listitem::*}
                       add 1 to {_a}
                   chance of 70%:
                       add leather skirt to {_listitem::*}
                       add 1 to {_a}
                   chance of 1%:
                       add antiinfection to {_listitem::*}
                       add 1 to {_a}
                   chance of 10%:
                       add silversec to {_listitem::*}
                       add 1 to {_a}
                   chance of 5%:
                       add silversec ammo to {_listitem::*}
                       add 1 to {_a}
                   chance of 5%:
                       add makote to {_listitem::*}
                       add 1 to {_a}
                   chance of 5%:
                       add makote ammo to {_listitem::*}
                       add 1 to {_a}
                   chance of 90%:
                       add phone to {_listitem::*}
                       add 1 to {_a}
                   chance of 60%:
                       add pendant to {_listitem::*}
                       add 1 to {_a}
                   chance of 70%:
                       add ring to {_listitem::*}
                       add 1 to {_a}
                   chance of 70%:
                       add necklace to {_listitem::*}
                       add 1 to {_a}
                   set {_a} to 0
                   loop {_listitem::*}:
                       add 1 to {_a}
                       set {_slot.%{_a}%} to a random integer between 0 and 27
                       while {_listslot::*} contains {_slot.%{_a}%}:
                           set {_slot.%{_a}%} to a random integer between 0 and 27
                       add {_slot.%{_a}%} to {_listslot::*}
                   loop {_listitem::*}:
                       loop {_listslot::*}:
                           set slot loop-value-2 of inventory of loop-block to loop-value-1
                           remove loop-value-2 from {_listslot::*}
                           stop loop
               set {chest.%location of loop-block%.time} to now

on break of chest:
   if {chest.%location of event-block%.time} is set:
       delete {chest.%location of event-block%.time}

 

 

Merci a toi PsYZiiK qui a quand meme pris un peu de temps pour moi

Cordialement

death_xXX

P.S.: C'est un systéme de coffre aléatoire avec des pourcentage de chance

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