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

Tp with storage value and summons monster OTX 2.9

arael

New Member
Joined
Jun 11, 2014
Messages
7
Reaction score
0
Hello guys, I wanted an script of a teleport that moves the player to X , spawns a monster (that monster depends on a storage value with a table and deletes the storage value of the player) some steps foward the player, meanwhile that same tp dont let other players to get there.

I leave you here a little example if you dont understand me
-----------------------------------------------------------
local Table:
[1] storagevalue 1, 1 = "monster name" then -1 to storage value 1, 1
[1] storagevalue 2, 1 = "monster name" then -1 to storage value 2, 1

onstep move player to pos X then check storagevalue table and summoncreature inpos X if creature is summond block teleport for X time to other players
-----------------------------------------------------------
thx guys and sorry if my english is bad.
 
Solution
For each STORAGE you have specified monster and the room. After 60 seconds room is again available, if player or monster still is in, will be teleported out or killed (monster). If someone is in the room or just died in, the room will available after 60 seconds, you no need to use "stone" option, cause teleport will not work till this time.
in config:
[storage] = {monster name, monster position, where player will tp, room from, room to}
Lua:
--Script made by GarQet--
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   local config = {
       monsters = {
           [11111] = {"Dragon", {x = 1000, y = 1000, z = 7}, {x = 1020, y = 1000, z = 7}, {x = 1030, y = 1030, z = 7}, {x = 900, y = 900, z = 7}}...
For each STORAGE you have specified monster and the room. After 60 seconds room is again available, if player or monster still is in, will be teleported out or killed (monster). If someone is in the room or just died in, the room will available after 60 seconds, you no need to use "stone" option, cause teleport will not work till this time.
in config:
[storage] = {monster name, monster position, where player will tp, room from, room to}
Lua:
--Script made by GarQet--
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   local config = {
       monsters = {
           [11111] = {"Dragon", {x = 1000, y = 1000, z = 7}, {x = 1020, y = 1000, z = 7}, {x = 1030, y = 1030, z = 7}, {x = 900, y = 900, z = 7}},
           [11112] = {"Cat", {x = 1010, y = 1000, z = 7}, {x = 1020, y = 1000, z = 7}, {x = 1030, y = 1030, z = 7}, {x = 900, y = 900, z = 7}},
           [11113] = {"Dragon Lord", {x = 1020, y = 1000, z = 7}, {x = 1020, y = 1000, z = 7}, {x = 1030, y = 1030, z = 7}, {x = 900, y = 900, z = 7}}
       },
       duration = 60,
       kick_pos = {x = 1010, y = 1000, z = 7}
   }
   for storage, info in pairs(config.monsters) do
       if getPlayerStorageValue(cid, storage) >= 1 and (os.time() - getGlobalStorageValue(storage)) >= config.duration then
           doTeleportThing(cid, info[3])
           doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
           doCreateMonster(info[1], info[2])
           doSendMagicEffect(info[2], CONST_ME_TELEPORT)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your enemy is ".. info[1] ..".")
           setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) - 1)
           setGlobalStorageValue(storage, os.time())
           addEvent(function()
               local fromp, top = info[4], info[5]
               for x = fromp.x, top.x do
                   for y = fromp.y, top.y do
                       for z = fromp.z, top.z do
                           local creature = getThingFromPos(areapos).uid
                           if isPlayer(creature) then
                               doTeleportThing(creature, config.kick_pos)
                               doSendMagicEffect(creature, CONST_ME_TELEPORT)
                               doPlayerSendTextMessage(creature, MESSAGE_INFO_DESCR, "You have been kicked out, the time expired.")
                           end
                           if isMonster(creature) then
                               doRemoveCreature(creature, true)
                           end
                       end
                   end
               end
           end, 1000 * config.duration)
       else
           doPlayerSendCancel(cid, "Someone else is in the room.")
           doTeleportThing(cid, fromPosition)
           doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
           return true
       end
   end
   doTeleportThing(cid, fromPosition)
   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   return true
end
 
Last edited:
Solution
Back
Top