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

I think this can work ! :)


In Creature Script make this. !

PHP:
local config = {
timeToRemove = 120, -- seconds
message = "Take the teleporter or it will disappear",
teleportId = 9773,
brothers ={
["NAME1"] = {pos={ x=254, y=1799, z=6, stackpos=1 },aid=1004, brother = "Name1"},
["NAME2"] = {pos={ x=254, y=1799, z=6, stackpos=1 },aid=1004, brother = "NAME2"},
brothersArea ={
                fromPos = {x = 243, y = 1787, z = 6},
                toPos = {x = 259, y = 1799, z = 6} } }
}
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, t.pos)
local position = t.pos
doItemSetAttribute(teleport, "aid", t.aid)
doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
addEvent(removal, config.timeToRemove * 1000, position)
end
return TRUE
end

and in movements you must make a script of the teleport with AID and the coords it sends you when it appears
 
Last edited:
I have no idea what I did really. I registered this in creaturescripts.xml and added "registerCreatureEvent(cid, "CreateTeleport")" to login.lua Like limos said in the other thread but I get this error:
Code:
[21/10/2013 02:13:57] [Error - CreatureScript Interface]
[21/10/2013 02:13:57] data/creaturescripts/scripts/login.lua
[21/10/2013 02:13:57] Description:
[21/10/2013 02:13:57] (luaRegisterCreatureEvent) Creature not found
[21/10/2013 02:13:57] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/skylar and dom.lua:33: 'end' expected (to close 'function' at line 17) near '<eof>'
[21/10/2013 02:13:57] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/skylar and dom.lua)
[21/10/2013 02:13:57] data/creaturescripts/scripts/skylar and dom.lua:33: 'end' expected (to close 'function' at line 17) near '<eof>'

If you could elaborate a bit more I would be very grateful.

And what do I do in movements? What must I do with an action id?

Thanks
 
I forgot to tell you

Creaturescript login.lua

add this

Code:
 registerCreatureEvent(cid, "Inq")

Try it now :)
PHP:
local config = {
timeToRemove = 120, -- seconds
message = "Take the teleporter or it will disappear",
teleportId = 9773,
brothers ={
["NAME1"] = {pos={ x=254, y=1799, z=6, stackpos=1 },aid=1004, brother = "Name1"},
["NAME2"] = {pos={ x=254, y=1799, z=6, stackpos=1 },aid=1004, brother = "NAME2"},
brothersArea ={
                fromPos = {x = 243, y = 1787, z = 6},
                toPos = {x = 259, y = 1799, z = 6} } }
}
local function removal(position)
doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
return TRUE
end
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, t.pos)
local position = t.pos
doItemSetAttribute(teleport, "aid", t.aid)
doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
addEvent(removal, config.timeToRemove * 1000, position)
end
return TRUE
end


In movements you must make a script with ActionID (AID) of the teleport which you create on your MAP ActionID 1002 example.


PHP:
function onStepIn(cid, item, pos)

local tam = {x = 1234, y = 1234, z = 7}

    if item.actionid == 1001 then
        doTeleportThing(cid,tam)
        doSendMagicEffect(getCreaturePosition(cid),17)
        local tp = doRemoveItem(item.uid, 1387)
        end
    return 1
end


local tam = Position where the TP should take the player
 
I forgot to tell you

Creaturescript login.lua

add this

Code:
 registerCreatureEvent(cid, "Inq")

Try it now :)
PHP:
local config = {
timeToRemove = 120, -- seconds
message = "Take the teleporter or it will disappear",
teleportId = 9773,
brothers ={
["NAME1"] = {pos={ x=254, y=1799, z=6, stackpos=1 },aid=1004, brother = "Name1"},
["NAME2"] = {pos={ x=254, y=1799, z=6, stackpos=1 },aid=1004, brother = "NAME2"},
brothersArea ={
                fromPos = {x = 243, y = 1787, z = 6},
                toPos = {x = 259, y = 1799, z = 6} } }
}
local function removal(position)
doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
return TRUE
end
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, t.pos)
local position = t.pos
doItemSetAttribute(teleport, "aid", t.aid)
doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
addEvent(removal, config.timeToRemove * 1000, position)
end
return TRUE
end


In movements you must make a script with ActionID (AID) of the teleport which you create on your MAP ActionID 1002 example.


PHP:
function onStepIn(cid, item, pos)

local tam = {x = 1234, y = 1234, z = 7}

    if item.actionid == 1001 then
        doTeleportThing(cid,tam)
        doSendMagicEffect(getCreaturePosition(cid),17)
        local tp = doRemoveItem(item.uid, 1387)
        end
    return 1
end


local tam = Position where the TP should take the player


Must I register the script in movements.xml?
 
And I get this error for this script

Code:
[21/10/2013 12:34:49] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/skylar and dom.lua:11: unexpected symbol near '}'
[21/10/2013 12:34:49] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/skylar and dom.lua)
[21/10/2013 12:34:49] data/creaturescripts/scripts/skylar and dom.lua:11: unexpected symbol near '}'

Code:
 local config = {
timeToRemove = 120, -- seconds
message = "Take the teleporter or it will disappear",
teleportId = 9773,
brothers ={
["dominique"] = {pos={ x=1457, y=852, z=2, stackpos=1 },aid=13050, brother = "dominique"},  --{x = 1457, y = 825, z = 2}
["skylar"] = {pos={ x=1458, y=852, z=2, stackpos=1 },aid=13050, brother = "skylar"},  --{x = 1458, y = 825, z = 2}
brothersArea ={
                fromPos = {x = 1457, y = 829, z = 2},
                toPos = {x = 1457, y = 837, z = 2}} } }  --{x = 1457, y = 837, z = 2}
}
local function removal(position)
doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
return TRUE
end
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, 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
 
Unexpected symbol :O maybe can help us to fix the script below?? I think this should work now since you messed it up :D

lol you messed up the script @dominique120

PHP:
local config = {
timeToRemove = 120, -- seconds
message = "Take the teleporter or it will disappear",
teleportId = 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
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, 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
 
Last edited:
Code:
 local config = {
timeToRemove = 120, -- seconds
message = "Take the teleporter or it will disappear",
teleportId = 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
--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, 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 
end

I fixed some missing ends and }, I dont get any errors in the console, but nothing happens when I kill them, an the teleport I placed in the map is still there.
 
Code:
local config = {
   timeToRemove = 120, -- seconds
   message = "Take the teleporter or it will disappear",
   teleportId = 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}
     }
   }
}
 
I'm looking over the thread but I think I'm missing this:

Code:
function onStepIn(cid, item, pos)

local tam = {x = 1234, y = 1234, z = 7}

    if item.actionid == 1001 then
        doTeleportThing(cid,tam)
        doSendMagicEffect(getCreaturePosition(cid),17)
        local tp = doRemoveItem(item.uid, 1387)
        end
    return 1
end

What do I do with it? and do I haveto put my AID in here in line 5?
 
this script is for movements make file in movements script folder and then add movements xml your script

you don't need to put tp on map it will spawn with the script that's why we make it item uid is your id
 
Yea i know.
But thx i already fixed the problem...
Forgott to put the coordinates
if item.actionid == ActionID then doTeleportThing(cid,Coordinates)

Forgott to change the Action ID and the Coordinates !

Works now thanks to all !
 
Code:
<movevent type="StepIn" actionid="XXXX" event="script" value="XXXXX.lua" />
 
Still not working, this is all that I did:

1. add "registerCreatureEvent(cid, "Inq")" to login.lua in creaturescripts
2. add this script in the creaturescripts script folder:

Code:
local config = {
  timeToRemove = 120, -- seconds
  message = "Take the teleporter or it will disappear",
  teleportId = 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
--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, 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 
end

3. add this to creature scripts.xml: "<event type="kill" name="CreateTeleport" script="skylar and dom.lua"/>"

4. Add this to movements.xml "<movevent type="StepIn" actionid="13050" event="script" value="dom and skylar.lua" />"

5. add this to the movements script folder:
Code:
function onStepIn(cid, item, pos)

local tam = {x = 1457, y = 837, z = 2}

    if item.actionid == 13050 then
        doTeleportThing(cid,tam)
        doSendMagicEffect(getCreaturePosition(cid),17)
        local tp = doRemoveItem(item.uid, 1387)
        end
    return 1
end
 
registerCreatureEvent(cid, "Inq")
<event type="kill" name="CreateTeleport" script="skylar and dom.lua"/>

:(
 
Back
Top