Zombie Event BETA! [Tfs 1.0] Vers: 0.5

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by Printer, Apr 24, 2014.

  1. Mister mox

    Mister mox New Member

    Joined:
    Mar 3, 2010
    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    dofile('data/zombie_system.lua')

    function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
    return false
    end
    if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
    player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
    player:teleportTo(fromPosition, true)
    return false
    end
    if Game.getStorageValue(zeStartedGlobalStorage) == 0 then
    player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has not started yet.')
    player:teleportTo(fromPosition, true)
    return false
    end
    if Game.getStorageValue(zeJoinedCountGlobalStorage) > zeMaxPlayers then
    player:teleportTo(fromPosition, true)
    player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. Game.getStorageValue(zeJoinedCountGlobalStorage) ..'/'.. zeMaxPlayers ..']')
    return false
    end
    player:teleportTo(zeWaitingRoomPos)
    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)
    return true
    end

    dofile('data/zombie_system.lua')

    function onThink(interval, lastExecution, thinkInterval)
    if Game.getStorageValue(zeStartedGlobalStorage) < 1 then
    local teleport = Game.createItem(1387, 1, zeCreateTeleportPosition)
    if teleport then
    teleport:setAttribute(ITEM_ATTRIBUTE_UNIQUEID, 7000)
    end
    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
     
  2. davidmemo

    davidmemo Member

    Joined:
    Mar 28, 2011
    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    i have one problem
    [​IMG]
    and this is the code

    Code (Text):
    1. dofile('data/zombie_system.lua')
    2.  
    3. function onSay(cid, words, param)
    4.     local player = Player(cid)
    5.  
    6.     if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
    7.         player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
    8.         return false
    9.     end
    10.  
    11.    if Game.getStorageValue(zeStartedGlobalStorage) < 1 then
    12.         player:sendTextMessage(MESSAGE_INFO_DESCR, "The Zombie Event has not started yet.")
    13.         return false
    14.     end
    15.  
    16.     if Game.getStorageValue(zeJoinedCountGlobalStorage) > zeMaxPlayers then
    17.         player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. Game.getStorageValue(zeJoinedCountGlobalStorage) ..'/'.. zeMaxPlayers ..']')
    18.         return false
    19.     end
    20.  
    21.     if player:isPzLocked() then
    22.         player:sendCancelMessage('You can\'t join the zombie while you are in a fight!')
    23.         return false
    24.     end
    25.    
    26.     player:teleportTo(zeWaitingRoomPos)
    27.     if not player:getGroup():getAccess() then
    28.         Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) + 1)
    29.         Game.broadcastMessage(string.format('%s has joined the Zombie Event! [%s/'.. zeMaxPlayers ..'].', player:getName(), Game.getStorageValue(zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
    30.         player:setStorageValue(zeJoinStorage, 1)
    31.     end
    32.     return false
    33. end
     
  3. Mister mox

    Mister mox New Member

    Joined:
    Mar 3, 2010
    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    using this modification my server kept sending error message, but now broadcast message, i solved the problem removed the initial "Game." before every broadcast command
    ex:
    Game.broadcastMessage (string.format ('% s has joined the Zombie Event [% s /!' .. ZeMaxPlayers .. '].' Player: GetName (), Game.getStorageValue (zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)

    Should be:
    broadcastMessage (string.format ('% s has joined the Zombie Event [% s /!' .. zeMaxPlayers .. '].' player: GetName (), Game.getStorageValue (zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)

    and if you only have two or fewer characters in the event does not work

    now everything is running nice, thx everyone
     
  4. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    What Version are you using? TFS 1.0?
     
  5. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    Same question to you.. what version are you using?
     
  6. davidmemo

    davidmemo Member

    Joined:
    Mar 28, 2011
    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    emm theforgottenserver 1.0 but i solved this problem thanks :D
     
  7. Mister mox

    Mister mox New Member

    Joined:
    Mar 3, 2010
    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    tfs 1.0 to, using the code that I said everything is ok, thx for the code ^^
     
  8. login12

    login12 void newbie scripter()

    Joined:
    Feb 26, 2011
    Messages:
    139
    Likes Received:
    7
    Best Answers:
    0
    I have this is error..

    Lua Script Error: [GlobalEvent Interface]
    data/globalevents/scripts/zombie_think.lua:eek:nThink
    data/globalevents/scripts/zombie_think.lua:4: attempt to compare nil with number
    stack traceback:
    [C]: ?
    data/globalevents/scripts/zombie_think.lua:4: in function <data/globalevents/scripts/zombie_think.lua:3>
    [Error - GlobalEvents::think] Failed to execute event: zombie

    Lua Script Error: [GlobalEvent Interface]
    data/globalevents/scripts/zombie_think.lua:eek:nThink
    data/globalevents/scripts/zombie_think.lua:4: attempt to compare nil with number
    stack traceback:
    [C]: ?
    data/globalevents/scripts/zombie_think.lua:4: in function <data/globalevents/scripts/zombie_think.lua:3>
    [Error - GlobalEvents::think] Failed to execute event: zombie
     
    Oravake likes this.
  9. Oravake

    Oravake New Member

    Joined:
    Nov 22, 2014
    Messages:
    4
    Likes Received:
    2
    Best Answers:
    0
    I got the same problem @Printer. What could cause this ?
     
  10. Printer

    Printer if Printer then print("LUA") end Premium User

    Joined:
    Dec 27, 2009
    Messages:
    5,594
    Likes Received:
    1,875
    Best Answers:
    5
    I will make a new Zombie Event. Even more optimized, more features and etc.. You can also suggest what you want :D
     
    Codinablack, Oravake and Evil Puncker like this.
  11. Oravake

    Oravake New Member

    Joined:
    Nov 22, 2014
    Messages:
    4
    Likes Received:
    2
    Best Answers:
    0
    What can I say, you are the golden star of Otland :D
     
    Codinablack likes this.
  12. Colors

    Colors

    Joined:
    Mar 22, 2013
    Messages:
    905
    Likes Received:
    250
    Best Answers:
    0
    If I remember correctly this system had a -big- bug/exploit in TFS 1.0, The player would be able to win every single zombie event with it... I might test it later.
     
  13. Printer

    Printer if Printer then print("LUA") end Premium User

    Joined:
    Dec 27, 2009
    Messages:
    5,594
    Likes Received:
    1,875
    Best Answers:
    5
    Cheers mate :p
    If you find out how, please tell me :p
     
  14. Alek

    Alek Premium User Premium User

    Joined:
    Feb 15, 2008
    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Code (Text):
    1. Lua Script Error: [TalkAction Interface]
    2. data/talkactions/scripts/zombie_join.lua:onSay
    3. data/talkactions/scripts/zombie_join.lua:11: attempt to compare nil with number
    4. stack traceback:
    5.         [C]: ?
    6.         data/talkactions/scripts/zombie_join.lua:11: in function <data/talkactio
    7. ns/scripts/zombie_join.lua:3>
     
  15. povedijah

    povedijah Member

    Joined:
    Jan 11, 2010
    Messages:
    91
    Likes Received:
    5
    Best Answers:
    0
    Thank your printer, thats a good works, after some errors little, for a missing functions, i get it on gitbub added to global.lua and working 100% , you do a perfect work bro, i see all of your scripts and you do it very good, im expected for your pet system , See more of your scripts! thanks!:)

    TFS : 1.0
     
  16. Tropix

    Tropix Like a BAuZZ

    Joined:
    Jan 6, 2009
    Messages:
    116
    Likes Received:
    4
    Best Answers:
    0
    Can you make it workable for 0.3.6tfs?
     
  17. Lordaeron

    Lordaeron Member

    Joined:
    Mar 15, 2014
    Messages:
    133
    Likes Received:
    7
    Best Answers:
    0
    Hm does it work with latest tfs?
     
  18. douglasscherner

    douglasscherner New Member

    Joined:
    Aug 15, 2014
    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    What is the correct the first post or of the comment?
     
  19. douglasscherner

    douglasscherner New Member

    Joined:
    Aug 15, 2014
    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Sorry. second part
     
  20. darkjav

    darkjav Senior Developer

    Joined:
    Apr 29, 2008
    Messages:
    183
    Likes Received:
    12
    Best Answers:
    0
    Hello, i have this problem:

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

    Code (Text):
    1. dofile('data/zombie_system.lua')
    2.  
    3. function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    4.     local monster = Monster(cid)
    5.     monster:say("I WILL BE BACK!", TALKTYPE_MONSTER_YELL)
    6.     monster:getPosition():sendMagicEffect(CONST_ME_MORTAREA)
    7.     doSummonZombie()
    8.     Game.setStorageValue(zeZombieCountGlobalStorage, Game.getStorageValue(zeZombieCountGlobalStorage) - 1)
    9. end
    10.  
    11. function onPrepareDeath(cid, killer)
    12.     local player = Player(cid)
    13.     local winner = 0
    14.     if player:getStorageValue(zeJoinStorage) == 1 then
    15.         Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) - 1)
    16.         player:teleportTo(player:getTown():getTemplePosition())
    17.         player:setStorageValue(zeJoinStorage, 0)
    18.         player:addHealth(player:getMaxHealth())
    19.         if Game.getStorageValue(zeJoinedCountGlobalStorage) <= 1 then --Event ended, someone won!
    20.             local players = Game.getPlayers()
    21.             for _, tmpPlayer in ipairs(players) do
    22.                 local stor = tmpPlayer:getStorageValue(zeJoinStorage)
    23.                 if stor == 1 then
    24.                     winner = tmpPlayer:getId()
    25.                     break
    26.                 end
    27.             end
    28.             winner = Player(winner)
    29.             if winner then
    30.                 winner:teleportTo(winner:getTown():getTemplePosition())
    31.                 local trophy = winner:addItem(zeTrophy, 1)
    32.                 local reward = winner:addItem(zeReward, 1)
    33.                
    34.                 if trophy then
    35.                     trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, '['.. winner:getName() ..'] has won the Zombie Event.')
    36.                 end
    37.                  broadcastMessage(string.format('%s is the winner of Zombie Event Versus %s Zombies.', winner:getName(), Game.getStorageValue(zeZombieCountGlobalStorage)), MESSAGE_STATUS_WARNING)
    38.             end
    39.             doClearZombieArena()
    40.             resetVariables()
    41.         end
    42.         return false
    43.     end
    44.     return true
    45. end
    Thanks for help.
     

Share This Page

Loading...