Find out BlockID on Cords
#5
(05-14-2017, 03:47 AM)xoft Wrote: Note that this function only works as expected if the chunk which you're querying is loaded. If you have a reasonable doubt that the chunk may be unloaded, you'll need to use the cWorld:ChunkStay() method to force-load it.

I have two function with a little difference. But the first one works fine and the other one works not. In the first function (LoadBedBlock) can i use "Height" out of the inner function and in GetRandomHeight i cant use "Height" out of the inner function, why?

Result:  LoadBedBlock         Height: 64       IsLaoded:      true

PHP Code:
function LoadBedBlock(X,Y,Z,World) local _, Height local BedBlock World:ChunkStay({{math.floor(X / 16), math.floor(Z / 16)}}, nil, function() _, Height = World:TryGetHeight(X, Z) --print(X, Height, Z, _) end ) print("LoadBedBlock ","Height:",Height," IsLaoded:",_) BedBlock=World:GetBlock(X, Y, Z) return BedBlock end


Result: GetRandomHeight         Height: nil      IsLaoded:      nil

PHP Code:
function GetRandomHeight(X,Z,World) local _, Height World:ChunkStay({{math.floor(X / 16), math.floor(Z / 16)}}, nil, function() _, Height = World:TryGetHeight(X, Z) --print(X, Height, Z, _) end ) print("GetRandomHeight ","Height:",Height," IsLaoded:",_) return Height end
Reply
Thanks given by:


Messages In This Thread
Find out BlockID on Cords - by moiko89 - 05-14-2017, 02:08 AM
RE: Find out BlockID on Cords - by moiko89 - 05-14-2017, 03:39 AM
RE: Find out BlockID on Cords - by xoft - 05-14-2017, 03:47 AM
RE: Find out BlockID on Cords - by moiko89 - 05-14-2017, 08:59 PM
RE: Find out BlockID on Cords - by moiko89 - 05-14-2017, 07:27 PM
RE: Find out BlockID on Cords - by xoft - 05-15-2017, 05:25 AM



Users browsing this thread: 1 Guest(s)