Ray Rewind
Doctor
I want the script like real Tibia if you put scarab coin on empty coal basin ID 1485 and you stand on the flame ID 8058 you get teleported to X Position
function onStepIn(cid, item, position, fromPosition)
local tileActionID = 270
local tileActionIDBack = 271
local coin = 2159
local teleportTo = {x=391, y=384, z=13}
local teleportBack = {x=442, y=232, z=11}
local itemPosition = {x=441, y=233, z=11, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
local getItem = getThingFromPos(itemPosition)
if isPlayer(cid) == TRUE then
if item.itemid == 1397 and item.actionid == tileActionID then
if getItem.itemid == coin then
doRemoveItem(getItem.uid, 1)
doTeleportThing(cid, teleportTo)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
doSendMagicEffect(itemPosition, 15)
end
elseif item.itemid == 1397 and item.actionid == tileActionIDBack then
doTeleportThing(cid, teleportBack)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
end
end
return TRUE
end
<movevent type="StepIn" actionid="270" event="script" value="tomb.lua" />
<movevent type="StepIn" actionid="271" event="script" value="tomb.lua" />
yeaaaaaaah your script was the only one in whole forums and others that works thanks mate u great for this communityMy 4 years old script.
Make 2 flames, one (action id 270) what requires scarab coin on specific place ex basin (can be any item, even floor) to teleport to dungeon, and second one (action id 271) what teleports back.
Used it in movements: tomb.lua
Code:function onStepIn(cid, item, position, fromPosition) local tileActionID = 270 local tileActionIDBack = 271 local coin = 2159 local teleportTo = {x=391, y=384, z=13} local teleportBack = {x=442, y=232, z=11} local itemPosition = {x=441, y=233, z=11, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE} local getItem = getThingFromPos(itemPosition) if isPlayer(cid) == TRUE then if item.itemid == 1397 and item.actionid == tileActionID then if getItem.itemid == coin then doRemoveItem(getItem.uid, 1) doTeleportThing(cid, teleportTo) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT) doSendMagicEffect(itemPosition, 15) end elseif item.itemid == 1397 and item.actionid == tileActionIDBack then doTeleportThing(cid, teleportBack) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT) end end return TRUE end
movements.xml add:
Code:<movevent type="StepIn" actionid="270" event="script" value="tomb.lua" /> <movevent type="StepIn" actionid="271" event="script" value="tomb.lua" />
local tileActionID = 270
local tileActionIDBack = 271
local coin = 2159
local teleportTo = {x=391, y=384, z=13}
local teleportBack = {x=442, y=232, z=11}
local itemPosition = {x=441, y=233, z=11, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return false
end
local getItem = getThingfromPos(itemPosition)
if item.itemid == 1397 and item.actionid == tileActionID then
if getItem.itemid == coin then
doRemoveItem(getItem.uid, 1)
doTeleportThing(player.uid, teleportTo)
doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
doSendMagicEffect(itemPosition, 15)
end
elseif item.itemid == 1397 and item.actionid == tileActionIDBack then
doTeleportThing(player.uid, teleportBack)
doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
end
return true
end
Why?Lua:local tileActionID = 270 local tileActionIDBack = 271 local coin = 2159 local teleportTo = {x=391, y=384, z=13} local teleportBack = {x=442, y=232, z=11} local itemPosition = {x=441, y=233, z=11, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE} function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return false end local getItem = getThingFromPos(itemPosition) if item.itemid == 1397 and item.actionid == tileActionID then if getItem.itemid == coin then doRemoveItem(getItem.uid, 1) doTeleportThing(player.uid, teleportTo) doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT) doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT) doSendMagicEffect(itemPosition, 15) end elseif item.itemid == 1397 and item.actionid == tileActionIDBack then doTeleportThing(player.uid, teleportBack) doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT) doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT) end return true end
local player = creature:getPlayer()
function onStepIn(creature, item, position, fromPosition)
if not creature:isPlayer() then
return false
end
local tileActionID = 270
local tileActionIDBack = 271
local coin = 2159
local teleportTo = {x=391, y=384, z=13}
local teleportBack = {x=442, y=232, z=11}
local itemPosition = {x=441, y=233, z=11, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
function onStepIn(creature, item, position, fromPosition)
if not creature:isPlayer() then
return false
end
local getItem = getThingFromPos(itemPosition)
if item.itemid == 1397 and item.actionid == tileActionID then
if getItem.itemid == coin then
doRemoveItem(getItem.uid, 1)
doTeleportThing(creature.uid, teleportTo)
doSendMagicEffect(creature:getPosition(), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
doSendMagicEffect(itemPosition, 15)
end
elseif item.itemid == 1397 and item.actionid == tileActionIDBack then
doTeleportThing(creature.uid, teleportBack)
doSendMagicEffect(creature:getPosition(), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
end
return true
end
local player = creature:getPlayer()
local tileActionID = 270
local tileActionIDBack = 271
local coin = 2159
local teleportTo = {x = 1040, y = 1026, z = 7}
local teleportBack = {x = 1036, y = 1026, z = 7}
local itemPosition = {x = 1037, y = 1025, z = 7, stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
local flameId = 1397
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player or item.itemid ~= flameId then
return false
end
local getItem = getThingfromPos(itemPosition)
if item.actionid == tileActionID then
if getItem.itemid == coin then
doRemoveItem(getItem.uid, 1)
doTeleportThing(player.uid, teleportTo)
doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
doSendMagicEffect(itemPosition, 15)
end
elseif item.actionid == tileActionIDBack then
doTeleportThing(player.uid, teleportBack)
doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_TELEPORT)
end
return true
end
<movevent event="StepIn" fromaid="270" toaid = "271" script="yourScript.lua" />