Aller au contenu
BadFox

UHCRun / OrePopulator, génération de minerais

Messages recommandés

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

Partager ce message


Lien à poster
Partager sur d’autres sites

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 ;)

Partager ce message


Lien à poster
Partager sur d’autres sites

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

Partager ce message


Lien à poster
Partager sur d’autres sites

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