Aller au contenu
  • 0

Problème avec le "random to 1 and 5"


Question

Posté(e)

Bonsoir a tous ! Je travail sur un petit projet de "crates" et pour les random item j'ai utilisé le "set {random_coffre} to 1 and 5" enfin bref je vous laisse regardez , il me dit " can't understand this expression..."

 

on rightclick:
   if name of tool of player is "&3Crates":
       loop all items in the player's inventory:
           if loop-item is Chest named "&3Crates":
               wait 1 tick
               remove 1 Chest named "&3Crates" from player's inventory
               open chest with 3 rows named "&3Crates" to player
               format slot 0 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 1 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 2 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 3 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 4 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 5 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 6 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 7 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 8 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 9 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 17 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 18 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 19 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 20 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 21 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 22 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 23 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 24 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 25 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 26 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Melon Seeds named "Agriculteur" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Ender Pearl named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               set {random_coffre} to random 1 and 5
           if {random_coffre} is 1:
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 500 volume 50
               wait 3 seconds
               close inventory to player
           if {random_coffre} is 2:
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 500 volume 50
               wait 3 seconds
               close inventory to player
           if {random_coffre} is 3:
               format slot 13 of player with 1 Melon Seeds named "Agriculteur" to be unstealable
               play raw sound "random.levelup" at player with pitch 500 volume 50
               wait 3 seconds
               close inventory to player
           if {random_coffre} is 4:
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 500 volume 50
               wait 3 seconds
               close inventory to player
           if {random_coffre} is 5:
               format slot 13 of player with 15 Ender Pearl named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 500 volume 50
               wait 3 seconds
               close inventory to player

16 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Hey !

 

Tu devrais utiliser une variable temporaire : {_random_coffre}

 

Pour mettre un nombre random utilise :

 

set {_random_chest} to a random integer between 1 and 5

  • J'aime 1
  • 0
Posté(e)
L'expression à utiliser est la suivante :

 

set {_random} to a random integer between 1 and 5
wait 0.5 tick
if {_random} is 1:
   # Etc...

 

c'est quoi la ligne de l'erreur ?

 

Hey !

 

Tu devrais utiliser une variable temporaire : {_random_coffre}

 

Pour mettre un nombre random utilise :

 

set {_random_chest} to a random integer between 1 and 5

 

je n'avait pas encore ton msg dsl !

 

merci pour vos réponses je vais tester sa de suite !

  • 0
Posté(e)
L'expression à utiliser est la suivante :

 

set {_random} to a random integer between 1 and 5
wait 0.5 tick
if {_random} is 1:
   # Etc...

 

What , quand sa tombe par exemple sur la pioche , sa me give au moin une dizaine de pioche voila le code , tu pourrait m'aider ? :/

 

on rightclick:
   if name of tool of player is "&3Crates":
       loop all items in the player's inventory:
           if loop-item is Chest named "&3Crates":
               wait 1 tick
               remove 1 Chest named "&3Crates" from player's inventory
               open chest with 3 rows named "&3Crates" to player
               format slot 0 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 1 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 2 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 3 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 4 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 5 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 6 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 7 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 8 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 9 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 17 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 18 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 19 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 20 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 21 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 22 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 23 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 24 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 25 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 26 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Melon Seeds named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Ender Pearl named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               set {_random_coffre} to a random integer between 1 and 5
               wait 0.5 tick
           if {_random_coffre} is 1:
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               wait 3 seconds
               close inventory to player
               give 1 Diamond Sword of sharpness 1 to player
           if {_random_coffre} is 2:
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               wait 3 seconds
               close inventory to player
               give 1 Diamond Pickaxe of efficiency 2 to player
           if {_random_coffre} is 3:
               format slot 13 of player with 1 Melon Seeds named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               wait 3 seconds
               close inventory to player
               give 15 Melon Seeds to player
           if {_random_coffre} is 4:
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               wait 3 seconds
               close inventory to player
               give 15 Diamond to player
           if {_random_coffre} is 5:
               format slot 13 of player with 15 Ender Pearl named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               wait 3 seconds
               close inventory to player
               give 15 Ender Pearl to player

  • 0
Posté(e)
J'essaie ton compte, et je te dis ;-)

J'ai trouvé pourquoi mais je ne sais pas le régler... Enfaite c'est quand ont en a plusieur dans l'inventaire sa les ouvres toute sans les removes de l'inventaire donc sa duplique :/

  • 0
Posté(e)
Normal tu as mis un "loop all items" ce qui fait que ça va répéter l'action plusieurs fois. Là je suis sur téléphone je ne peux pas te dire grand chose je verrai ça demain^^ !

D'accord merci , de toute façon j'ai tout mon temp :)

  • 0
Posté(e)

on rightclick:
   if name of tool of player is "&3Crates":
       loop all items in the player's inventory:
           if loop-item is Chest named "&3Crates":
               wait 1 tick
               remove 1 Chest named "&3Crates" from player's inventory
               open chest with 3 rows named "&3Crates" to player
               format slot 0 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 1 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 2 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 3 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 4 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 5 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 6 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 7 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 8 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 9 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 17 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 18 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 19 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 20 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 21 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 22 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 23 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 24 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 25 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 26 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Melon Seeds named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Ender Pearl named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               set {_random_coffre} to a random integer between 1 and 5
               wait 0.5 second
           if {_random_coffre} is 1:
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 1 Diamond Sword of sharpness 1 to player
               stop
           if {_random_coffre} is 2:
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 1 Diamond Pickaxe of efficiency 2 to player
               stop
           if {_random_coffre} is 3:
               format slot 13 of player with 1 Melon Seeds named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 15 Melon Seeds to player
               stop
           if {_random_coffre} is 4:
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 15 Diamond to player
               stop
           if {_random_coffre} is 5:
               format slot 13 of player with 15 ender_pearl named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 15 ender_pearl to player
               stop

 

Perso. ça marche ;-)

  • J'aime 1
  • 0
Posté(e)
on rightclick:
   if name of tool of player is "&3Crates":
       loop all items in the player's inventory:
           if loop-item is Chest named "&3Crates":
               wait 1 tick
               remove 1 Chest named "&3Crates" from player's inventory
               open chest with 3 rows named "&3Crates" to player
               format slot 0 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 1 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 2 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 3 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 4 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 5 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 6 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 7 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 8 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 9 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 17 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 18 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 19 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 20 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 21 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 22 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 23 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 24 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 25 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 26 of player with 1 Red Stained Glass Pane named "" to be unstealable
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 1 Melon Seeds named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               format slot 13 of player with 15 Ender Pearl named "" to be unstealable
               play raw sound "note.pling" at player with pitch 10 volume 10
               wait 0.5 second
               set {_random_coffre} to a random integer between 1 and 5
               wait 0.5 second
           if {_random_coffre} is 1:
               format slot 13 of player with 1 Diamond Sword of sharpness 1 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 1 Diamond Sword of sharpness 1 to player
               stop
           if {_random_coffre} is 2:
               format slot 13 of player with 1 Diamond Pickaxe of efficiency 2 named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 1 Diamond Pickaxe of efficiency 2 to player
               stop
           if {_random_coffre} is 3:
               format slot 13 of player with 1 Melon Seeds named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 15 Melon Seeds to player
               stop
           if {_random_coffre} is 4:
               format slot 13 of player with 15 Diamond named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 15 Diamond to player
               stop
           if {_random_coffre} is 5:
               format slot 13 of player with 15 ender_pearl named "" to be unstealable
               play raw sound "random.levelup" at player with pitch 10 volume 50
               close inventory to player
               give 15 ender_pearl to player
               stop

 

Perso. ça marche ;-)

 

AHH d'acc j'avait pas vu tu a rajouter des "stop" a la fin , sa marche niquel , merci beaucoup , je mentionnerai ton aide a la sortie du skript , ainsi que PsyZiik et ceux qui mon aidé ;)

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