Jump to content

Home

spawn npc every X seconds?


d_eisenga

Recommended Posts

i want to make a map where a new NPC is spawned every X seconds(but only if there arent already X NPCs on the map). i know you can spawn a new NPC when en existing NPC dies but that requires you to put all the NPCs into the map and link them to eachother, and that means the level isnt 'endless', which is what i'm going for. kinda like an exhaustion or endurance level.

 

so i thought, i'll just run a script which will wait X seconds and spawn an NPC, and repeat that process forever. but i cant find a command in behaved to spawn an npc, or to check for the current number of npcs(though i suppose i could use a counter for that.)

 

can anyone help?

Link to comment
Share on other sites

Try this:

 

Mark all NPC then give them:

key:count

value:100000000000

or how many times u want the npc to spawn

 

and:

 

key:tagetname

value:npc

 

______________________________

 

then make a func_timer

give it:

value:count

key: how many sec u want

 

and:

 

value:target

key:npc

 

 

 

that would do it,,,,,

Link to comment
Share on other sites

yes, it works perfectly! thanks a lot.

 

one more thing though, with all those npcs getting killed, a lot of dead bodies and dropped weapons pile up on my map. the bodies disappear(if only when they go off-screen) but the weapons dont disappear unless i pick them up, and this level is designed to be played mostly with the saber. how do i make these disappear(at least the weapons but the bodies too if possible)?

 

thanks!

Link to comment
Share on other sites

Do you want there to always be X number of npcs?

If so then you just have it spawn its self every time it dies. There are two ways, either have X number of npc that spawn them selves or have one that will spawn x times at the beginning then spawn as you go along

 

Zag, there is already a shader like that in textures/system/nodrop

Link to comment
Share on other sites

thanks guys.

 

i considerd doing the spawning that way, but i dont want the number of NPCs to be constant. i just want a maximum. but the way the level is designed it shouldnt be possible to crash the game with too many NPCs so i dont need to limit it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...