• 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 How to kill a "boss" and make a teleport appear?

gerard95

Keep cool :)
Joined
Dec 31, 2011
Messages
276
Reaction score
16
I tried everything and I searched for many scripts and stuff but nothing seems to work.
I have TFS 2.6 and the server is 8.6.

Someone got already the script for this TFS version or have any clue to fix it?

Thank you a lot! <3
 
PHP:
local config = {
timeToRemove = 120, -- seconds
message = "TELEPORT HAS BEEN OPENED FOr 120 SECONDS",
teleportId = 9773,
bosses = { -- Monster Name, Teleport Position
["MONSTER NAME"] = {  pos={ x=POS , y= OF , z=TELEPORT, stackpos=1 }, aid=1001 },
},
local function removal(position)
doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
return TRUE
end

function onKill(cid, target, lastHit)
if(config.bosses[getCreatureName(target)]) then
local t = config.bosses[getCreatureName(target)]
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)
return TRUE
end
return TRUE
end


movements

PHP:
local config = {
bosses={---aid of portal, position where it sends, value it sets, text it shows
[1001] = {pos={x=210, y=1991, z=7, stackpos=1}, value=1, text="Entered the Cave"},

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) == TRUE then
if(config.bosses[item.actionid]) then
local t= config.bosses[item.actionid]
if getPlayerStorageValue(cid, config.storage)< t.value then
setPlayerStorageValue(cid, config.storage, t.value)
end
doTeleportThing(cid, t.pos)
doSendMagicEffect(getCreaturePosition(cid),10)
doCreatureSay(cid,t.text,TALKTYPE_ORANGE_1)
elseif(config.mainroom[item.actionid]) then
local t= config.mainroom[item.actionid]
if getPlayerStorageValue(cid, config.storage)>=t.value then
doTeleportThing(cid, t.pos)
doSendMagicEffect(getCreaturePosition(cid),10)
doCreatureSay(cid,t.text,TALKTYPE_ORANGE_1)
else
doTeleportThing(cid, fromPosition)
doSendMagicEffect(getCreaturePosition(cid),10)
doCreatureSay(cid, 'You don\'t have enough energy to enter this portal', TALKTYPE_ORANGE_1)
end
elseif(config.portals[item.actionid]) then
local t= config.portals[item.actionid]
doTeleportThing(cid, t.pos)
doSendMagicEffect(getCreaturePosition(cid),10)
doCreatureSay(cid,t.text,TALKTYPE_ORANGE_1)
end
end
end
 
Try this
Code:
local config = {
   ["bossname"] = {time = 60, toPos = {x = 100, y = 100, z = 7}, tpPos = {x = 100, y = 100, z = 7}}
}
local function deleteTeleport(tp)
   local teleport = getTileItemById(tp, 1387).uid
   if(teleport > 0) then
     doRemoveItem(teleport)
     doSendMagicEffect(tp, CONST_ME_POFF)
   end
   return true
end

function onKill(cid, target)
   local monster = config[getCreatureName(target):lower()]

   if(isPlayer(target) or not monster) then
     return true
   end
   doCreateTeleport(1387, monster.toPos, monster.tpPos)
   doCreatureSay(cid, "You have "..monster.time.." seconds to enter the teleport!", TALKTYPE_ORANGE_1)
   addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
   return true
end

Don't forget to register the name in login.lua and the bossname should be without capitals.
 
creaturescripts.xml
Code:
<event type="kill" name="CreateTeleport" script="createteleport.lua"/>

login.lua
Code:
registerCreatureEvent(cid, "CreateTeleport")
 
Damn lua always
Code:
Lua Error: not working..
getting it all the damn time.

Show us your setup and don't make us solve riddles. You probably added something in the wrong place if no errors show up.
 
Hahahaha yeah lol, stupid of me. Sorry, but I just wrote the same thing Limos told me. Just changed the pos...

At data/creaturescripts/scripts/(Lua called createteleport)
Lua:
local config = {
   ["Morgaroth"] = {time = 60, toPos = {x = 31561, y = 31789, z = 8}, tpPos = {x = 31608, y = 31780, z = 8}}
}
local function deleteTeleport(tp)
   local teleport = getTileItemById(tp, 1387).uid
   if(teleport > 0) then
     doRemoveItem(teleport)
     doSendMagicEffect(tp, CONST_ME_POFF)
   end
   return true
end

function onKill(cid, target)
   local monster = config[getCreatureName(target):lower()]

   if(isPlayer(target) or not monster) then
     return true
   end
   doCreateTeleport(1387, monster.toPos, monster.tpPos)
   doCreatureSay(cid, "You have "..monster.time.." seconds to enter the teleport!", TALKTYPE_ORANGE_1)
   addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
   return true
end

creaturescripts.xml
Lua:
<event type="kill" name="CreateTeleport" script="createteleport.lua"/>

login.lua
Lua:
registerCreatureEvent(cid, "CreateTeleport")
 
["Orschabal"] = {time = 120, toPos = {x = 32269, y = 32026, z = 13}, tpPos = {x = 32277, y = 32026, z = 13}}

I need this Script too.
But what i need to fill in the Coordinates ?

Where the Tp should appear or where the Orschabal is ??
Or what ? :D
 
The Script wont work for me...
After i kill the Orshabaal no Teleporter appears.
Whats wrong bro ? :D
Code:
local config = {
["Orshabaal"] = {time = 60, toPos = {x = 32273, y = 32051, z = 13}, tpPos = {x = 32277, y = 32026, z = 13}}
}
local function deleteTeleport(tp)
local teleport = getTileItemById(tp, 1387).uid
if(teleport > 0) then
doRemoveItem(teleport)
doSendMagicEffect(tp, CONST_ME_POFF)
end
return true
end

function onKill(cid, target)
local monster = config[getCreatureName(target):lower()]

if(isPlayer(target) or not monster) then
return true
end
doCreateTeleport(1387, monster.toPos, monster.tpPos)
doCreatureSay(cid, "You have "..monster.time.." seconds to enter the teleport!", TALKTYPE_ORANGE_1)
addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
return true
end
 
PHP:
local config = {timeToRemove = 120, -- seconds
message = "TELEPORT HAS BEEN OPENED FOr 120 SECONDS",teleportId = 9773,bosses = { -- Monster Name, Teleport Position["MONSTER NAME"] = { pos={ x=34555, y= 34535, z=43535 , stackpos=1 }, aid=1001 },
},local function removal(position)
doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
return TRUE
end
function onKill(cid, target, lastHit)
if(config.bosses[getCreatureName(target)]) then
local t = config.bosses[getCreatureName(target)]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)
return TRUE
end
return TRUE
end

use this one
 
Last edited:
Like this ? :D

Monster = Orshabaal Where the Tp should tp a Player = {x = 32273, y = 32051, z = 13} Where the Tp should appear = {x = 32277, y = 32026, z = 13}}
Please fill in for me... Today is not my day :D
Im really new so sry for that :D

Dont works...

Code:
 local config = {timeToRemove = 120, -- seconds
message = "TELEPORT HAS BEEN OPENED FOr 120 SECONDS",teleportId = 1387 ,bosses = --{Monster Name, Teleport Position["Orshabaal"] = { pos={ x=32277, y= 32026, z=13 , stackpos=1 }, aid=1001 },
},local function removal(position)
doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
return TRUE
end
function onKill(cid, target, lastHit)
if(config.bosses[getCreatureName(target)]) then
local t = config.bosses[getCreatureName(target)]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)
return TRUE
end
return TRUE
end
 
Monster name in my script should be > without capitals <.
Code:
local config = { 
["orshabaal"] = {time = 60, toPos = {x = 32273, y = 32051, z = 13}, tpPos = {x = 32277, y = 32026, z = 13}} 
}
So orshabaal instead of Orshabaal, no capitals.


Code:
time = time in seconds for the teleport to be removed
toPos = the position people get teleported to when they step in the teleport
tpPos = position where the teleport will be created


Show what you changed and how you added it.
 
Last edited:
Thanks for this script it works for me!! I have a question. If I want to make another 2 of this script. All I have to do is change the name to like createteleport2 and in creaturescripts just say the name is createteleport2 or do i also have to add a new
registerCreatureEvent(cid, "CreateTeleport") in login.lua?
 
Back
Top