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

Make 2 teleports after monster dead

Simon Here

不要直视陌生人的
Joined
Jun 2, 2012
Messages
397
Reaction score
395
Location
France/Poland
Hello.
Today i want just a simple script for :

- > Do 2 teleports after "x" monster dead

- > Time to enter to the teleport 30 sec

- > 1 teleport will be good but the second will be wrong = instant dead if you enter to the wrong tp

It's all i think, thanks if someone will help cya
 
Code:
local config = {
     ["monstername"] = {
       time = 10,
       tps = {
         {toPos = {x = 95, y = 120, z = 7}, tpPos = {x = 94, y = 115, z = 7}},
         {toPos = {x = 95, y = 125, z = 7}, tpPos = {x = 95, y = 114, z = 7}}
       }
     }
}
local function deleteTeleport(pos)
     for x = 1, #pos do
         local teleport = getTileItemById(pos[x].tpPos, 1387).uid
         if teleport > 0 then
             doRemoveItem(teleport)
             doSendMagicEffect(pos[x].tpPos, CONST_ME_POFF)
         end
     end
     return true
end

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

     if isPlayer(target) or not monster then
         return true
     end
   
     for x = 1, #monster.tps do
         doCreateTeleport(1387, monster.tps[x].toPos, monster.tps[x].tpPos)
     end
     doCreatureSay(cid, "You have "..monster.time.." seconds to enter the teleport!", TALKTYPE_ORANGE_1)
     addEvent(deleteTeleport, monster.time * 1000, monster.tps)
     return true
end
Should it get tped somewhere where the player dies or should it die there? Should the tp be removed after someone died?
 
Code:
local config = {
     ["monstername"] = {
       time = 10,
       tps = {
         {toPos = {x = 95, y = 120, z = 7}, tpPos = {x = 94, y = 115, z = 7}},
         {toPos = {x = 95, y = 125, z = 7}, tpPos = {x = 95, y = 114, z = 7}}
       }
     }
}
local function deleteTeleport(pos)
     for x = 1, #pos do
         local teleport = getTileItemById(pos[x].tpPos, 1387).uid
         if teleport > 0 then
             doRemoveItem(teleport)
             doSendMagicEffect(pos[x].tpPos, CONST_ME_POFF)
         end
     end
     return true
end

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

     if isPlayer(target) or not monster then
         return true
     end
  
     for x = 1, #monster.tps do
         doCreateTeleport(1387, monster.tps[x].toPos, monster.tps[x].tpPos)
     end
     doCreatureSay(cid, "You have "..monster.time.." seconds to enter the teleport!", TALKTYPE_ORANGE_1)
     addEvent(deleteTeleport, monster.time * 1000, monster.tps)
     return true
end
Should it get tped somewhere where the player dies or should it die there? Should the tp be removed after someone died?


Thanks Limos
ill try it later when ill get compiled source ( i got 1 hard error in game.cpp fixed already ;p )
 
Back
Top