Hello, I am facing a strange problem.
I made this script to create a teleport somewhere when the boss is died in a range.
The Problem : It's working for one of them and not working on other.
I think the problem is that because there is two duplicated items in table but I don't know how to fix.
It must be the same monster in 2 places.
Hope you help me.
I made this script to create a teleport somewhere when the boss is died in a range.
The Problem : It's working for one of them and not working on other.
Code:
local questsMonsters =
{
["demon lord"] = {start_pos=Position(1202, 3272, 7), end_pos=Position(1212, 3282, 7), tpitem, actionid=25001, tp_pos=Position(1204, 3275, 7), interval=30000},
["demon lord"] = {start_pos=Position(7665, 9280, 0), end_pos=Position(7698, 9304, 0), tpitem, actionid=25005, tp_pos=Position(7678, 9296, 0), interval=120000},
}
local f
function onKill(cid, target)
local player = Player(cid)
if questsMonsters[target:getName():lower()] then
local m = questsMonsters[target:getName():lower()]
if(inRangeOfPos(m.start_pos, player:getPosition(), m.end_pos)) then
player:say("Teleport has been created, it will be removed after "..(m.interval/1000).." seconds. So go enter it fast", TALKTYPE_MONSTER_SAY, false, player, player:getPosition())
m.tpitem = Game.createItem(5023, 1, m.tp_pos)
m.tpitem:setActionId(m.actionid)
f = m
addEvent(removeteleport, m.interval)
end
end
return true
end
function removeteleport()
f.tpitem:remove()
end
I think the problem is that because there is two duplicated items in table but I don't know how to fix.
It must be the same monster in 2 places.
Hope you help me.
Last edited: