Task

From Valve Developer Community
Revision as of 16:37, 3 August 2005 by Fluxtah (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

custom tasks may be added to your NPC by first declaring a new enum.

enum 
{
	TASK_JUMP = LAST_SHARED_TASK,
        TASK_FIND_DODGE_DIRECTION,
 
};

Then you would need to add the tasks in your custom schedule in the order you wish them to execute, notice TASK_FIND_DODGE_DIRECTION has been given a value of 200, you can pass data through with your tasks and use them when the task logic is executed.

AI_BEGIN_CUSTOM_NPC( npc_custom, CNPC_Custom )
DEFINE_SCHEDULE
(
	SCHED_DODGE_ENEMY_FIRE,

	"	Tasks"
	"		TASK_FIND_DODGE_DIRECTION	3"
	"		TASK_JUMP	 		0"
	""
	"	Interrupts"
        "               COND_LIGHT_DAMAGE"
);

AI_END_CUSTOM_NPC()