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

Movements - teleport and monsters

seyakuroya

DevlandOT.eu
Joined
Dec 21, 2008
Messages
711
Solutions
1
Reaction score
411
Hello!

I need one script:

When player step on X action.id then create teleport for x time , and 2 monsters.

Thanks for help!
 
Code:
<moveevent event="StepIn" actionid="1234" tileitem="1" script="xxxx.lua" />

Code:
creaturepos = { x = 343, y = 87, z = 14 }
creaturepos1 = { x = creaturepos.x + 2, y = creaturepos.y - 1, z = creaturepos.z }
creaturepos2 = { x = creaturepos.x + 2, y = creaturepos.y + 1, z = creaturepos.z }
tppos = { x = 343, y = 87, z = 14 }
tpdestinationpos = { x = 343, y = 87, z = 14 }


function onStepIn(cid, item, pos)
    if item.actionid == 1234 then
        doSummonCreature("Demon", creaturepos1) 
        doSummonCreature("Demon", creaturepos2) 
        teleportObj = doCreateTeleport(1387, tpdestinationpos, tppos)
        addEvent(onXMinutes, 2*60*1000) --2minutes
    end
    return true
end

function onXMinutes()
    doRemoveItem(teleportObj.uid, 1)
end

I'm not sure it will work, but it is a good start.
 
movement.xml
Code:
<movevent event="StepIn" actionid="5000" script="script.lua"/>

movement/scripts/name.lua
Code:
local config = {
   createPos = {x=32368,y=32206,z=7}, -- Position where the teleport will be created
   teleportTo = {x=32375,y=32207,z=7}, -- Position where the player will be teleport to
   teleporterClose = 30 -- in second
}

local monsters = {
   name1 = "Demon", -- creature 1 name
   pos1 = {x=32367,y=32206,z=7}, -- creature 1 spawn position
   name2 = "Demon", -- creature 2 name
   pos2 = {x=32369,y=32206,z=7} -- creature 2 spawn position
}

local function removeTeleporter()
   local teleporter = getTileItemById(config.createPos,1387).uid
   if teleporter ~= 0 then
    doRemoveItem(teleporter)
   end
end

function onStepIn(cid, item, pos)
   doCreateTeleport(1387, config.teleportTo, config.createPos)
   doCreateMonster(monsters.name1, monsters.pos1)
   doCreateMonster(monsters.name2, monsters.pos2)
   addEvent(removeTeleporter, config.teleporterClose*1000)
   return true
end

edit:
updated because the request was for a script that needed a timer for removing the teleporter
 
Last edited:
Code:
local config = {
   createPos = {x=32368,y=32206,z=7}, -- Position where the teleport will be created
   teleportTo = {x=32375,y=32207,z=7}, -- Position where the player will be teleport to
   teleporterClose = 30 -- in second
}

local monsters = {
   name1 = "Demon", -- creature 1 name
   pos1 = {x=32367,y=32206,z=7}, -- creature 1 spawn position
   name2 = "Demon", -- creature 2 name
   pos2 = {x=32369,y=32206,z=7} -- creature 2 spawn position
}

local function removeTeleporter()
   local teleporter = getTileItemById(config.createPos,1387).uid
   if teleporter ~= 0 then
    doRemoveItem(teleporter)
    doItemSetAttribute(item, 'aid', 5000)
   end
end

function onStepIn(cid, item, pos)
   doCreateTeleport(1387, config.teleportTo, config.createPos)
   doCreateMonster(monsters.name1, monsters.pos1)
   doCreateMonster(monsters.name2, monsters.pos2)
   doItemSetAttribute(item, 'aid', 5001)
   addEvent(removeTeleporter, config.teleporterClose*1000)
   return true
end
 
Back
Top