Zombie Event BETA! [Tfs 1.0] Vers: 0.5

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

  1. Printer

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

    Joined:
    Dec 27, 2009
    Messages:
    5,600
    Likes Received:
    1,886
    Best Answers:
    5
    Can you try it without edit the values? Since i can't find any problem in that line.
     
  2. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    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!
     
  3. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    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
     
    Oualid likes this.
  4. Oualid

    Oualid Active Member

    Joined:
    Aug 24, 2014
    Messages:
    312
    Likes Received:
    42
    Best Answers:
    0
    Ooh lol didn't even see that I'll try it out tomorrow
     
  5. Oualid

    Oualid Active Member

    Joined:
    Aug 24, 2014
    Messages:
    312
    Likes Received:
    42
    Best Answers:
    0
    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
     
  6. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    Hehe, it happens!

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

    Best of luck!
     
  7. lopez65

    lopez65 Member

    Joined:
    May 10, 2012
    Messages:
    198
    Likes Received:
    9
    Best Answers:
    0
    hi
    I'm trying and when I say! zombie I get this error

    Code (Text):
    1.  
    2. Lua Script Error: [TalkAction Interface]
    3. data/talkactions/scripts/zombie_join.lua:onSay
    4. data/talkactions/scripts/zombie_join.lua:11: attempt to compare nil with number
    5. stack traceback:
    6.   [C]: in function '__lt'
    7.   data/talkactions/scripts/zombie_join.lua:11: in function <data/talkactio
    8. ns/scripts/zombie_join.lua:3>
    9.  
    10. Lua Script Error: [TalkAction Interface]
    11. data/talkactions/scripts/zombie_join.lua:onSay
    12. data/talkactions/scripts/zombie_join.lua:11: attempt to compare nil with number
    13. stack traceback:
    14.   [C]: in function '__lt'
    15.   data/talkactions/scripts/zombie_join.lua:11: in function <data/talkactio
    16. ns/scripts/zombie_join.lua:3>
    17.  

    zombie_onjoin.lua

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

    can someone please check the error
    thanks and regards
     
  8. Oualid

    Oualid Active Member

    Joined:
    Aug 24, 2014
    Messages:
    312
    Likes Received:
    42
    Best Answers:
    0
    Same here im getting errors when it's time for the event to start...

    @Printer
     
  9. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    Post the Error codes from Console. I think i can help you out.
     
  10. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    Can you post your full Zombie_system.lua please
     
  11. Oualid

    Oualid Active Member

    Joined:
    Aug 24, 2014
    Messages:
    312
    Likes Received:
    42
    Best Answers:
    0
    Can't atm im at school :p but it's exactlly the same as I posted before I just changed the teleport like you said
     
  12. lopez65

    lopez65 Member

    Joined:
    May 10, 2012
    Messages:
    198
    Likes Received:
    9
    Best Answers:
    0
    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 (Text):
    1. -- Zombie Variables
    2. zeZombieName = 'Zombie Event' --Zombie Name
    3. zombieSpawnInterval = 5 --how many seconds until a new zombie spawns
    4. zeMaxZombies = 20 --max zombies in the arena?
    5. zeJoinedCountGlobalStorage = 100 --Player joined event count
    6.  
    7. -- Players Variables
    8. zeJoinStorage = 1000 --player join storage
    9. zeMinPlayers = 1 --min players needed when time runout
    10. zeMaxPlayers = 2 --max players to join
    11. zeTrophy = 7369 --trophy itemid
    12. zeJoinedCountGlobalStorage = 101 --Zombie spawned Count
    13.  
    14. -- Other Variables
    15. zeWaitMinutes = 1 --when event has opened, how long until it starts?
    16. zeWaitingRoomPos = Position(16810, 16472, 7) --middle of waiting room
    17. zeZombieArena = Position(16941, 16561, 7) --when even start where should player be teleported in the zombie arena?
    18. zeArenaFromPosition = Position(16925, 16541, 7) --pos of top left corner
    19. zeArenaToPosition = Position(16969, 16581, 7) --pos of bottom right corner
    20. zeMiddleZombieArena = Position(16941, 16561, 7) --Middle pos of the arena
    21. zeWaitingRoomRadiusX = 20 --depends how big the waiting room is 20sqm to x
    22. zeWaitingRoomRadiusY = 20 --depends how big the waiting room is 20sqm to y
    23. zeZombieArenaRadiusX = 50 --Depends how big the zombie arena is 50sqm to x
    24. zeZombieArenaRadiusY = 50 --Depends how big the zombie arena is 50sqm to y
    25. zeStartedGlobalStorage = 102 -- Value: 0 == false, 1 == true, 2 == started --State of the event
    26. zeCreateTeleportPosition = Position(16810, 16479, 7) --Where should the teleport be created?
    27.  
    28. function startZombie()
    29.     local specs = Game.getSpectators(zeWaitingRoomPos, false, true, 0, zeWaitingRoomRadiusX, 0, zeWaitingRoomRadiusY)
    30.         if Game.getStorageValue(zeJoinedCountGlobalStorage) < zeMinPlayers then
    31.             for i = 1, #specs do
    32.                     specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false)
    33.                     specs[i]:setStorageValue(zeJoinStorage, 0)
    34.             end
    35.             resetVariables()
    36.             Game.broadcastMessage('Zombie Event failed to start, because of to little players joined the event!', MESSAGE_STATUS_WARNING)
    37.             return true
    38.         end
    39.  
    40.         for i = 1, #specs do
    41.             specs[i]:teleportTo(zeZombieArena)
    42.         end
    43.         Game.broadcastMessage("Zombie Event has started, good luck to all participant.", MESSAGE_STATUS_WARNING)
    44.         Game.setStorageValue(zeStartedGlobalStorage, 2)
    45.         doStartZombieEvasion()
    46. end
    47.  
    48. function doSummonZombie()
    49.         if Game.getStorageValue(zeZombieCountGlobalStorage) > zeMaxZombies then
    50.             return false
    51.         end
    52.  
    53.         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)})
    54.         if zombie then
    55.             Game.createMonster(zeZombieName, {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)})
    56.         end
    57.         Game.setStorageValue(zeZombieCountGlobalStorage, Game.getStorageValue(zeZombieCountGlobalStorage) + 1)
    58. end
    59.  
    60. function doStartZombieEvasion()
    61.         if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
    62.                doSummonZombie()
    63.             addEvent(doStartZombieEvasion, 5 * 1000)
    64.         end
    65. end
    66.  
    67. function resetVariables()
    68.         Game.setStorageValue(zeJoinedCountGlobalStorage, 0)
    69.         Game.setStorageValue(zeZombieCountGlobalStorage, 0)
    70.         Game.setStorageValue(zeStartedGlobalStorage, 0)
    71. end
    72.  
    73. function doClearZombieArena()
    74.         local specs = Game.getSpectators(zeMiddleZombieArena, false, false, 0, zeZombieArenaRadiusX, 0, zeZombieArenaRadiusY)
    75.         for i = 1, #specs do
    76.             if specs[i]:getName() == zeZombieName then
    77.                     specs[i]:remove()
    78.             end
    79.         end
    80. end
     
  13. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0

    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: Sep 11, 2014
    lopez65 likes this.
  14. Mister mox

    Mister mox New Member

    Joined:
    Mar 3, 2010
    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    you're god man, this realy work
     
  15. Printer

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

    Joined:
    Dec 27, 2009
    Messages:
    5,600
    Likes Received:
    1,886
    Best Answers:
    5
    Thanks.
     
  16. lopez65

    lopez65 Member

    Joined:
    May 10, 2012
    Messages:
    198
    Likes Received:
    9
    Best Answers:
    0
    @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
     
  17. Codinablack

    Codinablack Dreamer

    Joined:
    Dec 26, 2013
    Messages:
    1,162
    Likes Received:
    358
    Best Answers:
    0
    @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.
     
    FLE likes this.
  18. Printer

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

    Joined:
    Dec 27, 2009
    Messages:
    5,600
    Likes Received:
    1,886
    Best Answers:
    5
    TFS 1.0 has functions which doesn't exsist in 0.3/0.4 :p So 1.0 is a good way forward!
     
    Evil Puncker likes this.
  19. Mister mox

    Mister mox New Member

    Joined:
    Mar 3, 2010
    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    [​IMG]

    whats is wrong?
     
  20. Oscar Eriksson

    Oscar Eriksson SWE

    Joined:
    Sep 7, 2014
    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    Can you post your Zombie_teleport and Zombie_think.lua please
     

Share This Page

Loading...