Creating an animevent: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
	
		
	
No edit summary  | 
				m (finished)  | 
				||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{npc tut}}  | {{npc tut}}  | ||
==Declaration==  | |||
Animevents are useful for adding mid-animation functionality.  | Animevents are useful for adding mid-animation functionality.  | ||
The first step to creating an animevent for your NPC is to create a name for it and add it to   | The first step to creating an animevent for your NPC is to create a name for it and add it to "Private animevents" section. Here's an example name for an animevent: '''COMBINE_AE_ALTFIRE'''.  | ||
Once the activity is added to the enum, you must use the '''DECLARE_ANIMEVENT''' macro in the '''AI_BEGIN_CUSTOM_NPC''' section.  | Once the activity is added to the enum, you must use the '''DECLARE_ANIMEVENT''' macro in the '''AI_BEGIN_CUSTOM_NPC''' section.  | ||
| Line 8: | Line 9: | ||
Here's an example of the DECLARE_ANIMEVENT code:  | Here's an example of the DECLARE_ANIMEVENT code:  | ||
<pre>	DECLARE_ANIMEVENT( NEWNPC_AE_ANIMEVENT )</pre>  | <pre>	DECLARE_ANIMEVENT( NEWNPC_AE_ANIMEVENT )</pre>  | ||
{{navbar|Creating a condition|Creating an NPC|Creating   | ==Implementation==  | ||
All event code is handled in <code>void CNPC_New::HandleAnimEvent( animevent_t *pEvent )</code>. If pEvent doesn't contain anything that needs to be caught and dealt with, <code>BaseClass::HandleAnimEvent</code> should be called.  | |||
{{navbar|Creating a condition|Creating an NPC|Creating a squadslot}}  | |||
[[Category:AI Programming]]  | |||
Latest revision as of 16:26, 13 June 2006
Declaration
Animevents are useful for adding mid-animation functionality.
The first step to creating an animevent for your NPC is to create a name for it and add it to "Private animevents" section. Here's an example name for an animevent: COMBINE_AE_ALTFIRE.
Once the activity is added to the enum, you must use the DECLARE_ANIMEVENT macro in the AI_BEGIN_CUSTOM_NPC section.
Here's an example of the DECLARE_ANIMEVENT code:
DECLARE_ANIMEVENT( NEWNPC_AE_ANIMEVENT )
Implementation
All event code is handled in void CNPC_New::HandleAnimEvent( animevent_t *pEvent ). If pEvent doesn't contain anything that needs to be caught and dealt with, BaseClass::HandleAnimEvent should be called.