Task

From Valve Developer Community
Revision as of 12:23, 25 October 2006 by Kateye (talk | contribs)
Jump to navigation Jump to search

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() )