Terotrificy
Veteran OT User
Hi, i'm using Othire 1.0 server on 7.72.
I'm trying to make a script to create a sewer when you step in a tile and remove the sewer when you step out (like devil helmet quest sewer). The problem is when the player or any item is above this sewer at the momment of step out, it can't find the sewer (LuaScriptInterface::luaDoRemoveItem(). Item not found) and the sewer isn't removed. Anyone who can help me please? this is my script:
The cellar should be created under the items and the player if the other player step in on the tile again.
I'm trying to make a script to create a sewer when you step in a tile and remove the sewer when you step out (like devil helmet quest sewer). The problem is when the player or any item is above this sewer at the momment of step out, it can't find the sewer (LuaScriptInterface::luaDoRemoveItem(). Item not found) and the sewer isn't removed. Anyone who can help me please? this is my script:
Lua:
function onStepIn(cid, item, fromPosition, itemEx, toPosition)
local sewer = {x=32482, y=32170, z=14, stackpos=254}
local sewerPos = getThingfromPos(sewer)
if item.uid == 6061 and item.itemid == 426 then
doCreateItem(430,0,sewer)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry not possible.")
end
return true
end
function onStepOut(cid, item, frompos, item2, topos)
local sewer = {x=32482, y=32170, z=14, stackpos=1}
local sewerPos = getThingfromPos(sewer)
local nextTile = {x=sewer.x, y=sewer.y+1, z=sewer.z}
if item.uid == 6061 and item.itemid == 425 then
doRemoveItem(sewerPos.uid,1)
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"Sorry not possible.")
end
return true
end
The cellar should be created under the items and the player if the other player step in on the tile again.
Post automatically merged:
Solved: Using getTileItemById solved this issue.Hi, i'm using Othire 1.0 server on 7.72.
I'm trying to make a script to create a cellar when you step in a tile and remove the cellar when you step out (like devil helmet quest cellar). The problem is when the player or any item is above this cellar at the momment of step out, it can't find the cellar (LuaScriptInterface::luaDoRemoveItem(). Item not found) and the cellar isn't removed. Anyone who can help me please? this is my script:
Lua:function onStepIn(cid, item, fromPosition, itemEx, toPosition) local cellar = {x=32482, y=32170, z=14, stackpos=254} local cellarPos = getThingfromPos(cellar) local nextTile = {x=cellar.x, y=cellar.y+1, z=cellar.z} if item.uid == 6061 and item.itemid == 426 then doCreateItem(430,0,cellar) doTransformItem(item.uid,item.itemid-1) else doPlayerSendCancel(cid,"Sorry not possible.") end return true end function onStepOut(cid, item, frompos, item2, topos) local cellar = {x=32482, y=32170, z=14, stackpos=1} local cellarPos = getThingfromPos(cellar) local nextTile = {x=cellar.x, y=cellar.y+1, z=cellar.z} if item.uid == 6061 and item.itemid == 425 then doRemoveItem(cellarPos.uid,1) doTransformItem(item.uid,item.itemid+1) else doPlayerSendCancel(cid,"Sorry not possible.") end return true end
The cellar should be created under the items and the player if the other player step in on the tile again.
Lua:
function onStepIn(cid, item, fromPosition, itemEx, toPosition)
local sewer = {x=32482, y=32170, z=14, stackpos=1}
local sewerPos = getThingfromPos(sewer)
local nextTile = {x=sewer.x, y=sewer.y+1, z=sewer.z}
if item.uid == 6061 and item.itemid == 426 then
doCreateItem(430,1,sewer)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry not possible.")
end
return true
end
function onStepOut(cid, item, frompos, item2, topos)
local sewer = {x=32482, y=32170, z=14}
local sewerPos = getTileItemById(sewer,430)
if item.uid == 6061 and item.itemid == 425 then
doRemoveItem(sewerPos.uid,1)
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"Sorry not possible.")
end
return true
end
Last edited: