Jump to content

zombies zone


Chaos

Recommended Posts

hi,

i have problem with this code when sometimes i kill 30 zombies the zombies won't respawn again why ?

       ZombieKills = 0 
      
    function teste() 
    for i=1,50 do 
    exports [ "zombiegamemode" ]:createZombie(-1095.76440+math.random(-4,30),-984.83356+math.random(-4,50),129.2187) 
    end 
    end 
  
addEventHandler ( "onResourceStart", getRootElement(), teste ) 
      
   addEventHandler("onZombieWasted",root, 
 function() 
  if (ZombieKills ~= 30) then 
   ZombieKills = ZombieKills+1 
  
   else 
    ZombieKills = 0 
    teste() 
  end 
   end) 
     
     
  
  
  

Link to comment
function teste() 
   for i=1,50 do 
      exports [ "zombiegamemode" ]:createZombie(-1095.76440+math.random(-4,30),-984.83356+math.random(-4,50),129.2187) 
   end 
end 
addEventHandler ( "onResourceStart", getRootElement(), teste ) 
      
addEventHandler("onZombieWasted",root, 
   function() 
      if not (ZombieKills) then 
         if (ZombieKills >= 30) then 
            teste () 
         end 
         ZombieKills = ZombieKills+1 
      else 
         ZombieKills = 1 
      end 
   end 
) 

Link to comment

IIYAMA still i already did added that

  
  
ZombieKills = 0 
    function teste() 
    for i=1,100 do 
    exports [ "zombiegamemode" ]:createZombie(2132.2060546875+math.random(-4,10),1025.4853515625+math.random(-4,10),10.8203125) 
    end 
    end 
addEventHandler ( "onResourceStart", getRootElement(), teste ) 
  
  
  
    addEvent ( "onZombieWasted", true ) 
   addEventHandler("onZombieWasted",root, 
 function() 
     
     
          if ZombieKills < 30 then-- till 29 
       ZombieKills = ZombieKills+1 
       else --30 or higher = reset. 
        ZombieKills = 0 
        teste() 
      end 
      end) 
  
  

Link to comment
  • Moderators

Then why are you saying it doesn't work..... when it does work.....

When the zombies spawn some of them will end up in buildings etc. and will fall in to ground. So there will never be 50 at the same Area

Also:

addEventHandler ( "onResourceStart", getRootElement(), teste ) 

Should be:

addEventHandler ( "onResourceStart", resourceRoot, teste ) 

Else with every resource that starts, there will be more zombies.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...