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

Boss tp

mmheo

New Member
Joined
Sep 14, 2017
Messages
157
Reaction score
1
when kill monster tp don't appear no error in console
tfs 0.4
Code:
function onKill(cid, target)
    local m = {
        ["Orc"] = {
            message = "25 seconds to escape through the teleport quickly before it closes!",
            cfg = {
                {
                    time = 25, -- Seconds until tp closes.
                    to = {x=1131,y=1105,z=7}, -- Where the tp takes you.
                    tp = {x=1124,y=1100,z=7} -- Where the tp creates.
                },
            }
        }
    }
    if isPlayer(target) then
        return true
    end
    local monster = m[getCreatureName(target)]
    if monster then
        for i = 1, #monster.cfg do
            local c = monster.cfg[i]
                local function deleteTeleport()
                local teleport = getTileItemById(c.tp, 1387).uid
                    if(teleport > 0) then
                        doRemoveItem(teleport)
                        doSendMagicEffect(c.tp, CONST_ME_POFF)
                    end
                    return true
                end
            doCreateTeleport(1387, c.to, c.tp)
            doSendMagicEffect(c.tp, CONST_ME_ENERGYAREA)
            addEvent(deleteTeleport, c.time * 1000)
        end
        doCreatureSay(cid, monster.message, TALKTYPE_ORANGE_1)
    end
    return true
end
 
1. use function onDeath instead onKill.
2. add this to every monster included in the script.
Lua:
<script>
    <event name="name from creaturescript.xml"/>
</script>

under </flags>
 
1. use function onDeath instead onKill.
2. add this to every monster included in the script.
Lua:
<script>
    <event name="name from creaturescript.xml"/>
</script>

under </flags>
same problem :S kill monster and tp not appear
and get this error
nosa2.png
 
Lua:
local m = {
    ["Orc"] = {
        message = "25 seconds to escape through the teleport quickly before it closes!",
        cfg = {
            time = 25, -- Seconds until tp closes.
            to = {x=1131,y=1105,z=7}, -- Where the tp takes you.
            tp = {x=1124,y=1100,z=7} -- Where the tp creates.
        }
    }
}

local function deleteTeleport(position)
    local tp = getTileItemById(position, 1387)
    if tp.uid > 0 then
        doRemoveItem(tp.uid)
        doSendMagicEffect(position, CONST_ME_POFF)
    end
end

function onKill(cid, target)
    if isPlayer(target) then
        return true
    end
    local monster = m[getCreatureName(target)]
    if monster then
        for k, v in pairs(monster.cfg) do
            addEvent(deleteTeleport, v.time * 1000, v.tp)
            doCreateTeleport(1387, v.to, v.tp)
            doSendMagicEffect(v.tp, CONST_ME_ENERGYAREA)
        end
        doCreatureSay(cid, monster.message, TALKTYPE_ORANGE_1)
    end
    return true
end
remove what he told you to add in monster xml and put this in your login.lua (make sure it's near the other registerCreatureEvent functions):
Lua:
registerCreatureEvent(cid, "event name from creaturescript xml")
 
Back
Top