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

Creating a teleport when two bosses are killed.

registerCreatureEvent(cid, "Inq")
<event type="kill" name="CreateTeleport" script="skylar and dom.lua"/>

:(

I put "CreateTeleport" where it says "Inq". But now when their health reaches zero their names disappear and they still attack the players.
 
Last edited:
You need to have return true above the last end.
This is my login.lua, I put this line with the other event registers:
Its the 3rd line starting from the end.
Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "5cc")
    registerCreatureEvent(cid, "10cc")
    registerCreatureEvent(cid, "remover")
    registerCreatureEvent(cid, "FirstItems")

    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "KilledMonstersCounter")
    registerCreatureEvent(cid, "Advance")
    registerCreatureEvent(cid, "demonOakLogout")
    registerCreatureEvent(cid, "demonOakDeath")
    registerCreatureEvent(cid, "VipCheck")
    registerCreatureEvent(cid, "CreateTeleport")  --This is where I put it
    return true
end
 
Switch the brother names so the brother name is not the same as the target name, also be sure you spelled the names correctly (use capitals if they have them, this script doesn't remove/add capitals from monster names).
 
Switch the brother names so the brother name is not the same as the target name, also be sure you spelled the names correctly (use capitals if they have them, this script doesn't remove/add capitals from monster names).

I changed the names and put them with proper capitals. But now as soon as one of them dies I get this:

Code:
[22/10/2013 22:11:54] [Error - CreatureScript Interface]
[22/10/2013 22:11:54] data/creaturescripts/scripts/skylar and dom.lua:onKill
[22/10/2013 22:11:54] Description:
[22/10/2013 22:11:54] (luaDoCreateItem) Tile not found

[22/10/2013 22:11:54] [Error - CreatureScript Interface]
[22/10/2013 22:11:54] data/creaturescripts/scripts/skylar and dom.lua:onKill
[22/10/2013 22:11:54] Description:
[22/10/2013 22:11:54] (luaDoItemSetAttribute) Item not found

I'm guessing the second one is a result of the script not being able to create the teleport. And as a result, when it tries to remove the tp after 120 seconds I get this:

Code:
[22/10/2013 22:11:54]
[22/10/2013 22:13:54] [Error - CreatureScript Interface]
[22/10/2013 22:13:54] In a timer event called from:
[22/10/2013 22:13:54] data/creaturescripts/scripts/skylar and dom.lua:onKill
[22/10/2013 22:13:54] Description:
[22/10/2013 22:13:54] (luaDoRemoveItem) Item not found
 
Try this.
Code:
local teleport = doCreateItem(config.teleportId, 1,  t.pos)

For actionid to teleport.
Code:
doItemSetAttribute(teleport, "aid", t.aid)


Although you can also just create a teleport with a position with doCreateTeleport, then you don't need a movement script.
 
Try this.
Code:
local teleport = doCreateItem(config.teleportId, 1,  t.pos)

For actionid to teleport.
Code:
doItemSetAttribute(teleport, "aid", t.aid)


Although you can also just create a teleport with a position with doCreateTeleport, then you don't need a movement script.

I'm still getting the error, what would I need to do not to use a movements script?
 
Change teleportId to 1387 and you can remove stackpos=1.
Code:
doCreateTeleport(config.teleportId, teleporttopos, t.pos)

Then instead of teleporttopos the position where the players should go to when they step in the teleport.
 
Change teleportId to 1387 and you can remove stackpos=1.
Code:
doCreateTeleport(config.teleportId, teleporttopos, t.pos)

Then instead of teleporttopos the position where the players should go to when they step in the teleport.

Where exactly do I put this? Here is my creaturescripts script

Code:
local config = {
  timeToRemove = 120, -- seconds
  message = "Take the teleporter or it will disappear",
  teleportId = 1387,  --9773
 
  brothers = {
    ["Dominique"] = {pos={ x=1457, y=852, z=2, stackpos=1 },aid=13050, brother = "Dominique"},
    ["Skylar"] = {pos={ x=1458, y=852, z=2, stackpos=1 },aid=13050, brother = "Skylar"},
  brothersArea = {
    fromPos = {x = 1457, y = 829, z = 2},
    toPos = {x = 1457, y = 837, z = 2}
    }
  }
}
local function removal(position)
        doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
    return true
end

function onKill(cid, target, lastHit)
    if(config.brothers[getCreatureName(target)]) then
        local t = config.brothers[getCreatureName(target)]
        local brother = getCreatureByName(t.brother)
        if(isMonster(brother) == true) then
        if(isInRange(getCreaturePosition(brother), config.brothers.brothersArea.fromPos, config.brothers.brothersArea.toPos) == true) then
    return true
end

else

local teleport = doCreateItem(config.teleportId, 1,  t.pos)

local position = t.pos
    doItemSetAttribute(teleport, 13050, t.aid)
    doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
    addEvent(removal, config.timeToRemove * 1000, position)
end
    return true
end 
    return true
end

Do I have to de-register the script in movements?
 
Replace this.
Code:
local teleport = doCreateItem(config.teleportId, 1,  t.pos)
doItemSetAttribute(teleport, 13050, t.aid)
With this (don't forget to change teleporttopos to the position people should go to when they step in the teleport).
Code:
doCreateTeleport(config.teleportId, teleporttopos, t.pos)
 
I get this error infinitely, and now one of the creatures will not die.

Code:
[22/10/2013 23:33:09] [Error - CreatureScript Interface]
[22/10/2013 23:33:09] data/creaturescripts/scripts/skylar and dom.lua:onKill
[22/10/2013 23:33:09] Description:
[22/10/2013 23:33:09] attempt to index a nil value
[22/10/2013 23:33:09] stack traceback:
[22/10/2013 23:33:09]    [C]: in function 'doCreateTeleport'
[22/10/2013 23:33:09]    data/creaturescripts/scripts/skylar and dom.lua:34: in function <data/creaturescripts/scripts/skylar and dom.lua:20>

Script:

Code:
local config = {
  timeToRemove = 120, -- seconds
  message = "Take the teleporter or it will disappear",
  teleportId = 1387,  --9773

  brothers = {
    ["Dominique"] = {pos={ x=1457, y=852, z=2, stackpos=1 },aid=13050, brother = "Dominique"},
    ["Skylar"] = {pos={ x=1458, y=852, z=2, stackpos=1 },aid=13050, brother = "Skylar"},
  brothersArea = {
    fromPos = {x = 1457, y = 829, z = 2},
    toPos = {x = 1457, y = 837, z = 2}
    }
  }
}
local function removal(position)
        doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
    return true
end

function onKill(cid, target, lastHit)
    if(config.brothers[getCreatureName(target)]) then
        local t = config.brothers[getCreatureName(target)]
        local brother = getCreatureByName(t.brother)
        if(isMonster(brother) == true) then
        if(isInRange(getCreaturePosition(brother), config.brothers.brothersArea.fromPos, config.brothers.brothersArea.toPos) == true) then
    return true
end

else



local position = t.pos
    doCreateTeleport(config.teleportId, teleporttopos, t.pos)
    doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
    addEvent(removal, config.timeToRemove * 1000, position)
end
    return true
end
    return true
end
 
A position is a table, so you have to add {}
Code:
{x = 1457, y = 829, z = 2}

Code:
doCreateTeleport(config.teleportId, {x = 1457, y = 829, z = 2}, t.pos)
 
A position is a table, so you have to add {}
Code:
{x = 1457, y = 829, z = 2}

Code:
doCreateTeleport(config.teleportId, {x = 1457, y = 829, z = 2}, t.pos)

ahh ok. But now I get this :(

Code:
[23/10/2013 00:02:08] [Error - CreatureScript Interface]
[23/10/2013 00:02:08] data/creaturescripts/scripts/skylar and dom.lua:onKill
[23/10/2013 00:02:08] Description:
[23/10/2013 00:02:08] (luaDoCreateTeleport) Tile not found

Dont you think maybe we should replace the "t.pos" with actual coordinates?
 
Back
Top