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

Solved How to insert a drop item in teleport script

mano368

Senior Support Team Member
Staff member
Support Team
Joined
Sep 2, 2011
Messages
646
Solutions
46
Reaction score
296
Location
Brazil
How to add an additem or something like to teleport items thrown in the teleport to another position?

Here's the script:
Lua:
local Teleport = MoveEvent()
function Teleport.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    local potItem = Tile(Position(33145, 32862, 7)):getItemById(2562)
    if not potItem then
        player:teleportTo(fromPosition, true)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        return true
    end

    player:teleportTo(Position(33151, 32864, 7))
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    return true
end
Teleport:uid(1000)
Teleport:register()
Post automatically merged:

Done using position to register the event:
Lua:
local TeleportItem = MoveEvent()
function TeleportItem.onAddItem(moveitem, tileitem, position)
    moveitem:moveTo(Position(33147, 32864, 7))
    position:sendMagicEffect(CONST_ME_TELEPORT)
    return true
end
TeleportItem:position({x = 33148, y = 32864, z = 7})
TeleportItem:register()
 
Last edited:
Back
Top