• 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 function that checks a item on a tile

Tarielle

New Member
Joined
Nov 4, 2007
Messages
214
Reaction score
0
Location
Sweden
Hi can someone help me what lua function that checks if a item is on a special tile. For example: That if you put a item on a tile something will happen; like if you put a demon shield on a tile a stone will be removed.
Could someone tell me what lua function that is that checks that item or send a script with that function included, please.

Thanks
 
Code:
function onUse(cid, item, frompos, item2, topos)
thingpos = {x=[COLOR="Red"]xxx[/COLOR], y=[COLOR="Red"]yyy[/COLOR], z=[COLOR="Red"]zzz[/COLOR], stackpos=}
getthing = getThingfromPos(thingpos)
if item.uid == [COLOR="Red"]lever unique id[/COLOR] and item.itemid == [COLOR="Red"]1945[/COLOR] and getpiece1.itemid == [COLOR="Red"]item id[/COLOR] then 
doTransformItem(item.uid,item.itemid+1)
doRemoveItem(getthing.uid,1)
doSendMagicEffect(thingpos,23)
[COLOR="Red"]do[/COLOR]

and after red "do" you can write what shoud happend
but thats script for lever.. so you need to put item somewhere and then pull lever.. is that good for you?
 
onAddItem(moveitem, tileitem, pos)

moveitem == the item you move on the tile
tileitem == the tile?
pos == tile pos? :eek:

Test that yourselves :p
 
<movevent event="AddItem" tileitem="1" uniqueid="UUU" script="NAMEOFSCRIPT.lua" />
<movevent event="RemoveItem" tileitem="1" uniqueid="UUU" script="NAMEOFSCRIPT.lua" />

RemoveItem is for onRemoveItem, you don't need it! I THINK tileitem is the stackpos... Unsure ^.- and uniqueid could prolly be replaced with itemid :p
 
Last edited:
Back
Top