• 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!

Script to enter in Dl poi (avesta)

armyman

Member
Joined
Feb 15, 2014
Messages
318
Reaction score
13
anyone have this script? To enter in dl poi, if u have the "book" u get teleport after the mwall... And out
 
Solution
i got this error in console now

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/poh/enterpoi.lua:eek:nStepIn

LuaScriptInterface::luaDoTeleportThing(). Can not teleport thing.
Sorry. Was a noob mistake, and it took me like 15 minutes to find it. lmfao

here is updated, and another script.. which does the exact same thing, but scripted differently.
Lua:
local config = {
   book_id = 1976,
   tile_in = {x = 32793, y = 32330, z = 10}
}

function onStepIn(cid, item, position, fromPosition)

   -- teleport out
   if config.tile_in.x ~= position.x or config.tile_in.y ~= position.y or config.tile_in.z ~= position.z then
       doTeleportThing(cid, {x = position.x, y = position.y + 3, z = position.z})...
Lua:
function onStepIn(cid, item, pos)
    local BOOK_ID = 1970
    local ACTION_ID = 10201 -- Actionid of the tile that teleport you if you have the Holy Tible
   
    if (item.actionid == ACTION_ID) then
        if (getPlayerItemCount(cid, BOOK_ID) ~= 1) then
            doTeleportThing(cid, {x=32806, y=32359, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        else
            doTeleportThing(cid, {x=32791, y=32327, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        end
    end
    return TRUE
end
 
this script is working for enter... but i can't out now ;s
i put tha same actionid in 2 tiles, for enter and out?
Imgur: The most awesome images on the Internet

Lua:
function onStepIn(cid, item, pos)
    local BOOK_ID = 1976
    local ACTION_ID = 10201 -- Actionid of the tile that teleport you if you have the Holy Tible
   
    if (item.actionid == ACTION_ID) then
        if (getPlayerItemCount(cid, BOOK_ID) ~= 1) then
            doTeleportThing(cid, {x=32793, y=32330, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        else
            doTeleportThing(cid, {x=32793, y=32328, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        end
    end
    return TRUE
end
 
Lua:
function onStepIn(cid, item, pos)
    local BOOK_ID = 1970
    local ACTION_ID = 10201 -- Actionid of the tile that teleport you if you have the Holy Tible
  
    if (item.actionid == ACTION_ID) then
        if (getPlayerItemCount(cid, BOOK_ID) ~= 1) then
            doTeleportThing(cid, {x=32806, y=32359, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        else
            doTeleportThing(cid, {x=32791, y=32327, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        end
    end
    return TRUE
end
this script is working for enter... but i can't out now ;s
i put tha same actionid in 2 tiles, for enter and out?
Imgur: The most awesome images on the Internet

Lua:
function onStepIn(cid, item, pos)
    local BOOK_ID = 1976
    local ACTION_ID = 10201 -- Actionid of the tile that teleport you if you have the Holy Tible
  
    if (item.actionid == ACTION_ID) then
        if (getPlayerItemCount(cid, BOOK_ID) ~= 1) then
            doTeleportThing(cid, {x=32793, y=32330, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        else
            doTeleportThing(cid, {x=32793, y=32328, z=10})
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
        end
    end
    return TRUE
end


Guys please avoid using TRUE, use true insted xD
Also (if one of you wrote the script) why didn't you add spaces to the position table?
 
Watched a video, to make sure I was making it just like real tibia.
Although.. I'm going to assume that the holy tible is required to go both ways, in the effort to make sure players don't get trapped..
I've scripted it so players do not require the holy tible to leave, but require it to enter.

Put same AID on both tiles, just like your picture already has.
XML:
<movevent event="StepIn" actionid="10201" script="script_name.lua"/>
-- Edit
(This script is not functional. Look here, for a working script.)
-- Edit
Lua:
local config = {
   book_id = 1976,
   tile_in = {x = 32793, y = 32330, z = 10}
}

function onStepIn(cid, item, position, fromPosition)

   -- teleport out
   if config.tile_in.x ~= position.x and config.tile_in.y ~= position.y and config.tile_in.z ~= position.z then
       doTeleportThing(cid, {position.x, position.y + 3, position.z})
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
       return true
   end

   -- refuse entry
   if getPlayerItemCount(cid, config.book_id) < 1 then
       doTeleportThing(cid, fromPosition)
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
       return true
   end

   -- teleport in
   doTeleportThing(cid, {config.tile_in.x, config.tile_in.y - 3, config.tile_in.z})
   doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)

   return true
end
 
Last edited:
i got this error in console now

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/poh/enterpoi.lua:eek:nStepIn

LuaScriptInterface::luaDoTeleportThing(). Can not teleport thing.
 
i got this error in console now

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/poh/enterpoi.lua:eek:nStepIn

LuaScriptInterface::luaDoTeleportThing(). Can not teleport thing.
Sorry. Was a noob mistake, and it took me like 15 minutes to find it. lmfao

here is updated, and another script.. which does the exact same thing, but scripted differently.
Lua:
local config = {
   book_id = 1976,
   tile_in = {x = 32793, y = 32330, z = 10}
}

function onStepIn(cid, item, position, fromPosition)

   -- teleport out
   if config.tile_in.x ~= position.x or config.tile_in.y ~= position.y or config.tile_in.z ~= position.z then
       doTeleportThing(cid, {x = position.x, y = position.y + 3, z = position.z})
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
       return true
   end

   -- refuse entry
   if getPlayerItemCount(cid, config.book_id) < 1 then
       doTeleportThing(cid, fromPosition)
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
       return true
   end

   -- teleport in
   doTeleportThing(cid, {x = config.tile_in.x, y = config.tile_in.y - 3, z = config.tile_in.z})
   doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)

   return true
end
Lua:
local config = {
   book_id = 1976,
   tile_in = {x = 32793, y = 32330, z = 10}
}

function onStepIn(cid, item, position, fromPosition)

   local new_position = {x = 0, y = 0, z = 0}
   if config.tile_in.x ~= position.x or config.tile_in.y ~= position.y or config.tile_in.z ~= position.z then
       new_position = {x = position.x, y = position.y + 3, z = position.z}
   elseif getPlayerItemCount(cid, config.book_id) < 1 then
       new_position = fromPosition
   else
       new_position = {x = position.x, y = position.y - 3, z = position.z}
   end

   doTeleportThing(cid, new_position)
   doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)

   return true
end
 
Solution
Back
Top