Creating an interaction: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
	
 Note:An interaction should only be declared in one NPC's
Note:An interaction should only be declared in one NPC's 
		
	
| JurgenKnops (talk | contribs) m (Spam revert.) | Robber9000 (talk | contribs)  mNo edit summary | ||
| (14 intermediate revisions by 10 users not shown) | |||
| Line 1: | Line 1: | ||
| {{npc tut}} | {{npc tut}} | ||
| Interactions are messages that are transmitted between NPCs, such as allowing one NPC to dodge an attack, or to fly in a specific direction and set a certain state when kicked. | |||
| == Declaration == | == Declaration == | ||
| The first step to creating an interaction for your NPC is to create a name for it and add it to the "Interactions" section as well as adding it to <code>src\dlls\hl2_dll\AI_Interactions.h</code> Here's an example name for an activity: '''g_interactionVortigauntKick'''. | The first step to creating an interaction for your [[NPC]] is to create a name for it and add it to the "Interactions" section as well as adding it to <code>src\dlls\hl2_dll\AI_Interactions.h</code>. Here's an example name for an activity: '''g_interactionVortigauntKick'''. | ||
| Once the activity is added, you must use the  | Once the activity is added, you must use the <code>DECLARE_INTERACTION</code> macro in the <code>AI_BEGIN_CUSTOM_NPC</code> section. | ||
| Here's an example of the DECLARE_INTERACTION code: | Here's an example of the DECLARE_INTERACTION code: | ||
| <pre>	DECLARE_INTERACTION( g_interactionExample )</pre> | <pre>DECLARE_INTERACTION( g_interactionExample )</pre> | ||
| {{note|An interaction should only be declared in one NPC's  | {{note|An interaction should only be declared in one NPC's <code>AI_BEGIN_CUSTOM_NPC</code> section, regardless of how many NPCs utilize it.}} | ||
| ==Implementation== | |||
| {{ | == Implementation == | ||
| {{TODO|Implementation}} | |||
| {{navbar|Creating a squadslot|Creating an NPC|Creating a schedule}} | {{navbar|Creating a squadslot|Creating an NPC|Creating a schedule}} | ||
| [[Category:AI Programming]] | [[Category:AI Programming]] | ||
Latest revision as of 21:00, 8 May 2010
Interactions are messages that are transmitted between NPCs, such as allowing one NPC to dodge an attack, or to fly in a specific direction and set a certain state when kicked.
Declaration
The first step to creating an interaction for your NPC is to create a name for it and add it to the "Interactions" section as well as adding it to src\dlls\hl2_dll\AI_Interactions.h. Here's an example name for an activity: g_interactionVortigauntKick.
Once the activity is added, you must use the DECLARE_INTERACTION macro in the AI_BEGIN_CUSTOM_NPC section.
Here's an example of the DECLARE_INTERACTION code:
DECLARE_INTERACTION( g_interactionExample )
 Note:An interaction should only be declared in one NPC's
Note:An interaction should only be declared in one NPC's AI_BEGIN_CUSTOM_NPC section, regardless of how many NPCs utilize it.Implementation
Todo: Implementation