Jump to content

Background NPC's & Performance Issues


Recommended Posts

Posted

I have all my NPC's set to  triggers throughout my maps but some of these are in the background. You may pass them off on a tram ride or see them behind glass windows. Is it worth it to kill them off if the player can't get back to that area again or not ? 

 

 

Posted

Yeah. I had a similar project where the map was a HUGE city, and we wanted tons of NPCs to populate the area. However, 16+ NPCs per city area did not bode well for performance. So I had triggers to remove NPCs as you left an area, and spawned the NPCs for the next area. I'd also put another trigger that respawned the old ones, just in case the player wanted to go back.

Posted

I'd set their behavior state to "remove" (I think this is a thing) and it will remove the NPC when it is not in the Player's view. Also, you could use the "remove" command with each NPC's script targetname.

Posted

I'd set their behavior state to "remove" (I think this is a thing) and it will remove the NPC when it is not in the Player's view. Also, you could use the "remove" command with each NPC's script targetname.

affect ( "type1", 56 )
{

	task ( "type" )
	{
		set ( "SET_ANIM_BOTH", "BOTH_CONSOLE1" );
		set ( "SET_ANIM_HOLDTIME_BOTH", -1.000 );
		set ( "SET_NOTARGET", "true" );
		set ( "SET_IGNOREENEMIES", "true" );
		set ( "SET_HEALTH", 2.000 );
	}

	do ( "type" );
	wait ( "type" );
}

Above is one of my character animation scripts for typing. Would I put the behavior state "remove" in the colored section of my script? 

Posted

Yeah, type task. I actually colored the commands red in there but it didn't show up in the post... which is why I mentioned colored section. 

 

So, how will I know they remove if I cannot see them? I'm just curious.

therfiles likes this
Posted

I think that is behavior is set to remove the the NPC when they leave player view. In my scenario, I'd trigger the removal trigger. I could turn around and still see them, but as soon as they leave view completely they should be removed. In your instance, I'd just confirm that they disappeared using "use list" in the console and see if the NPCs show up.

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