Jump to content

Home

Walk Walkways in OnSpawn entry


Seamhainn

Recommended Posts

Hello!

 

This seems to be the in-game script to make npcs walk Waypoints:

//:: k_act_walkways2
/*
   walk waypoints
*/
//:: Created By:  Jason Booth
//:: Copyright (c) 2002 Bioware Corp.

#include "k_inc_generic"
#include "k_inc_debug"

void main()
{
   GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_DEACTIVATE, FALSE);
   ClearAllActions();
   DelayCommand(1.0, GN_WalkWayPoints());
}

I included two Waypoints in the .git file.

 

My questions are:

- Does this script work at all?

- I assume the script must be assigned to the OnSpawn entry of the .utc file of the npc?

- How can I make the npc RUN along those Waypoints and not just walk?

 

Thanks!

Link to comment
Share on other sites

Hello!

 

This seems to be the in-game script to make npcs walk Waypoints:

k_act_walkways2

 

My questions are:

- Does this script work at all?

- I assume the script must be assigned to the OnSpawn entry of the .utc file of the npc?

- How can I make the npc RUN along those Waypoints and not just walk?

 

Waypoint walking is handled by the generic AI scripts assigned to most creatures. To set up a patrol route that an NPC automatically walks around the area along you place a series of waypoints whose tag consist of the NPC's tag with a WP_ prefix and a _# suffix (where # is a sequential number).

 

If, for example, you have an NPC with the tag Bastila which you want to move around along four waypoints in the area you set the tag of those waypoints to WP_Bastila_01, WP_Bastila_02, WP_Bastila_03 and WP_Bastila_01. The NPC will then move to them in the numbered sequence, and when reaching the last one patrol backwards to the first one, etc.

 

You can also use it to make sure NPCs stay at a specific location which they return to after combat or the like. Then you place a waypoint whose tag is the tag of the NPC with a POST_ prefix, like POST_Bastila.

 

Any creature with the standard AI scripts will automatically start patrolling if such waypoints exist in their area, no other scripts are needed.

 

The standard AI scripts will however default to walking. To make the NPC run along their waypoints instead you will need to give them a custom AI script based on k_def_spawn01.nss but where you add a line with..

GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_RUN);

...on it.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...