Creating an activity: Difference between revisions
Jump to navigation
Jump to search
Note:It is not necessary to declare shared activities.
m (categorize) |
m (completed) |
||
Line 9: | Line 9: | ||
{{note|It is not necessary to declare shared activities.}} | {{note|It is not necessary to declare shared activities.}} | ||
==Implementation== | ==Implementation== | ||
Activities are used in schedules and utilize one of these 2 tasks: | |||
* TASK_PLAY_SEQUENCE | |||
* TASK_SET_ACTIVITY | |||
===Examples=== | |||
DEFINE_SCHEDULE | |||
( | |||
SCHED_COMBINE_BUGBAIT_DISTRACTION, | |||
" Tasks" | |||
" TASK_STOP_MOVING 0" | |||
" TASK_RESET_ACTIVITY 0" | |||
" TASK_PLAY_SEQUENCE ACTIVITY:ACT_COMBINE_BUGBAIT" | |||
"" | |||
" Interrupts" | |||
"" | |||
) | |||
DEFINE_SCHEDULE | |||
( | |||
SCHED_COMBINE_BURNING_STAND, | |||
" Tasks" | |||
" TASK_WAIT_RANDOM 0.3" | |||
" TASK_SET_ACTIVITY ACTIVITY:ACT_COMBINE_BUGBAIT" | |||
" TASK_WAIT 2" | |||
" TASK_WAIT_RANDOM 3" | |||
" TASK_COMBINE_DIE_INSTANTLY DMG_BURN" | |||
" TASK_WAIT 1.0" | |||
"" | |||
" Interrupts" | |||
"" | |||
) | |||
===TASK_PLAY_SEQUENCE=== | |||
This task does not reset the activity, but it does factor in AutoMovement capabilities. | |||
===TASK_SET_ACTIVITY=== | |||
This task resets the activity, but it does not factor in AutoMovement capabilities. | |||
{{navbar|Creating a task|Creating an NPC|Creating a condition}} | {{navbar|Creating a task|Creating an NPC|Creating a condition}} | ||
[[Category:AI Programming]] | [[Category:AI Programming]] |
Revision as of 17:21, 13 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 )

Implementation
Activities are used in schedules and utilize one of these 2 tasks:
- TASK_PLAY_SEQUENCE
- TASK_SET_ACTIVITY
Examples
DEFINE_SCHEDULE ( SCHED_COMBINE_BUGBAIT_DISTRACTION, " Tasks" " TASK_STOP_MOVING 0" " TASK_RESET_ACTIVITY 0" " TASK_PLAY_SEQUENCE ACTIVITY:ACT_COMBINE_BUGBAIT" "" " Interrupts" "" )
DEFINE_SCHEDULE ( SCHED_COMBINE_BURNING_STAND, " Tasks" " TASK_WAIT_RANDOM 0.3" " TASK_SET_ACTIVITY ACTIVITY:ACT_COMBINE_BUGBAIT" " TASK_WAIT 2" " TASK_WAIT_RANDOM 3" " TASK_COMBINE_DIE_INSTANTLY DMG_BURN" " TASK_WAIT 1.0" "" " Interrupts" "" )
TASK_PLAY_SEQUENCE
This task does not reset the activity, but it does factor in AutoMovement capabilities.
TASK_SET_ACTIVITY
This task resets the activity, but it does not factor in AutoMovement capabilities.