BadFox Posté(e) le 31 mars 2016 Posté(e) le 31 mars 2016 Bonjour, J'ai fini la programmation d'un UHCRun pour un serveur. Deux problèmes viennent à moi: - La génération de minerais en debut de partie entraine un cras ou un gros lag de 1 minute. - Comment supprimer le dossier "world" en fin de partie Pour le premier probleme voici mon code: loop 226664 times: set {_x} to a random integer between -500 and 500 set {_z} to a random integer between -500 and 500 set {_y} to a random integer between 3 and 90 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} set {_rand} to a random integer between 0 and 12 if {_rand} = 0, 1, 3 or 2: if block at {_loc} is stone: set block at {_loc} to diamond ore set {_y} to {_y} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to diamond ore set {_x} to {_x} + 1 set {_z} to {_z} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to diamond ore set {_y} to {_y} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to diamond ore set {_x} to {_x} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to diamond ore else if {_rand} = 4 or 5: if block at {_loc} is stone: set block at {_loc} to obsidian set {_y} to {_y} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to obsidian set {_x} to {_x} + 1 set {_z} to {_z} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to obsidian set {_y} to {_y} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to obsidian set {_x} to {_x} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to obsidian else if {_rand} = 6, 8 or 7: if block at {_loc} is stone: set block at {_loc} to gold ore set {_y} to {_y} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to gold ore set {_x} to {_x} + 1 set {_z} to {_z} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to gold ore set {_y} to {_y} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to gold ore set {_x} to {_x} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to gold ore else if {_rand} = 9, 8 or 10: if block at {_loc} is stone: set block at {_loc} to iron ore set {_y} to {_y} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to iron ore set {_x} to {_x} + 1 set {_z} to {_z} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to iron ore set {_y} to {_y} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to iron ore set {_x} to {_x} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to iron ore else if {_rand} = 11 or 12: set {_x} to a random integer between -500 and 500 set {_z} to a random integer between -500 and 500 set {_y} to a random integer between 3 and 90 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to 155 set {_y} to {_y} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to 155 set {_x} to {_x} + 1 set {_z} to {_z} - 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} if block at {_loc} is stone: set block at {_loc} to 155 set {_y} to {_y} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to 155 set {_x} to {_x} + 1 set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world} chance of 50%: if block at {_loc} is stone: set block at {_loc} to 155 Donc cela entraine un gros lag étant donner que cela dois genere 226 664^3.35 locations et block. J'ai essayer de plusieurs façons avec les chunks mais je n'arrive pas a recuperer les coordonés d'un chunk... Enfin bref je commence desesperer, j'ai aussi essayer en java mais cela à été en vain. Pour le delete du dossier world le 'df "world"' ou le "delete file "world"" ne marche pas, j'ai aussi essayer en java... Si quelqu'un trouve la solution à un ou deux de ces problemes: Merci de me repondre par skript-mc.fr ou twitter (@GoldenGames_Eu) ou par mail: ([email protected]) Merci d'avance
0 Izychiel Posté(e) le 31 mars 2016 Posté(e) le 31 mars 2016 Peux-tu utiliser les balises code steuplè ? Ou mettre dans ton code dans un Pastebin :) [.code]TON CODE[./code] (sans les points)
0 BadFox Posté(e) le 31 mars 2016 Auteur Posté(e) le 31 mars 2016 Ok, je le met sur pastebin/hastebin demain :)
0 romax7 Posté(e) le 31 mars 2016 Posté(e) le 31 mars 2016 Heu les balises code me semble plus simple juste a ajouter un [.code=lua] au debut de ton code et un [./code] à la fin… de plus je pense que pour les skripteurs il est plus simple de voir le code sur le forum plutôt que sur un hastebin ;)
0 Mastersfelix Posté(e) le 1 avril 2016 Posté(e) le 1 avril 2016 Si tu veux régler le problème de ton skript, tu rajoutes un wait 1 tick entre les loops, mais là le problème c'est que ton code va prendre 260 000 ticks à faire tout le travail donc environ 3 heures...
Question
BadFox
Bonjour,
J'ai fini la programmation d'un UHCRun pour un serveur. Deux problèmes viennent à moi:
- La génération de minerais en debut de partie entraine un cras ou un gros lag de 1 minute.
- Comment supprimer le dossier "world" en fin de partie
Pour le premier probleme voici mon code:
loop 226664 times:
set {_x} to a random integer between -500 and 500
set {_z} to a random integer between -500 and 500
set {_y} to a random integer between 3 and 90
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
set {_rand} to a random integer between 0 and 12
if {_rand} = 0, 1, 3 or 2:
if block at {_loc} is stone:
set block at {_loc} to diamond ore
set {_y} to {_y} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to diamond ore
set {_x} to {_x} + 1
set {_z} to {_z} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to diamond ore
set {_y} to {_y} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to diamond ore
set {_x} to {_x} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to diamond ore
else if {_rand} = 4 or 5:
if block at {_loc} is stone:
set block at {_loc} to obsidian
set {_y} to {_y} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to obsidian
set {_x} to {_x} + 1
set {_z} to {_z} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to obsidian
set {_y} to {_y} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to obsidian
set {_x} to {_x} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to obsidian
else if {_rand} = 6, 8 or 7:
if block at {_loc} is stone:
set block at {_loc} to gold ore
set {_y} to {_y} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to gold ore
set {_x} to {_x} + 1
set {_z} to {_z} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to gold ore
set {_y} to {_y} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to gold ore
set {_x} to {_x} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to gold ore
else if {_rand} = 9, 8 or 10:
if block at {_loc} is stone:
set block at {_loc} to iron ore
set {_y} to {_y} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to iron ore
set {_x} to {_x} + 1
set {_z} to {_z} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to iron ore
set {_y} to {_y} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to iron ore
set {_x} to {_x} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to iron ore
else if {_rand} = 11 or 12:
set {_x} to a random integer between -500 and 500
set {_z} to a random integer between -500 and 500
set {_y} to a random integer between 3 and 90
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to 155
set {_y} to {_y} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to 155
set {_x} to {_x} + 1
set {_z} to {_z} - 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
if block at {_loc} is stone:
set block at {_loc} to 155
set {_y} to {_y} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to 155
set {_x} to {_x} + 1
set {_loc} to the location at {_x}, {_y}, {_z} of the world {@world}
chance of 50%:
if block at {_loc} is stone:
set block at {_loc} to 155
Donc cela entraine un gros lag étant donner que cela dois genere 226 664^3.35 locations et block.
J'ai essayer de plusieurs façons avec les chunks mais je n'arrive pas a recuperer les coordonés d'un chunk...
Enfin bref je commence desesperer, j'ai aussi essayer en java mais cela à été en vain.
Pour le delete du dossier world le 'df "world"' ou le "delete file "world"" ne marche pas, j'ai aussi essayer en java...
Si quelqu'un trouve la solution à un ou deux de ces problemes:
Merci de me repondre par skript-mc.fr ou twitter (@GoldenGames_Eu) ou par mail: ([email protected])
Merci d'avance
4 réponses à cette question
Messages recommandés