Jump to content

NPC Respawn


Go to solution Solved by Ramikad,

Recommended Posts

Posted

Working on a RP Server
I want to add EXP System (if its possible can you write it how to do it? ) and i'm working on a map.
Is that possible to add npcs who will respawn example 10 min later again,after we kill them? 

Posted

Sure. Make a script which uses the NPC spawner, like this:

//(BHVD)
use ( "<NPC spawner targetname>" );

Create a NPC spawner and give it a targetname, set the count to how many NPCs it's supposed to spawn and delay to 10 minutes (I'm not sure if delay is counted in seconds or milliseconds, so 10 minutes must be either 600 seconds or 600000 milliseconds), and set the NPC spawner deathscript to that script.

 

Otherwise you can set up a similar NPC spawner, but without delay, and instead use this deathscript:

//(BHVD)
wait ( 600000.000 );
use ( "<NPC spawner targetname>" );

so that you wouldn't have to wait for 10 minutes after the spawner is triggered for the first time.

You'll need a script or a func_usable (or similar entity) to use it and trigger the spawn for the first time, so keep that in mind.

 

Edit: Whoops, made a mistake in the second script, fixed now.

GPChannel likes this
Posted

Sure. Make a script which uses the NPC spawner, like this:

//(BHVD)
use ( "<NPC spawner targetname>" );

Create a NPC spawner and give it a targetname, set the count to how many NPCs it's supposed to spawn and delay to 10 minutes (I'm not sure if delay is counted in seconds or milliseconds, so 10 minutes must be either 600 seconds or 600000 milliseconds), and set the NPC spawner deathscript to that script.

 

Otherwise you can set up a similar NPC spawner, but without delay, and instead use this deathscript:

//(BHVD)
wait ( 600000.000 );
use ( "<NPC spawner targetname>" );

so that you wouldn't have to wait for 10 minutes after the spawner is triggered for the first time.

You'll need a script or a func_usable (or similar entity) to use it and trigger the spawn for the first time, so keep that in mind.

 

Edit: Whoops, made a mistake in the second script, fixed now.

can you show it w pictures how to do it pls :P

Never did this before 

  • Solution
Posted

Create a script like this with BehavED:

 

 

scr1.png

 

 

In this case, just for a test I set up a wait time of 6 seconds (6000 milliseconds). Compile and put the .IBI in the scripts folder of your mod.

Now in Radiant set up a NPC spawner like this:

 

 

scr2.png

 

 

Set the count of the NPC spawner to whatever number of enemies you want to fight. Create a func_usable and link it (Ctrl + K) to the NPC spawner, so that it's used at least once, otherwise it won't work, since it has a targetname. Using the button will spawn the enemy, and once the enemy is dead another will spawn after the time previously set in the script (in this case, 6 seconds).

GPChannel likes this

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
×
×
  • Create New...