Jump to content

Singleplayer mod NPC spawnscript


Recommended Posts

I'm making a SP mod and I need to have some NPCs walking around and doing things in one area. I have a rebel NPC I want to alternate between looking at a console and leaning back against a wall. I setup two waypoint_navgoals with targetnames rebel2_nav1 and rebel2_nav2. They've also got angles set on them. Here is the spawnscript for my rebel NPC, who starts out with the cinematic behavioral state.

 

 

 

//Generated by BehavEd


affect ( "rebel2", /*@AFFECT_TYPE*/ FLUSH )
{
	set ( /*@SET_TYPES*/ "SET_WEAPON", /*@[member='weaponx']_NAMES*/ "WP_NONE" );

	task ( "nav1" )
	{
		set ( /*@SET_TYPES*/ "SET_WALKING", /*@BOOL_TYPES*/ "true" );
		set ( /*@SET_TYPES*/ "SET_NAVGOAL", "rebel2_nav1" );
	}


	task ( "nav2" )
	{
		set ( /*@SET_TYPES*/ "SET_WALKING", /*@BOOL_TYPES*/ "true" );
		set ( /*@SET_TYPES*/ "SET_NAVGOAL", "rebel2_nav2" );
	}


	task ( "nav2_getup" )
	{
		set ( /*@SET_TYPES*/ "SET_ANIM_BOTH", /*@ANIM_NAMES*/ "BOTH_STAND10TOSTAND1" );
	}


	loop ( -1 )
	{
		dowait ( "nav1" );
		set ( /*@SET_TYPES*/ "SET_WALKING", /*@BOOL_TYPES*/ "false" );
		set ( /*@SET_TYPES*/ "SET_ANGLES", $tag( "rebel2_nav1", ANGLES)$ );
		set ( /*@SET_TYPES*/ "SET_ANIM_BOTH", /*@ANIM_NAMES*/ "BOTH_STAND4" );
		set ( /*@SET_TYPES*/ "SET_ANIM_HOLDTIME_BOTH", 10000 );
		wait ( 10000.000 );
		dowait ( "nav2" );
		set ( /*@SET_TYPES*/ "SET_WALKING", /*@BOOL_TYPES*/ "false" );
		set ( /*@SET_TYPES*/ "SET_ANGLES", $tag( "rebel2_nav2", ANGLES)$ );
		set ( /*@SET_TYPES*/ "SET_ANIM_BOTH", /*@ANIM_NAMES*/ "BOTH_STAND10" );
		set ( /*@SET_TYPES*/ "SET_ANIM_HOLDTIME_BOTH", 7000 );
		wait ( 7000.000 );
		dowait ( "nav2_getup" );
	}

}

 

 

 

 

The script starts out working correctly, but somewhere in the second iteration of the loop it breaks down. The NPC goes to nav1, stands for the right amount of time with the correct angles and animation, then correctly goes to nav2 and leans back on the wall, again with the correct angles and animation. It stands back up and goes back to nav1, entering the second iteration of the loop, it stands staring at the console, but then when it's supposed to walk to nav2, it instead goes directly into the lean animation and moves, without playing a walking animation, to nav2, where it faces the wrong angle. Then it shows similar behavior when it tries to go back to nav1. Does anyone know what's wrong with my script?

 

EDIT: Forgot to mention, I started the map with icarus debug enabled, didn't see any error messages.

Link to comment

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