Jump to content

zombies zone


Chaos

Recommended Posts

Posted

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) 
     
     
  
  
  

Posted
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 
) 

  • Moderators
Posted

Should be:

  if ZombieKills < 30 then-- till 29 
   ZombieKills = ZombieKills+1 
   else --30 or higher = reset. 
    ZombieKills = 0 
    teste() 
  end 

Posted

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) 
  
  

  • Moderators
Posted

and where are your debug stuff?

You don't even know if the event did triggered when a zombie died.

  • Moderators
Posted

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.

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...