• 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 CreatureEvents -> Teleport Player after 15 seconds.

tavax

New Member
Joined
Apr 29, 2009
Messages
17
Reaction score
2
Hello,

This is my scripit \/

Code:
function onDeath(cid, corpse, killer)

local Ppos = {x = 33327, y = 31589, z = 14} 
local time_to_pass = 15 -- in seconds

local monstName = "Domnion"  
               
                if isMonster(cid) then
                        if string.lower(getCreatureName(cid)) == string.lower(monstName) then
                        local char = killer[1]
                          doCreatureSay(cid, "You have 15 seconds to get your loot.", TALKTYPE_ORANGE_1)
                            addEvent(removeTeleport, (1000*time_to_pass))
                        end
                end
        return TRUE
end
       
function removeTeleport()
doTeleportThing(char, Ppos)
return TRUE
end

Player kill a mob and after 15 second he will be teleport.

Code:
[17:0:59.161] [Error - CreatureScript Interface]
[17:0:59.161] In a timer event called from:
[17:0:59.162] data/creaturescripts/scripts/chest\chestdh.lua:onDeath
[17:0:59.162] Description:
[17:0:59.162] attempt to index a nil value
[17:0:59.163] stack traceback:
[17:0:59.163]  [C]: in function 'doTeleportThing'
 
Code:
local function removeTeleport(killer, Ppos)
    doTeleportThing(killer, Ppos)
    return TRUE
end


function onDeath(cid, corpse, killer)

local Ppos = {x = 33327, y = 31589, z = 14}
local time_to_pass = 15 -- in seconds
local monstName = "Domnion"
            
    if isMonster(cid) then
        if string.lower(getCreatureName(cid)) == string.lower(monstName) then
          doCreatureSay(cid, "You have 15 seconds to get your loot.", TALKTYPE_ORANGE_1)
            addEvent(removeTeleport, (1000*time_to_pass), killer, Ppos)
        end
    end
    return TRUE
end
 
Thanks for your help but still dont working =/

Code:
[17:36:12.990] [Error - CreatureScript Interface]
[17:36:12.990] In a timer event called from:
[17:36:12.991] data/creaturescripts/scripts/chest\chestdh.lua:onDeath
[17:36:12.991] Description:
[17:36:12.991] (luaDoTeleportThing) Thing not found


I can fix the problem.... Thanks for help your scripit help me =) Rep+
 
Last edited:
Please post the solved script?
try this
Code:
local Ppos = {x = 33327, y = 31589, z = 14}
local time_to_pass = 15 -- in seconds
local monstName = "Domnion"

local function removeTeleport(killer)
    doTeleportThing(killer, Ppos)
    return TRUE
end


function onDeath(cid, corpse, killer)
    if isMonster(cid) then
        if string.lower(getCreatureName(cid)) == string.lower(monstName) then
            doCreatureSay(cid, "You have 15 seconds to get your loot.", TALKTYPE_ORANGE_1)
            addEvent(removeTeleport, 1000*time_to_pass, killer)
        end
    end
    return TRUE
end
 
Back
Top