What it is and What is Needed in an Actbusy Sequence
The actbusy system is used to make NPCs appear busy. NPCs do so on placed nodes and will act busy until certain conditions are met (such as hearing an explosion).
You will need:
An ai_goal_actbusy which gives control over which NPCs and when, where and what actbusy actions he will play
At least one info_node_hint with Hint set to World: Act Busy. This is used to specify where the NPCs will play the actbusy action
The actbusy.txt for reference on what the act busy actions are. Located in you mod/scripts directory.
With all this and one or more NPCs you will be able to make them appear to be doing things instead of walking around aimlessly!
How it All Works
Before we can start to set it up we must first understand what it is and how it works:
The ai_goal_actbusy tells one or more NPCs to act busy. The NPCs will then choose from the avalible hint nodes unless certain parameters are not met:
The node type must be set to World: Act Busy Hint
The distance to the node must be less than the radius specified by the Search
Range for Busy Hints key in the ai_goal_actbusy
The node must not be locked by any other NPC
The NPC must be able to play the animations required by the node
NPCs lock their intended hint node before even moving to it. This stops several NPCs from walking into each other on the same node
The actbusy.txt holds all the actbusy actions. to save time i will give you an example:
"sit_in_chair_03"
{
"busy_sequence" "Sit_Chair03"
"entry_sequence" "Idle_to_Sit_Chair03"
"exit_sequence" "Sit_Chair03_to_Idle"
"min_time" "10.0"
"max_time" "20.0"
"interrupts" "BA_INT_COMBAT"
}
To use this sequence you would specify sit_in_chair_03 in the Hint Activity of the actbusy hint node. The actbusy sequence specifies which animations are played, how long, and what can interuppt the NPC. Like so: an NPC would choose this hint node, walk to it then play the Idle_to_Sit_Chair03 animation. He would then loop the Sit_Chair03 animation. The min_time and max_time entries would make this NPC actbusy for some time between 10 to 20 seconds. The BA_INT_COMBAT parameter would break the NPC away from the busy animation if he saw and enemy or heard a nearby combat sound. When the NPC leaves (because of a time expiration or an interruption) he would play the Sit_Chair03_to_Idle animation then go back to normal AI.
Note that some Actbusy entries specify 0 min & max times. NPCs using these entries will never leave the node due to a timeout. If the entry also specifies an interrupt of BA_INT_NONE, the NPC will never leave the node, until they receive an input or output telling them to do so.
Putting it All Together
You need an NPC, an ai_goal_actbusy, one or more (for multiple NPCs it is preferable if there are extra nodes) info_hint_nodes. Name the NPC something like actbusy_citizen_01.
Then in the ai_goal_actbusy specify the NPC's name in the Actors to affect keyvalue. Make the Search Range fo Busy Hints 1024 to give him plenty of space.
Place a couple of info_hint_nodes where you want them, set the hint to World: Act Busy and specify what actbusy sequence you want the NPC to play when it reaches the node.
Set up a trigger to send an input to the ai_goal_actbusy to Activate and when compilied and triggered it you should have a citizen walking to the nodes playing a busy animation!
Debugging
the ai_debug_actbusy convar is the easiest way to debug act busy problems. Set it to a value between 1 & 4. the values are as follows:
1 - Constantly draws a line from each NPC to their selected act busy node.
2 - Whenever any NPC chooses to act busy, draw a line to the selected node, and draw the NPC's hull at the node. This is useful to spot nodes placed in locations where the NPC will be unable to actually stand on the node. Make sure the NPC's hull doesn't interpenetrate the world around the node.
3 - Selected NPCs will display why they're not able to choose act busy nodes.
To use this, select the desired NPC with the npc_select command. When that NPC next looks for an act busy node, you'll see a small text string appear on every node explaining why the NPC didn't choose that node.
4 - Display all act busy logic.
This will show you all the logic decisions that each NPC makes as it runs the act busy AI. It's mostly useful for detecting bad entity I/O in the map.