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

Zombie Event BETA! [Tfs 1.0] Vers: 0.5

Can you try it without edit the values? Since i can't find any problem in that line.
 
Hello OTland Team! I got the script to a point where i get ported , the zombies spawn but when you get hit ( die)
the last player standing dont win.

He does not get teleported out of area or anything.
No Errors in console..

Do you have anything in mind what could help me?

Thanks!
 
Im pretty sure I copied everything right
View attachment 26739

Your problem is this :

zeArenaFromPosition = Position(1288, y = 1890, z = 7) --pos of top left corner
zeArenaToPosition = Position(1342, y = 1923, z = 7) --pos of bottom right corner
zeMiddleZombieArena = Position(1315, y = 1905, z = 7) --Middle pos of the arena

Should be :

zeArenaFromPosition = Position(1288, 1890, 7) --pos of top left corner
zeArenaToPosition = Position(1342, 1923, 7) --pos of bottom right corner
zeMiddleZombieArena = Position(1315, 1905, 7) --Middle pos of the arena
 
Your problem is this :

zeArenaFromPosition = Position(1288, y = 1890, z = 7) --pos of top left corner
zeArenaToPosition = Position(1342, y = 1923, z = 7) --pos of bottom right corner
zeMiddleZombieArena = Position(1315, y = 1905, z = 7) --Middle pos of the arena

Should be :

zeArenaFromPosition = Position(1288, 1890, 7) --pos of top left corner
zeArenaToPosition = Position(1342, 1923, 7) --pos of bottom right corner
zeMiddleZombieArena = Position(1315, 1905, 7) --Middle pos of the arena

Ooh lol didn't even see that I'll try it out tomorrow
 
Well, I totally forgot about this >.< but I have tested it and I am not getting the errors anymore when im starting up the ot ;) I just have to test the game itself now
 
Well, I totally forgot about this >.< but I have tested it and I am not getting the errors anymore when im starting up the ot ;) I just have to test the game itself now

Hehe, it happens!

Please tell me how it goes since iam having some trouble later on in the event.

Best of luck!
 
hi
I'm trying and when I say! zombie I get this error

Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/zombie_join.lua:onSay
data/talkactions/scripts/zombie_join.lua:11: attempt to compare nil with number
stack traceback:
  [C]: in function '__lt'
  data/talkactions/scripts/zombie_join.lua:11: in function <data/talkactio
ns/scripts/zombie_join.lua:3>

Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/zombie_join.lua:onSay
data/talkactions/scripts/zombie_join.lua:11: attempt to compare nil with number
stack traceback:
  [C]: in function '__lt'
  data/talkactions/scripts/zombie_join.lua:11: in function <data/talkactio
ns/scripts/zombie_join.lua:3>

zombie_onjoin.lua

Code:
dofile('data/zombie_system.lua')

function onSay(cid, words, param)
  local player = Player(cid)
  if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
  player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
  return false
  end
  if Game.getStorageValue(zeStartedGlobalStorage) < 1000 then
  player:sendTextMessage(MESSAGE_INFO_DESCR, "The Zombie Event has not started yet.")
  return false
  end
  if Game.getStorageValue(zeJoinedCountGlobalStorage) > zeMaxPlayers then
  player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. Game.getStorageValue(zeJoinedCountGlobalStorage) ..'/'.. zeMaxPlayers ..']')
  return false
  end
  if player:isPzLocked() then
  player:sendCancelMessage('You can\'t join the zombie while you are in a fight!')
  return false
  end
   
  player:teleportTo(zeWaitingRoomPos)
  if not player:getGroup():getAccess() then
  Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) + 1)
  Game.broadcastMessage(string.format('%s has joined the Zombie Event! [%s/'.. zeMaxPlayers ..'].', player:getName(), Game.getStorageValue(zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
  player:setStorageValue(zeJoinStorage, 1)
  end
  return false
end

can someone please check the error
thanks and regards
 
hi
I'm trying and when I say! zombie I get this error

Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/zombie_join.lua:onSay
data/talkactions/scripts/zombie_join.lua:11: attempt to compare nil with number
stack traceback:
  [C]: in function '__lt'
  data/talkactions/scripts/zombie_join.lua:11: in function <data/talkactio
ns/scripts/zombie_join.lua:3>

Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/zombie_join.lua:onSay
data/talkactions/scripts/zombie_join.lua:11: attempt to compare nil with number
stack traceback:
  [C]: in function '__lt'
  data/talkactions/scripts/zombie_join.lua:11: in function <data/talkactio
ns/scripts/zombie_join.lua:3>

zombie_onjoin.lua

Code:
dofile('data/zombie_system.lua')

function onSay(cid, words, param)
  local player = Player(cid)
  if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
  player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
  return false
  end
  if Game.getStorageValue(zeStartedGlobalStorage) < 1000 then
  player:sendTextMessage(MESSAGE_INFO_DESCR, "The Zombie Event has not started yet.")
  return false
  end
  if Game.getStorageValue(zeJoinedCountGlobalStorage) > zeMaxPlayers then
  player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. Game.getStorageValue(zeJoinedCountGlobalStorage) ..'/'.. zeMaxPlayers ..']')
  return false
  end
  if player:isPzLocked() then
  player:sendCancelMessage('You can\'t join the zombie while you are in a fight!')
  return false
  end
  
  player:teleportTo(zeWaitingRoomPos)
  if not player:getGroup():getAccess() then
  Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) + 1)
  Game.broadcastMessage(string.format('%s has joined the Zombie Event! [%s/'.. zeMaxPlayers ..'].', player:getName(), Game.getStorageValue(zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
  player:setStorageValue(zeJoinStorage, 1)
  end
  return false
end

can someone please check the error
thanks and regards
Can you post your full Zombie_system.lua please
 
Here you have it, but I updated the original to put @Printer.
When I start the server does not give me any errors, it's just when I put! Zombie get the error when I put in my previous post.
Can you post your full Zombie_system.lua please

Code:
-- Zombie Variables
zeZombieName = 'Zombie Event' --Zombie Name
zombieSpawnInterval = 5 --how many seconds until a new zombie spawns
zeMaxZombies = 20 --max zombies in the arena?
zeJoinedCountGlobalStorage = 100 --Player joined event count

-- Players Variables
zeJoinStorage = 1000 --player join storage
zeMinPlayers = 1 --min players needed when time runout
zeMaxPlayers = 2 --max players to join
zeTrophy = 7369 --trophy itemid
zeJoinedCountGlobalStorage = 101 --Zombie spawned Count

-- Other Variables
zeWaitMinutes = 1 --when event has opened, how long until it starts?
zeWaitingRoomPos = Position(16810, 16472, 7) --middle of waiting room
zeZombieArena = Position(16941, 16561, 7) --when even start where should player be teleported in the zombie arena?
zeArenaFromPosition = Position(16925, 16541, 7) --pos of top left corner
zeArenaToPosition = Position(16969, 16581, 7) --pos of bottom right corner
zeMiddleZombieArena = Position(16941, 16561, 7) --Middle pos of the arena
zeWaitingRoomRadiusX = 20 --depends how big the waiting room is 20sqm to x
zeWaitingRoomRadiusY = 20 --depends how big the waiting room is 20sqm to y
zeZombieArenaRadiusX = 50 --Depends how big the zombie arena is 50sqm to x
zeZombieArenaRadiusY = 50 --Depends how big the zombie arena is 50sqm to y
zeStartedGlobalStorage = 102 -- Value: 0 == false, 1 == true, 2 == started --State of the event
zeCreateTeleportPosition = Position(16810, 16479, 7) --Where should the teleport be created?

function startZombie()
    local specs = Game.getSpectators(zeWaitingRoomPos, false, true, 0, zeWaitingRoomRadiusX, 0, zeWaitingRoomRadiusY)
        if Game.getStorageValue(zeJoinedCountGlobalStorage) < zeMinPlayers then
            for i = 1, #specs do
                    specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false)
                    specs[i]:setStorageValue(zeJoinStorage, 0)
            end
            resetVariables()
            Game.broadcastMessage('Zombie Event failed to start, because of to little players joined the event!', MESSAGE_STATUS_WARNING)
            return true
        end

        for i = 1, #specs do
            specs[i]:teleportTo(zeZombieArena)
        end
        Game.broadcastMessage("Zombie Event has started, good luck to all participant.", MESSAGE_STATUS_WARNING)
        Game.setStorageValue(zeStartedGlobalStorage, 2)
        doStartZombieEvasion()
end

function doSummonZombie()
        if Game.getStorageValue(zeZombieCountGlobalStorage) > zeMaxZombies then
            return false
        end

        local zombie = Game.createMonster(zeZombieName, {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)})
        if zombie then
            Game.createMonster(zeZombieName, {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)})
        end
        Game.setStorageValue(zeZombieCountGlobalStorage, Game.getStorageValue(zeZombieCountGlobalStorage) + 1)
end

function doStartZombieEvasion()
        if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
               doSummonZombie()
            addEvent(doStartZombieEvasion, 5 * 1000)
        end
end

function resetVariables()
        Game.setStorageValue(zeJoinedCountGlobalStorage, 0)
        Game.setStorageValue(zeZombieCountGlobalStorage, 0)
        Game.setStorageValue(zeStartedGlobalStorage, 0)
end

function doClearZombieArena()
        local specs = Game.getSpectators(zeMiddleZombieArena, false, false, 0, zeZombieArenaRadiusX, 0, zeZombieArenaRadiusY)
        for i = 1, #specs do
            if specs[i]:getName() == zeZombieName then
                    specs[i]:remove()
            end
        end
end
 
Here you have it, but I updated the original to put @Printer.
When I start the server does not give me any errors, it's just when I put! Zombie get the error when I put in my previous post.
Code:
-- Zombie Variables
zeZombieName = 'Zombie Event' --Zombie Name
zombieSpawnInterval = 5 --how many seconds until a new zombie spawns
zeMaxZombies = 20 --max zombies in the arena?
zeJoinedCountGlobalStorage = 100 --Player joined event count

-- Players Variables
zeJoinStorage = 1000 --player join storage
zeMinPlayers = 1 --min players needed when time runout
zeMaxPlayers = 2 --max players to join
zeTrophy = 7369 --trophy itemid
zeJoinedCountGlobalStorage = 101 --Zombie spawned Count

-- Other Variables
zeWaitMinutes = 1 --when event has opened, how long until it starts?
zeWaitingRoomPos = Position(16810, 16472, 7) --middle of waiting room
zeZombieArena = Position(16941, 16561, 7) --when even start where should player be teleported in the zombie arena?
zeArenaFromPosition = Position(16925, 16541, 7) --pos of top left corner
zeArenaToPosition = Position(16969, 16581, 7) --pos of bottom right corner
zeMiddleZombieArena = Position(16941, 16561, 7) --Middle pos of the arena
zeWaitingRoomRadiusX = 20 --depends how big the waiting room is 20sqm to x
zeWaitingRoomRadiusY = 20 --depends how big the waiting room is 20sqm to y
zeZombieArenaRadiusX = 50 --Depends how big the zombie arena is 50sqm to x
zeZombieArenaRadiusY = 50 --Depends how big the zombie arena is 50sqm to y
zeStartedGlobalStorage = 102 -- Value: 0 == false, 1 == true, 2 == started --State of the event
zeCreateTeleportPosition = Position(16810, 16479, 7) --Where should the teleport be created?

function startZombie()
    local specs = Game.getSpectators(zeWaitingRoomPos, false, true, 0, zeWaitingRoomRadiusX, 0, zeWaitingRoomRadiusY)
        if Game.getStorageValue(zeJoinedCountGlobalStorage) < zeMinPlayers then
            for i = 1, #specs do
                    specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false)
                    specs[i]:setStorageValue(zeJoinStorage, 0)
            end
            resetVariables()
            Game.broadcastMessage('Zombie Event failed to start, because of to little players joined the event!', MESSAGE_STATUS_WARNING)
            return true
        end

        for i = 1, #specs do
            specs[i]:teleportTo(zeZombieArena)
        end
        Game.broadcastMessage("Zombie Event has started, good luck to all participant.", MESSAGE_STATUS_WARNING)
        Game.setStorageValue(zeStartedGlobalStorage, 2)
        doStartZombieEvasion()
end

function doSummonZombie()
        if Game.getStorageValue(zeZombieCountGlobalStorage) > zeMaxZombies then
            return false
        end

        local zombie = Game.createMonster(zeZombieName, {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)})
        if zombie then
            Game.createMonster(zeZombieName, {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)})
        end
        Game.setStorageValue(zeZombieCountGlobalStorage, Game.getStorageValue(zeZombieCountGlobalStorage) + 1)
end

function doStartZombieEvasion()
        if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
               doSummonZombie()
            addEvent(doStartZombieEvasion, 5 * 1000)
        end
end

function resetVariables()
        Game.setStorageValue(zeJoinedCountGlobalStorage, 0)
        Game.setStorageValue(zeZombieCountGlobalStorage, 0)
        Game.setStorageValue(zeStartedGlobalStorage, 0)
end

function doClearZombieArena()
        local specs = Game.getSpectators(zeMiddleZombieArena, false, false, 0, zeZombieArenaRadiusX, 0, zeZombieArenaRadiusY)
        for i = 1, #specs do
            if specs[i]:getName() == zeZombieName then
                    specs[i]:remove()
            end
        end
end


EDIT:

zeJoinedCountGlobalStorage = 101 --Zombie spawned Count

Should be : zeZombieCountGlobalStorage = 101 --Zombie spawned Count

You also need to do this: Under ------Other Variables put this:

if Game.getStorageValue(zeStartedGlobalStorage) == nil then
Game.setStorageValue(zeStartedGlobalStorage, 0)
end

if Game.getStorageValue(zeJoinedCountGlobalStorage) == nil then
Game.setStorageValue(zeJoinedCountGlobalStorage, 0)
end

if Game.getStorageValue(zeZombieCountGlobalStorage) == nil then
Game.setStorageValue(zeZombieCountGlobalStorage, 0)
end
 
Last edited:
EDIT:

zeJoinedCountGlobalStorage = 101 --Zombie spawned Count

Should be : zeZombieCountGlobalStorage = 101 --Zombie spawned Count

You also need to do this: Under ------Other Variables put this:

if Game.getStorageValue(zeStartedGlobalStorage) == nil then
Game.setStorageValue(zeStartedGlobalStorage, 0)
end

if Game.getStorageValue(zeJoinedCountGlobalStorage) == nil then
Game.setStorageValue(zeJoinedCountGlobalStorage, 0)
end

if Game.getStorageValue(zeZombieCountGlobalStorage) == nil then
Game.setStorageValue(zeZombieCountGlobalStorage, 0)
end

you're god man, this realy work
 
Your problem is this :

zeArenaFromPosition = Position(1288, y = 1890, z = 7) --pos of top left corner
zeArenaToPosition = Position(1342, y = 1923, z = 7) --pos of bottom right corner
zeMiddleZombieArena = Position(1315, y = 1905, z = 7) --Middle pos of the arena

Should be :

zeArenaFromPosition = Position(1288, 1890, 7) --pos of top left corner
zeArenaToPosition = Position(1342, 1923, 7) --pos of bottom right corner
zeMiddleZombieArena = Position(1315, 1905, 7) --Middle pos of the arena
Thanks.
 
@Oscar Eriksson
You can say that thanks to your modification of the code, works me 100%, just one thing, you have to step on the teleport to take you once last time out, since by talkactions, saying ! Zombie tells you that there is any zombie event started.
Greetings and thanks
 
@Printer You are a beast! See OTLAND TFS 1.0 is still beast even though it lacks so many functions, looks to me as if these meta-methods are the shit! Printer obviously has no problem with them, and it just makes it look soo much cleaner and easier to understand, I think we will have more lua scripters soon after the release, shouldn't take long before many things are remade for 1.0 and that becomes the norm.
 
TFS 1.0 has functions which doesn't exsist in 0.3/0.4 :p So 1.0 is a good way forward!
 
Back
Top