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

Battle Area

AIMSHOT

New Member
Joined
Jul 2, 2015
Messages
56
Reaction score
1
Location
Spain
Hello everyone,

I wana asking for Battle Npc Area the players should have 10 Arena tokens and max 2 players can entra this area i already create map for it i hope someone create that npc for me ;)

TFS 0.4
client version:- 8.6
token item id:- 9020


Thank you Guys and here you are pic of area
BxBjldS.jpg

 
@Sir Islam
Sorry im so anonying i know but theres possible to script when the players entra arena it summon hydra , medusa , Sprent every 30 second?
and the player will be teleported to temple affter 1 hour? :)
 
@Sir Islam
Sorry im so anonying i know but theres possible to script when the players entra arena it summon hydra , medusa , Sprent every 30 second?
and the player will be teleported to temple affter 1 hour? :)

easy to do it but need some minutes

tell me first so will be one player only in this area or two ? i see one player will be good # AIMSHOT
 
Last edited by a moderator:
sorry was very busy :) have fun #AIMSHOT

Code:
local config = {
    timeToStartEvent = 2, -- Seconds, after these minutes the Spawn will start
    timeBetweenSpawns = 60 , -- Seconds between each spawn of summons
    timeToRestArea = 3600 -- 3600 = 1 hours  Seconds, after these minutes the area will rest
    }

local locations = {
     ["Room 1"] ={
        fromPosition = {x = 1983, y =2007, z = 7}, -- top left corner of the playground
        toPosition = {x = 2003, y = 2014, z = 7}, -- bottom right corner of the playground
        teleport_to = {x=1990, y=2010, z=7},
        cost = 0,
        GlobalStorage = 51001,
        summons = {
            [1] = {name = "Demon"},
            [2] = {name = "rat"},
            [3] = {name = "rotworm"},
            [4] = {name = "dragon"},
            [5] = {name = "Vampire"},
            [6] = {name = "dragon lord"}}  
            },
   
     ["Room 2"] = {
        fromPosition = {x = 1983, y =2007, z = 7}, -- top left corner of the playground
        toPosition = {x = 2003, y = 2014, z = 7}, -- bottom right corner of the playground
        teleport_to = {x=1990, y=2010, z=7},
        cost = 0,
        GlobalStorage = 52002,
        summons = {
            [1] = {name = "Demon"},
            [2] = {name = "rat"},
            [3] = {name = "rotworm"},
            [4] = {name = "dragon"},
            [5] = {name = "Vampire"},
            [6] = {name = "dragon lord"}}  
            },
          
     ["Room 3"] = {
         fromPosition = {x = 1983, y =2007, z = 7}, -- top left corner of the playground
        toPosition = {x = 2003, y = 2014, z = 7}, -- bottom right corner of the playground
        teleport_to = {x=1990, y=2010, z=7},
        cost = 0,
        GlobalStorage = 53003,
        summons = {
            [1] = {name = "Demon"},
            [2] = {name = "rat"},
            [3] = {name = "rotworm"},
            [4] = {name = "dragon"},
            [5] = {name = "Vampire"},
            [6] = {name = "dragon lord"}}
            }
}


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState, xmsg = {}, {}

function onCreatureAppear(cid)         npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)       npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)       npcHandler:onCreatureSay(cid, type, msg) end
function onThink()           npcHandler:onThink() end

function RestArea(fromPos,toPos,GlobalStorage)
local GlobalStorage2 = GlobalStorage + 1
if getGlobalStorageValue(GlobalStorage) <= 0 and getGlobalStorageValue(GlobalStorage2) >= 1  then
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                areapos = {x = x, y = y, z = z, stackpos = 255}
                getCreatures = getTopCreature(areapos)
                if isMonster(getCreatures.uid) then
                    doRemoveCreature(getCreatures.uid)
                end
            if isPlayer(getCreatures.uid) and getPlayerStorageValue(getCreatures.uid,GlobalStorage) <= 0 then
               doTeleportThing(getCreatures.uid, getTownTemplePosition(getPlayerTown(getCreatures.uid)))
               doSendMagicEffect(getPlayerPosition(getCreatures.uid), CONST_ME_TELEPORT)
            end
            end
        end
    end
end
    addEvent(RestArea, 0 * 1000,fromPos,toPos,GlobalStorage)
return true
end

  
function EventsSpawn(cid,teleport,GlobalStorage,timeToRestArea)
addEvent(doTeleportThing,1*1000,cid,teleport)
addEvent(doSendMagicEffect,1*1000,teleport,CONST_ME_TELEPORT)  
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, " "..GlobalStorage.." value has been set to " .. getGlobalStorageValue(GlobalStorage))
local GlobalStorage2 = GlobalStorage + 1
setGlobalStorageValue(GlobalStorage2,1)
local timeToRestArea2 = timeToRestArea + 1
addEvent(setGlobalStorageValue,timeToRestArea2 * 1000,GlobalStorage2,-1)

setGlobalStorageValue(GlobalStorage,1)
setPlayerStorageValue(cid,GlobalStorage,1)
addEvent(setGlobalStorageValue,timeToRestArea * 1000,GlobalStorage,-1)
addEvent(setPlayerStorageValue,timeToRestArea * 1000,cid,GlobalStorage,-1)

return true
end

function SpawnMonster(fromPos,toPos,Monster,GlobalStorage,timeBetweenSpawns)
    if getGlobalStorageValue(GlobalStorage) >= 1 then
        pos = {x = math.random(fromPos.x,toPos.x), y = math.random(fromPos.y,toPos.y), z = math.random(fromPos.z,toPos.z)}
        doCreateMonster(Monster, pos,false,false)
        -- doSummonCreature(Monster, pos,false,false)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
        addEvent(SpawnMonster,timeBetweenSpawns * 1000,fromPos,toPos,Monster,GlobalStorage,timeBetweenSpawns)
    end
return true
end


local function Cptl(f, r)
     return f:upper()..r:lower()
end

function creatureSayCallback(cid, type, msg)
     if not npcHandler:isFocused(cid) then
         return false
     end

     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

     local x = locations[msg:gsub("(%a)([%w_']*)", Cptl)]
     if msgcontains(msg, 'travel') or msgcontains(msg, 'passage') then
         if getPlayerPremiumDays(cid) >= 0 then
             selfSay('Where do you want to go? I can bring you to { Room 1 }, { Room 2 } or { Room 3 }.', cid)
             talkState[talkUser] = 1
         else
             selfSay('Travel is only for premium.', cid)
         end
     elseif x and talkState[talkUser] == 1 then
         selfSay('Do you want to travel to '..msg..' for '..x.cost..' token?', cid)
         xmsg[cid] = msg
         talkState[talkUser] = 2
    
     elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
              x = locations[xmsg[cid]:gsub("(%a)([%w_']*)", Cptl)]
    if getGlobalStorageValue(x.GlobalStorage + 1) < 1 then
         if doPlayerRemoveItem(cid,9020, x.cost) then
            selfSay('Here you go, have a fun trip to '..xmsg[cid]..'.', cid)
            RestArea(x.fromPosition,x.toPosition,x.GlobalStorage)
            addEvent(SpawnMonster,config.timeToStartEvent * 1000,x.fromPosition,x.toPosition,x.summons[math.random(#x.summons)].name,x.GlobalStorage,config.timeBetweenSpawns)
            EventsSpawn(cid,x.teleport_to,x.GlobalStorage,config.timeToRestArea)
            setGlobalStorageValue(x.GlobalStorage+1, getGlobalStorageValue(x.GlobalStorage+1) == -1 and 1 or getGlobalStorageValue(x.GlobalStorage+1) + 1)
            talkState[talkUser] = 0
            else
             selfSay('You don\'t have enough token.', cid)
             talkState[talkUser] = 0
         end
          else
       selfSay('Sorry, there are one player in area , choose other area or come back later.', cid)
         talkState[talkUser] = 0
    end
     else
         selfSay('What? I don\'t understand what you mean with '..msg..'.', cid)
         talkState[talkUser] = 0
     end
     return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top