• 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

Hello, i have this problem:

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/zombie_death.lua:eek:nDeath
data/creaturescripts/scripts/zombie_death.lua:5: attempt to index local 'monster' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/zombie_death.lua:5: in function <data/creaturescripts/scripts/zombie_death.lua:3>

My zombie_death.lua is:

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

function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    local monster = Monster(cid)
    monster:say("I WILL BE BACK!", TALKTYPE_MONSTER_YELL)
    monster:getPosition():sendMagicEffect(CONST_ME_MORTAREA)
    doSummonZombie()
    Game.setStorageValue(zeZombieCountGlobalStorage, Game.getStorageValue(zeZombieCountGlobalStorage) - 1)
end

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local winner = 0
    if player:getStorageValue(zeJoinStorage) == 1 then
        Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) - 1)
        player:teleportTo(player:getTown():getTemplePosition())
        player:setStorageValue(zeJoinStorage, 0)
        player:addHealth(player:getMaxHealth())
        if Game.getStorageValue(zeJoinedCountGlobalStorage) <= 1 then --Event ended, someone won!
            local players = Game.getPlayers()
            for _, tmpPlayer in ipairs(players) do
                local stor = tmpPlayer:getStorageValue(zeJoinStorage)
                if stor == 1 then
                    winner = tmpPlayer:getId()
                    break
                end
            end
            winner = Player(winner)
            if winner then
                winner:teleportTo(winner:getTown():getTemplePosition())
                local trophy = winner:addItem(zeTrophy, 1)
                local reward = winner:addItem(zeReward, 1)
              
                if trophy then
                    trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, '['.. winner:getName() ..'] has won the Zombie Event.')
                end
                 broadcastMessage(string.format('%s is the winner of Zombie Event Versus %s Zombies.', winner:getName(), Game.getStorageValue(zeZombieCountGlobalStorage)), MESSAGE_STATUS_WARNING)
            end
            doClearZombieArena()
            resetVariables()
        end
        return false
    end
    return true
end

Thanks for help.

You aren't using 1.0

The problem should be fixed by changing
Code:
function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    local monster = Monster(cid)

to

Code:
function onDeath(monster, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
 
@Codinablack, i have the same error :/

EDIT:
I trying:

Code:
function onDeath(monster, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)

to

Code:
function onDeath(monster, corpse, killer, mostDamageKiller, unjustified, mostDamage_unjustified)

and the same :(
 
Last edited:
@Codinablack, is TFS 1.0 and I fixed changing:

Code:
function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
local monster = Monster(cid)

to

Code:
function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
  local monster = Creature(cid)

SOLVED :D
 
My TFS is 1.1

Error onSay and Onthink:
Code:
data/talkactions/scripts/events/zombie_join.lua:11: attempt to compare nil with
number
and
Code:
data/globalevents/scripts/events/zombie_think.lua:4: attempt to compare nil with
number

How can I solve it?
 
data/talkactions/scripts/events/zombie_join.lua:11: attempt to compare nil with number

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

function onSay(cid, words, param)
    local player = Player(cid)

    if tonumber(Game.getStorageValue(102))  == 2 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
        return false
    end

   if tonumber(Game.getStorageValue(102)) < 1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "The Zombie Event has not started yet.")
        return false
    end

    if tonumber(Game.getStorageValue(100))  > zeMaxPlayers then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. tonumber(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(100, tonumber(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


for onThink
data/globalevents/scripts/events/zombie_think.lua:4: attempt to compare nil with number
Code:
dofile('data/zombie_system.lua')

function onThink(interval, lastExecution, thinkInterval)
  if tonumber(Game.getStorageValue(102)) < 1 then
  local teleport = Game.createItem(1387, 1, zeCreateTeleportPosition)
  if teleport then
  teleport:setAttribute(ITEM_ATTRIBUTE_UNIQUEID, 7000)
  end
  Game.setStorageValue(tonumber(102),1)
  print('Zombie Event has started & waiting for players to join! Min: '.. zeMinPlayers ..'/'.. zeMaxPlayers ..'.')
  Game.broadcastMessage('The Zombie Event has started! You have '.. zeWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING)
  addEvent(startZombie, zeWaitMinutes * 60 * 1000)
  end
  return true
end
 
Last edited:
for talkactions
Code:
dofile('data/zombie_system.lua')

function onSay(cid, words, param)
    local player = Player(cid)

    if tonumber(Game.getStorageValue(zeStartedGlobalStorage))  == 2 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
        return false
    end

   if tonumber(Game.getStorageValue(zeStartedGlobalStorage)) < 1 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


for onThink

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

function onThink(interval, lastExecution, thinkInterval)
  if tonumber(Game.getStorageValue(zeStartedGlobalStorage)) < 1 then
  local teleport = Game.createItem(1387, 1, zeCreateTeleportPosition)
  if teleport then
  teleport:setAttribute(ITEM_ATTRIBUTE_UNIQUEID, 7000)
  end
  Game.setStorageValue(tonumber(zeStartedGlobalStorage),1)
  print('Zombie Event has started & waiting for players to join! Min: '.. zeMinPlayers ..'/'.. zeMaxPlayers ..'.')
  Game.broadcastMessage('The Zombie Event has started! You have '.. zeWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING)
  addEvent(startZombie, zeWaitMinutes * 60 * 1000)
  end
  return true
end
Still the same error Sir Islam!

Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/events/zombie_think.lua:onThink
data/globalevents/scripts/events/zombie_think.lua:4: attempt to compare nil with
number
stack traceback:
        [C]: in function '__lt'
        data/globalevents/scripts/events/zombie_think.lua:4: in function <data/g
lobalevents/scripts/events/zombie_think.lua:3>
[Error - GlobalEvents::think] Failed to execute event: zombie
 
Using TFS 1.1 -

Hello, I am having some problems.. I will do my best too explain.

1 .
When first player enters the event it says 0/15..
the event is not supposed too start unless 3 people have joined,
but i just went thru the portal 3x..
and for some reason the 1st time I went thru the tp, it said 5/15?
--
05:53 The Zombie Event has started! You have 4 minutes to join!
05:54 Martin has joined the Zombie Event! [5/15].
05:54 Martin has joined the Zombie Event! [6/15].
05:54 Martin has joined the Zombie Event! [7/15].

2 .
The portal does not disappear when the event starts..
instead -
06:18 The Zombie Event has already started.

3 .
nobody wins when its over?

----------------------------------------------------
No errors in console, I installed everything properly (i think)

umm ya....

I think its some storage value problem?

If you can help me, please let me know what scripts you need too see!

Thanks,
-Martin
 
update my reply recopy
Still the same Sir Islam!! I made it @Sir Islam
dofile('data/zombie_system.lua')

function onThink(interval, lastExecution, thinkInterval)

if Game.getStorageValue(zeStartedGlobalStorage) ~= 1 then
local teleport = Game.createItem(1387, 1, zeCreateTeleportPosition)
teleport:setDestination(zeWaitingRoomPos)
Game.setStorageValue(zeStartedGlobalStorage, 1)
print('Zombie Event has started & waiting for players to join! Min: '.. zeMinPlayers ..'/'.. zeMaxPlayers ..'.')
Game.broadcastMessage('The Zombie Event has started! You have '.. zeWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING)
addEvent(startZombie, zeWaitMinutes * 60 * 1000)
end
return true
end

I'm trying to puzzle this storage configuration too @FLE.. I'm completely lost xD
How did you solve this problem
Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/zombie_system.lua:49: attempt to compare number with nil
stack traceback:
        [C]: in function '__lt'
        data/zombie_system.lua:49: in function 'doSummonZombie'
        data/zombie_system.lua:62: in function 'doStartZombieEvasion'
        data/zombie_system.lua:45: in function <data/zombie_system.lua:28>

This attempt to compare number with nil is annoying me!!!
 
Last edited:
Still the same Sir Islam!! I made it @Sir Islam
dofile('data/zombie_system.lua')

function onThink(interval, lastExecution, thinkInterval)

if Game.getStorageValue(zeStartedGlobalStorage) ~= 1 then
local teleport = Game.createItem(1387, 1, zeCreateTeleportPosition)
teleport:setDestination(zeWaitingRoomPos)
Game.setStorageValue(zeStartedGlobalStorage, 1)
print('Zombie Event has started & waiting for players to join! Min: '.. zeMinPlayers ..'/'.. zeMaxPlayers ..'.')
Game.broadcastMessage('The Zombie Event has started! You have '.. zeWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING)
addEvent(startZombie, zeWaitMinutes * 60 * 1000)
end
return true
end

I'm trying to puzzle this storage configuration too @FLE.. I'm completely lost xD
How did you solve this problem
Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/zombie_system.lua:49: attempt to compare number with nil
stack traceback:
        [C]: in function '__lt'
        data/zombie_system.lua:49: in function 'doSummonZombie'
        data/zombie_system.lua:62: in function 'doStartZombieEvasion'
        data/zombie_system.lua:45: in function <data/zombie_system.lua:28>

This attempt to compare number with nil is annoying me!!!


Change
zeJoinedCountGlobalStorage = 101 --Zombie spawned Count
to
zeZombieCountGlobalStorage = 101 --Zombie spawned Count

Just a small typo. Can you update that in post 2 @Printer
 
any1 else got this?

Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/events/zombie/zombie_think.lua:onThink
data/globalevents/scripts/events/zombie/zombie_think.lua:4: attempt to compare n
il with number
stack traceback:
        [C]: in function '__lt'
        data/globalevents/scripts/events/zombie/zombie_think.lua:4: in function
<data/globalevents/scripts/events/zombie/zombie_think.lua:3>
[Error - GlobalEvents::think] Failed to execute event: zombie
 
Getting this
lElEEYq.png
 

Omg, i'm so stupid. You didn't choose the correct path to the zombie_system file.
This is how every file starts
Code:
dofile('data/zombie_system.lua')
Which means that your zombie_system.lua file just has to be in the data folder.
But if you placed the file for example in data/lib it should be like this
Code:
dofile('data/lib/zombie_system.lua')
 
Back
Top