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

TFS 1.2 hunting room from old TFS

Verrine

Member
Joined
Mar 2, 2016
Messages
117
Reaction score
7
Hi
Im fighting with old script that doesnt want to work with TFS 1.2
here is script:
PHP:
function onStepIn(cid, item, pos, fromPosition)
   -- all credits for slave ots @ otland.net
   -- use the following AIDs
   -- for enter teleprot --> 55xx
   -- for exit teleprot --> 44xx
   -- for summon sqm --> 33xx
   --you can relocate this area valuis for empty storages
   local InRoom = 12345  -- for players only. keep the same in all scripts
   local Exhaust = 12346 -- for magic effects dont edit. keep the same for all scripts
   local onexit = 12347 -- when exit he maynot enter after 30 sec. keep it for all rooms
   local playerpos = getPlayerPosition(cid) -- player position for magic effects
   local onsummon = 12344  -- when player summon this makes exhauste
   local onsummontime = os.date("%S seconds", getPlayerStorageValue(cid, onsummon)  - os.time())  -- dont change
   local onexittime = os.date("%S seconds", getPlayerStorageValue(cid, onexit)  - os.time())  -- dont change
   --------------------------------------------------------------------------------------------------------------------
   -- all creadits to 7I7A and Admin Slave <$>
   local RoomID = 5501  --  55xx where xx = room id  for enter
   local ExitID =  4401  -- 44xx where xx = room id  for exit
   local SummonID =  3301  -- 33xx wher xx = room id for summon monster
   local reqcoins = 20 -- required coins to enter with id 6527
   local pos = {from = {x=32463, y=32462, z=7}, to = {x=32471, y=32470, z=7}}  -- for each room
   local exitpos = {x=32463, y=32472, z=7}  -- for each room
   local startpos = {x=32463, y=32462, z=7}  -- for each room
   local monsterpos = {x=32469, y=32468, z=7}  --on blood  -- for each room
   local teleportpos = {x=32467, y=32472, z=7}  -- enter teleport for timer
   local monster = 'Demon'  -- monster name , dont remove ''
   local xtime = 600000  -- 1 minutes  milleseconds / huntting
   local duration = 600  -- 10 minutes for exhaust storage . seconds
   local mon = Game.createMonster(param, monster)
   local mons = getSpectators(pos.from, pos.to)  -- check numbers of creatures in room
   --local mons = getCreatureInRange(mon, pos.from, pos.to, count)
   --------------- end of configs -----------
   ------------------
   -- summond sqm aid 33xx
   if item.actionid == SummonID then
     if isPlayer(cid) then 
       if getGlobalStorageValue(RoomID) > 0 and player:getStorageValue(onexitInRoom) == RoomID and getPlayerStorageValue(cid, Exhaust) > os.time() then
         -- this means that player have hunt time, if he haven't he will be kicked out
         if (table.maxn(mons) >= 1) then
           doSendMagicEffect(playerpos, 2)
           doPlayerSendCancel(cid, 'sorry, you monster is already summoned.')
           doTeleportThing(cid, fromPosition)
           return true
         else
           if getPlayerStorageValue(cid, onsummon) > os.time() then
             doPlayerSendCancel(cid, ' you must wait ' .. onsummontime .. ' before summon another monster.')
             doSendMagicEffect(playerpos, 2)
             doTeleportThing(cid, fromPosition)
             return 1
           -- missing an end here? -- Xikini
         else
           doTeleportThing(cid, exitpos)
           setPlayerStorageValue(cid, onexit, os.time()+30)
           doSendMagicEffect(exitpos, 10)
           setGlobalStorageValue(RoomID, -1)
           setPlayerStorageValue(cid, InRoom, -1)
           return true
         end
       return true
       end
     end
   end -- extra end here? -- Xikini
end
-------------------------------- enter teleprot
   if item.actionid == RoomID then
     if not isPlayer(cid) then
       return 1
     end
     if player:getStorageValue(cid, onexit) > os.time() then
       doPlayerSendCancel(cid, 'you must wait ' .. onexittime .. ' .')
       doTeleportThing(cid, fromPosition)
       return 1
     end
     if getGlobalStorageValue(RoomID) < 0 and player:getStorageValue(onexitInRoom) < 0 then
       if doPlayerRemoveItem(cid,6527, reqcoins) == TRUE then
         doSendAnimatedText(playerpos, "welcome", 247)
         doPlayerSendTextMessage(cid, 25, 'you have 10 minutes of huntting!')
         setGlobalStorageValue(RoomID, 1)
         setPlayerStorageValue(cid, InRoom, RoomID)
         setPlayerStorageValue(cid, Exhaust, os.time() + duration)
         doTeleportThing(cid, startpos)
         doAreaClean(pos.from, pos.to) 
         return addEvent(
         function()
         if isPlayer(cid) and getGlobalStorageValue(RoomID) > 0 or player:getStorageValue(onexitInRoom) == RoomID then
           --setPlayerStorageValue(cid, onexit, os.time()+10)  --
           doTeleportThing(cid, exitpos)
           doPlayerSendTextMessage(cid, 25, 'times up!')
           setPlayerStorageValue(cid, InRoom, -1)
           setPlayerStorageValue(cid, Exhaust, 0)
           setPlayerStorageValue(cid, DoubleSpawn, -1)
           doSendMagicEffect(exitpos, 10)
           return setGlobalStorageValue(RoomID, -1)
           end end,               -- double end here? -- Xikini
           xtime, cid)--, RoomID) auto kicker
         else
           doPlayerSendCancel(cid, 'you dont have ' .. reqcoins .. ' game tokens!')
           doTeleportThing(cid, fromPosition)
           doSendMagicEffect(playerpos, 2)
           return 1
         end
       else
         doTeleportThing(cid, fromPosition)
         doSendMagicEffect(playerpos, 2)
         return doPlayerSendCancel(cid, 'Somebody is already in the room.')
       end
     return true
     end
     --------------------------
     --exit teleport aid = 44xx
     if item.actionid == ExitID then
       if isPlayer(cid) then 
         doTeleportThing(cid, exitpos)
         setPlayerStorageValue(cid, onexit, os.time()+30)
         doPlayerSendTextMessage(cid, 25, 'you went out!')
         setPlayerStorageValue(cid, Exhaust, -1)
         setPlayerStorageValue(cid, InRoom, -1)
         doSendMagicEffect(exitpos, 10)
         return setGlobalStorageValue(RoomID, -1)
       end
     return true
     end

   return true
end

what I got?
an error with local onsummontime = os.date("%S seconds", getPlayerStorageValue(cid, onsummon) - os.time()) -- dont change

Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/hunting.lua:onStepIn
data/movements/scripts/hunting.lua:13: attempt to perform arithmetic on a boolean value
stack traceback:
        [C]: in function '__sub'
        data/movements/scripts/hunting.lua:13: in function <data/movements/scripts/hunting.lua:1>

Im verry new in scripting tfs and I have many problems with it so please be clear.
I think its problem with this os.date but I dont know how to fix it ;< Can someone help me to fix it? or just fix that code if someone is good enough for that? ill be glad for help. Here is original post: https://otland.net/threads/amazing-hunting-room-much-features-in-1-script.180092/
 
its different kind of arena, im looking for smth like this get spawn monster kill it etc just for exp not for reward ;/
You don't have to set a reward, if you read the topic everything is optional even the reward. And you can do endless spawning of monsters you just have to set the currentwave back to the start on the clear wave callback.
 

Similar threads

Back
Top Bottom