Task: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 24: Line 24:


*Add your case to RunTask() ( needed if TaskComplete() not called in StartTask() )
*Add your case to RunTask() ( needed if TaskComplete() not called in StartTask() )
==See Also ==
*[[Creating a task]]
*[[Shared tasks]]






[[Category:AI Programming]]
[[Category:AI Programming]]

Revision as of 15:26, 8 April 2008

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


See Also