Creating an activity: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (condition)
No edit summary
Line 1: Line 1:
{{npc tut}}
{{npc tut}}
==Declaration==
The first step to creating an activity for your NPC is to create a name for it and add it to the enum. Here's an example name for an activity: '''ACT_COMBINE_BUGBAIT'''.
The first step to creating an activity for your NPC is to create a name for it and add it to the enum. Here's an example name for an activity: '''ACT_COMBINE_BUGBAIT'''.


Once the activity is added to the enum, you must use the '''DECLARE_ACTIVITY''' macro in the '''AI_BEGIN_CUSTOM_NPC''' section.
Once the activity is added, you must use the '''DECLARE_ACTIVITY''' macro in the '''AI_BEGIN_CUSTOM_NPC''' section.


Here's an example of the DECLARE_ACTIVITY code:
Here's an example of the DECLARE_ACTIVITY code:
<pre> DECLARE_ACTIVITY( ACT_NEWNPC_ACTIVITY )</pre>
<pre> DECLARE_ACTIVITY( ACT_NEWNPC_ACTIVITY )</pre>
{{note|It is not necessary to declare shared activities.}}
{{note|It is not necessary to declare shared activities.}}
==Implementation==
{{todo|Implementation}}
{{navbar|Creating a task|Creating an NPC|Creating a condition}}
{{navbar|Creating a task|Creating an NPC|Creating a condition}}

Revision as of 13:33, 8 June 2006

Declaration

The first step to creating an activity for your NPC is to create a name for it and add it to the enum. Here's an example name for an activity: ACT_COMBINE_BUGBAIT.

Once the activity is added, you must use the DECLARE_ACTIVITY macro in the AI_BEGIN_CUSTOM_NPC section.

Here's an example of the DECLARE_ACTIVITY code:

	DECLARE_ACTIVITY( ACT_NEWNPC_ACTIVITY )
Note.pngNote:It is not necessary to declare shared activities.

Implementation

Todo: Implementation