function spawnNewBlock1():
set {_loc} to getRandomLoc()
while {blockLives::%{_loc}%} is set:
set {_loc} to getRandomLoc()
loop all blocks in radius 1.5 around {_loc}:
if loop-block is air:
set block at loop-block to cobblestone
set {blockLives::%location of loop-block%} to 1
function getRandomLoc(xmin: integer=-10, xmax: integer=10, zmin: integer=-10, zmax: integer=10, world: text="jd") :: location:
while {_return} is not set:
set {_x} to random integer between {_xmin} and {_xmax}
set {_z} to random integer between {_zmin} and {_zmax}
set {_loc} to highest block at location at {_x}, 0, {_z} in world ({_world} parsed as world)
if block at {_loc} = air:
if (block at {_loc}) and (block above block at {_loc}) != lava:
loop all blocks in radius 16 around {_loc}:
if {szaf::%location of loop-block%::*} is set:
return {_return}
else:
set {_return} to {_loc}
send "%{_loc}%" to all players
else:
add 1 to y-loc of {_loc}
return {_return}
command /daj:
trigger:
spawnNewBlock1()
i nawet jeśli {szaf::%location of loop-block%::*} jest ustawione to i tak skała się tworzy
Pytanie
Bodziusiu2 4
Witam
Mam taki kod
function spawnNewBlock1(): set {_loc} to getRandomLoc() while {blockLives::%{_loc}%} is set: set {_loc} to getRandomLoc() loop all blocks in radius 1.5 around {_loc}: if loop-block is air: set block at loop-block to cobblestone set {blockLives::%location of loop-block%} to 1 function getRandomLoc(xmin: integer=-10, xmax: integer=10, zmin: integer=-10, zmax: integer=10, world: text="jd") :: location: while {_return} is not set: set {_x} to random integer between {_xmin} and {_xmax} set {_z} to random integer between {_zmin} and {_zmax} set {_loc} to highest block at location at {_x}, 0, {_z} in world ({_world} parsed as world) if block at {_loc} = air: if (block at {_loc}) and (block above block at {_loc}) != lava: loop all blocks in radius 16 around {_loc}: if {szaf::%location of loop-block%::*} is set: return {_return} else: set {_return} to {_loc} send "%{_loc}%" to all players else: add 1 to y-loc of {_loc} return {_return} command /daj: trigger: spawnNewBlock1()i nawet jeśli {szaf::%location of loop-block%::*} jest ustawione to i tak skała się tworzy
i tak samo jest jak sam is not set bez else
Edytowane przez Bodziusiu2Odnośnik do komentarza
https://skript.pl/temat/46775-nie-blokuj%C4%99-spawn-bloku-w-funkcji/Udostępnij na innych stronach
7 odpowiedzi na to pytanie
Rekomendowane odpowiedzi