Jump to content

Spawning Items On The Ground


kinyoshi

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...