Task: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 9: Line 9:
'''''ADDING A TASK TO A NPC CLASS'''''
'''''ADDING A TASK TO A NPC CLASS'''''
*Add the task to an enum declaration in your class :  
*Add the task to an enum declaration in your class :  
<code>
<pre>
enum
enum
{
{
Line 16: Line 16:
     TASK_THREE,
     TASK_THREE,
}
}
</code>
</pre>





Revision as of 12:23, 25 October 2006

A task is a logical step in a schedule, it can be seen as a sequential set of steps the NPC must take in order to accomplish a schedule.

A task becomes latent if TaskComplete() or TaskFail() isn't called. Meaning the schedule will not procede to the next task until the current one has been taken care of.

If a task fails the schedule will fail and exit. It will NOT proceed to the next task.


ADDING A TASK TO A NPC CLASS

  • Add the task to an enum declaration in your class :
enum
{
    TASK_ONE = BaseClass::NEXT_SCHEDULE,
    TASK_TWO,
    TASK_THREE,
}


  • Declare the task below the AI_BEGIN_CUSTOM_NPC(...) using the DECLARE_TASK(...) macro.
  • Add your case to the StartTask()
  • Add your case to RunTask() ( needed if TaskComplete() not called in StartTask() )