Francois Posted July 9, 2017 Share Posted July 9, 2017 (edited) I have been trying to figure out how to find the set of buildings in the game world. I've been digging through the API definitions on various PZ websites. What I've found doesn't seem to work as expected. cell:getBuildingList() always returns an empty list. All of my scripts are running in client, and not server. Not sure if that makes a difference or not. Does it? Here is my failed attempts at trying to find the right way of finding buildings around a specific NPC / Player. local npc = getSpecificPlayer(0) if not npc then print("npc is nil") return end local square = npc:getCurrentSquare(); if not square then return end print(square) local room = square:getRoom(); if not room then return end print(room) local building = room:getBuilding(); if not building then return end print(building); local cell = square:getCell() if not cell then return end print(cell) local buildings = cell:getBuildingList() if not buildings then return end print(buildings) if buildings:size() == 0 then print("DEBUG: building list is empty!") end print("Found buildings: " .. tostring(buildings:size())) local world = getWorld() local worldCell = world:getCell() buildings = worldCell:getBuildingList() if not buildings then print("No buildings in world current cell") return end print(buildings) if buildings:size() == 0 then print("DEBUG: World building list is empty!") end And here is the output to the console. 1499625737982 zombie.iso.IsoGridSquare@1a914a00 1499625737982 zombie.iso.areas.IsoRoom@1d67348a 1499625737982 zombie.iso.areas.IsoBuilding@39f8adc0 1499625737983 zombie.iso.IsoCell@c7269ad 1499625737983 [] 1499625737983 DEBUG: building list is empty! 1499625737984 Found buildings: 0 1499625737984 [] 1499625737984 DEBUG: World building list is empty! Edited July 9, 2017 by Francois Formatting was messed up. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted July 9, 2017 Share Posted July 9, 2017 Probably have to query each gridsquare to see if it belongs to an isobuilding. Check out the safehouse code. Link to comment Share on other sites More sharing options...
Francois Posted July 9, 2017 Author Share Posted July 9, 2017 1 hour ago, EnigmaGrey said: Probably have to query each gridsquare to see if it belongs to an isobuilding. Check out the safehouse code. Figured as much. Would have been nice to avoid doing such Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now