• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Remove ground tile

tiddpd

PHP Scripter
Joined
Apr 16, 2008
Messages
331
Reaction score
0
I'm pretty sure its possible to do this, when I was experimenting with doRemoveItem I actually removed some grass, but I can't remember how I did it, anyways I'm making a script to make a bridge and remove with a switch. But I can't get it to remove the ground tile I'm using (which is drawbridge). I think it has something to do with stackpos but not sure. Anyone have any ideas?
 
Using a drawbridge, you're not supposed to remove the ground. If you wanna switch it to water or so use doTransformItem.

I think that you will not be able to create an item in that position if you remove the ground (not completely sure though), however transform it instead.
 
Using a drawbridge, you're not supposed to remove the ground. If you wanna switch it to water or so use doTransformItem.

I think that you will not be able to create an item in that position if you remove the ground (not completely sure though), however transform it instead.

I never even thought of that.

EDIT: I've been trying this for a while, it works for transforming the water into the bridge, but when it does that half of the tiles lose the unique id and can't be identified to transform it back for water. And even for the tiles that keep the unique id won't change back to water either. I get the "item cannot be found" error in the server window.

Note: The tiles that kept the id were the water borders.
 
Last edited:
The ground stackpos for a tile is stackpos="0" but you need to check that your tile is infact stackpos 0

Here:
Code:
local tilepos = {x=[COLOR="Red"]####[/COLOR], y=[COLOR="Red"]####[/COLOR], z=[COLOR="Red"]#[/COLOR], stackpos=0}

function onUse(cid, item, frompos, item2, topos)

local tile = getThingfromPos(tilepos)

if (item.uid == [COLOR="Red"]####[/COLOR] and item.itemid == 1945 and tile.itemid == [COLOR="Red"]#### - Your water tile[/COLOR]) then
 doTransformItem(tile.uid,1284)
 doTransformItem(item.uid,1946)

elseif (item.uid == [COLOR="Red"]####[/COLOR] and item.itemid == 1946 and tile.itemid == 1284) then
		doTransformItem(tile.uid,[COLOR="Red"]#### - Your water tile[/COLOR])
		doTransformItem(item.uid,1945)
	else
		doPlayerSendCancel(cid,"Sorry, not possible.")
	end
   return 1
end

You can use that code as a structure for yours :p

hope it helps
 
Last edited:
Back
Top