Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

spawn npc every X seconds?

Page: 1 of 1
 d_eisenga
06-13-2004, 7:04 AM
#1
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?
 snife
06-13-2004, 9:45 AM
#2
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,,,,,
 d_eisenga
06-13-2004, 9:58 AM
#3
thanks, i'll try that right away :)
 GothiX
06-13-2004, 10:08 AM
#4
Count -1 would work better.
 d_eisenga
06-13-2004, 6:07 PM
#5
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!
 zag
06-14-2004, 12:29 PM
#6
make shader with the surfaceparm "nodrop"
any one that dies inside of this brush wont drop a weapon i think
 *Dark
06-14-2004, 3:55 PM
#7
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
 d_eisenga
06-14-2004, 5:12 PM
#8
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.
 *Dark
06-15-2004, 3:57 PM
#9
you should be carefull though, more that about 10 and the game really laggs, just try to limit it and you should be fine ;)
Page: 1 of 1