• 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 Help me? Lua simple question

Discovery

Developing myself
Joined
Apr 16, 2010
Messages
562
Solutions
11
Reaction score
261
Location
Neverland
I need:

Teleport will be created on top of the monster..

SOLVED
LUA:
local tpId = 1387
local tps = {
    ["Ultimate Dragon"] = {toPos = {x=4492, y=4518, z=7}, time = 360},
}
 
function removeTp(pos)
    local t = getTileItemById(pos, tpId)
    if t.uid > 0 then
        doRemoveItem(t.uid)
        doSendMagicEffect(pos, CONST_ME_POFF)
    end
end
 
function onDeath(cid)
    local tp = tps[getCreatureName(cid)]
    if tp then
        doCreateTeleport(tpId, tp.toPos, getThingPos(cid))
        doCreatureSay(cid, "Enter now! "..tp.time.." seconds.", TALKTYPE_ORANGE_1)
        addEvent(removeTp, tp.time*1000, getThingPos(cid))
    end
    return TRUE
end
 
Last edited:
Yes I am pretty sure that is what the console says:
[22:17:09.838] Description:
[22:17:09.839] file.lua:5: no, I had enough of printing errors all day sir!
 
I change tp.pos for getThingPos(cid)

Look:

local tpId = 1387
local tps = {
["Ultimate Dragon"] = {pos = {HERE}, toPos = {x=767, y=52, z=7}, time = 3600},
}

function removeTp(tp)
local t = getTileItemById(getThingPos(cid), tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tp.pos, CONST_ME_POFF)
end
end

function onDeath(cid)
local tp = tps[getCreatureName(cid)]
if tp then
doCreateTeleport(tpId, tp.toPos, getThingPos(cid))
doCreatureSay(cid, "Enter now! "..tp.time.." segundos.", TALKTYPE_ORANGE_1)
addEvent(removeTp, tp.time*1000, tp)
end
return TRUE
end
 
What happens? Any errors? Try to be a little more helpful so that we can help you too.

EDIT: And when you make scripts, please, put them between
LUA:
 tags, Like this:

[code=lua]
function onSay()
    return true
end
 
Last edited:
LUA:
local tpId = 1387
local tps = {
["Ultimate Dragon"] = {pos = {HERE}, toPos = {x=4492, y=4518, z=7}, time = 360},
}

function removeTp(tp)
local t = getTileItemById(getThingPos(cid), tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tp.pos, CONST_ME_POFF)
end
end

function onDeath(cid)
local tp = tps[getCreatureName(cid)]
if tp then
doCreateTeleport(tpId, tp.toPos, getThingPos(cid))
doCreatureSay(cid, "Enter now! "..tp.time.." segundos.", TALKTYPE_ORANGE_1)
addEvent(removeTp, tp.time*1000, tp)
end
return TRUE
end



Dont have erros in console. This script dont teleport ToPos... and not remove Teleport after seconds..
 
Last edited by a moderator:
LUA:
local tpId = 1387
local tps = {
    ["Ultimate Dragon"] = {toPos = {x=4492, y=4518, z=7}, time = 360},
}
 
function removeTp(pos)
    local t = getTileItemById(pos, tpId)
    if t.uid > 0 then
        doRemoveItem(t.uid)
        doSendMagicEffect(pos, CONST_ME_POFF)
    end
end
 
function onDeath(cid)
    local tp = tps[getCreatureName(cid)]
    if tp then
        doCreateTeleport(tpId, tp.toPos, getThingPos(cid))
        doCreatureSay(cid, "Enter now! "..tp.time.." seconds.", TALKTYPE_ORANGE_1)
        addEvent(removeTp, tp.time*1000, getThingPos(cid))
    end
    return TRUE
end

Use lua tags and post the errors lol
 
Back
Top