kinyoshi Posted September 24, 2013 Share Posted September 24, 2013 Any way this can be done? I'm trying to make stuff spawn on the ground like they do in containers. Like truffles,. Link to comment Share on other sites More sharing options...
Rathlord Posted September 24, 2013 Share Posted September 24, 2013 Ground is a container so my first thought would be yes, but they're probably all listed the same? Which means it would spawn in a house, in the road, and in the woods equally. Link to comment Share on other sites More sharing options...
RoboMat Posted September 24, 2013 Share Posted September 24, 2013 This code was written for the old version and was able to delete all walls on game start. I guess you could do something similar like getting all tiles in a cell, then checking their texture names and then randomly spawn stuff on them. HOW you would do that isn't trivial and without doing proper work on it myself I can't tell you more. function DeleteAllWalls() local world = GetWorld(); local cell = world:GetCell(); if cell == nil then print("Failed to get cell"); else for x = 0, cell:GetWidth() do for y = 0, cell:GetHeight() do for z = 0, cell:GetMaxFloors() do local square = cell:GetGridSquare(x, y, z); if square ~= nil then local objects = square:GetTileObjects(); if (objects ~= nil) then for k, v in ipairs(objects) do local properties = v:GetProperties(); if (properties ~= nil) then if properties:Is(PropertyType.solid) or properties:Is(PropertyType.solidtrans) or properties:Is(PropertyType.collideN) or properties:Is(PropertyType.collideW) then square:DeleteTileObject(v); end end end end end end end end endendEvents.OnGameStart.Add(DeleteAllWalls);Not sure if it really would be that easy though... 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