• 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] Fire Storm Event fix help

diakosz3456

New Member
Joined
Apr 6, 2020
Messages
46
Reaction score
1
Hey, i have problem. Message works, but i can't enter to teleport after start event :(
Fire Storm Event tfs 1.2 tibia 8.6
Post automatically merged:

I make a test map for this and set a positions in data/firestorm_event.lua
Post automatically merged:

nothing in console
 
what about "fsArena = Position(991, 930, 7) " i think the place you used in the script to teleport you to the event area is not available in the map so it does not teleport you anywhere
 
Code:
-- firestorm Variables
fsJoinedCountGlobalStorage = 18900 --Player joined event count / recuento de players.
fsJoinStorage = 18901 --player join storage / storage del jugador a unirse.
fsMinPlayers = 1 --min players needed when time runout / minimo de players necesarios para comenzar el evento.
fsMaxPlayers = 2 --max players to join / maximo de players.
fsTrophy = 7369 --trophy itemid / itemid del premio(que no sea stackable).
fsEventCountGlobalStorage = 18902 --firestorm Count (no move/no moverle).
 
fsWaitMinutes = 2 --when event has opened, how long until it starts? / cuantos minutos tarde el evento en empezar.
fsWaitingRoomPos = Position(885, 964, 7) --middle of waiting room / punto medio de el cuarto de espera.
fsArena = Position(903, 968, 7) --when even start where should player be teleported in the arena? / punto donde seran transportados los players.
fsArenaFromPosition = Position(895, 957, 7) --pos of top left corner / posicion de esquina superior izquierda.
fsArenaToPosition = Position(911, 973, 7) --pos of bottom right corner /posicion de esquina inferior derecha.
fsMiddleEventArena = Position(903, 965, 7) --Middle pos of the arena / punto medio de la arena
fsWaitingRoomRadiusX = 5 --depends how big the waiting room is 20sqm to x / depende de lo grande la sala de espera en x
fsWaitingRoomRadiusY = 5 --depends how big the waiting room is 20sqm to y / depende de lo grande la sala de espera en y
fsEventArenaRadiusX = 17 --Depends how big the firestorm arena is 50sqm to x / depende de lo grande de la arena en x
fsEventArenaRadiusY = 17 --Depends how big the firestorm arena is 50sqm to y / depende de lo grande de la arena en y
fsStartedGlobalStorage = 18903 -- Value: 0 == false, 1 == true, 2 == started --State of the event
fsCreateTeleportPosition = Position(984, 1276, 7) --Where should the teleport be created? / posicion donde sera creado el teleport?
 
function startfirestorm()
    local specs = Game.getSpectators(fsWaitingRoomPos, false, true, 0, fsWaitingRoomRadiusX, 0, fsWaitingRoomRadiusY)
        if Game.getStorageValue(fsJoinedCountGlobalStorage) <= fsMinPlayers then
                   for i = 1, #specs do
                    specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false)
                    specs[i]:setStorageValue(fsJoinStorage, 0)
            end
                    resetfsVariables()
            Game.broadcastMessage('firestorm Event failed to start, because of to little players joined the event!', MESSAGE_STATUS_WARNING)
            return true
        end
        for i = 1, #specs do
                local rX, rY, rZ
                rX = math.random(fsArenaFromPosition.x, fsArenaToPosition.x)
        rY = math.random(fsArenaFromPosition.y, fsArenaToPosition.y)
        rZ = math.random(fsArenaFromPosition.z, fsArenaToPosition.z)
            specs[i]:teleportTo(Position(rX, rY, rZ))
        end
        Game.broadcastMessage("firestorm Event has started, good luck to all participant.", MESSAGE_STATUS_WARNING)
        Game.setStorageValue(fsStartedGlobalStorage, 2)
           doStartfirestorm()
end
 
 
function doStartfirestorm()
        if  Game.getStorageValue(fsJoinedCountGlobalStorage) > fsMaxPlayers then return false end
                if Game.getStorageValue(fsStartedGlobalStorage) == 2 then
                local specs = Game.getSpectators(fsArena, false, true, 0, 10, 0, 10)
                 for i = 1, #specs do
        local randX, randY, randZ
        randX = math.random(fsArenaFromPosition.x, fsArenaToPosition.x)
        randY = math.random(fsArenaFromPosition.y, fsArenaToPosition.y)
        randZ = math.random(fsArenaFromPosition.z, fsArenaToPosition.z)
                local randfire = Position(randX, randY, randZ)
                 local randX1, randY1, randZ1
        randX1 = math.random(fsArenaFromPosition.x, fsArenaToPosition.x)
        randY1 = math.random(fsArenaFromPosition.y, fsArenaToPosition.y)
        randZ1 = math.random(fsArenaFromPosition.z, fsArenaToPosition.z)
                local randfire1 = Position(randX1, randY1, randZ1)
            local creature, players = nil, Game.getPlayers()
                                                 for i = 1, #players do
                                                 creature = players[i]
                doSendDistanceShoot(fsArenaFromPosition, randfire, 4)
                doSendDistanceShoot(fsArenaToPosition, randfire, 4)
                doSendDistanceShoot(Position(998, 925, 7), randfire, 4)
                doSendDistanceShoot(Position(984, 935, 7), randfire, 4)
            doAreaCombatHealth(creature.uid, COMBAT_HOLYDAMAGE, randfire,randfire, -9999, -1000000,7)
                end
                                end
 
            addEvent(doStartfirestorm, 500)
        end
end
 
function resetfsVariables()
        Game.setStorageValue(fsEventCountGlobalStorage, 0)
        Game.setStorageValue(fsJoinedCountGlobalStorage, 0)
        Game.setStorageValue(fsStartedGlobalStorage, 0)
end

 
function onPrepareDeath(player, killer)
    local winner = 0
        if player:getStorageValue(fsJoinStorage) >= 1 then
            Game.setStorageValue(fsJoinedCountGlobalStorage, Game.getStorageValue(fsJoinedCountGlobalStorage)-1)
        player:teleportTo(player:getTown():getTemplePosition())
        player:setStorageValue(fsJoinStorage, 0)
        player:addHealth(player:getMaxHealth())
 
                if Game.getStorageValue(fsJoinedCountGlobalStorage) <= 1 then --Event ended, someone won!
         local pla, play = nil, Game.getPlayers()
         for i = 1, #play do
                 pla = play[i]
                           if pla:getStorageValue(fsJoinStorage) == 1 then
                        winner = pla:getId()
                        break
                        end
            end
            winner = Player(winner)
             if winner then
                winner:teleportTo(winner:getTown():getTemplePosition())
                                winner:addHealth(winner:getMaxHealth())
                local trophy = winner:addItem(fsTrophy, 1)
                if trophy then
                    trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, '['.. winner:getName() ..'] has won the firestorm Event.')
                end
                 Game.broadcastMessage(string.format('%s is the winner of firestorm Event', winner:getName()), MESSAGE_STATUS_WARNING)
            end
            resetfsVariables()
        end
        return false
    end
    return true
end
 
try this in your script at movements
Code:
        dofile('data/firestorm_event.lua')
      function onStepIn(creature, item, position, fromPosition)
         local player = creature:getPlayer()
         local pos  = {x = 885, y = 964, z = 7}
local pos1  = {x = 985, y = 1276, z = 7}
        if Game.getStorageValue(fsStartedGlobalStorage) == 2 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event has already started.')
            player:teleportTo(fromPosition, true)
            return false
        end
        if Game.getStorageValue(fsStartedGlobalStorage) == 0 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event has not started yet.')
            player:teleportTo(fromPosition, true)
            return false
        end
       if Game.getStorageValue(fsJoinedCountGlobalStorage) >= fsMaxPlayers then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event is already full! ['.. Game.getStorageValue(fsJoinedCountGlobalStorage) ..'/'.. fsMaxPlayers ..']')
            return false
        end
        player:teleportTo(pos1)
        Game.setStorageValue(fsJoinedCountGlobalStorage, Game.getStorageValue(fsJoinedCountGlobalStorage) + 1)
        Game.broadcastMessage(string.format('%s has joined the Firestorm Event! [%s/'.. fsMaxPlayers ..'].', player:getName(), Game.getStorageValue(fsJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
        player:setStorageValue(fsJoinStorage, 1)
        return true
        end
pos1 is an available place in your map, it is next to your TP - or its better to try temple pos - if it works then the problem is in the position only
 
Back
Top