• Creating waves?
    4 replies, posted
So I'm planning on makeing a gamemode based on this flash game: [url]http://www.stickgames.com/artillery-tower.html[/url] because it's basic, should be moderate to code for a person who has trouble learning lua, and because the game is just fucking awesome. I know I will have to use a timer, Ent:Spawn or Ent:Respawn, and getpos ingame ofcourse to get the coördinates where to spawn the enemies. Now the main question is, how do I create a spawning code. And how do I get it to act in waves. So instead of that they keep on spawning, they spawn for 2 minutes, then there is a break of 1 minute where a shop becomes active. And after that minute the spawning continues and the shop is closed.
Ok I personally would use my version of Devenger's spawn platforms. I'll upload it in a minute. Then I'd spawn a platform for each type of NPC and set the keyvalues appropriately. Then, for the waves: [lua]local platforms = {} local posses = {} for i = -12,12,12 do for j = -12,12,12 do table.insert(posses,Vector(i,j,12)); end end function GM:InitPostEntity() local plat for _,pos in ipairs(posses) do plat = ents.Create("sent_spawnplatform"); --set keyvalues table.insert(platforms,plat); end timer.Create("TurnWaveOff",120,1,function() for _,ent in ipairs(platforms) do ent:TurnOff(); ent:RemoveNPCs(); end timer.Start("TurnWaveOn"); end); timer.Adjust("TurnWaveOn",60,1,function() for _ent in ipairs(platforms) do ent:TurnOn(); end timer.Start("TurnWaveOff"); end);[/lua] Obviously the first bit is nonsense, but it shows the general principal. [editline]09:19PM[/editline] Ok by "in a minute" I mean "in about half an hour"
Sweet, i need that one too :)
[url=http://www.garrysmod.org/downloads/?a=view&id=83634][img]http://www.garrysmod.org/img/?t=dll&id=83634[/img][/url] Enjoy.
Thanks mate! I'll go try some stuff with it.
Sorry, you need to Log In to post a reply to this thread.