Talk:Task

From Valve Developer Community
Jump to: navigation, search

What, so a schedule *has* to be a *linear* sequence of tasks? The article should probably explain why that limitation exists, if it does. --TomEdwards 12:52, 25 Oct 2006 (PDT)


Well, yes and no... The article doesn't appear to mention interrupts, which is probably what you are looking for in terms of non-linearity. For instance, in AI_Behavior_Follow.cpp we find the following schedule:

//=========================================================
// > SCHED_FOLLOW
//=========================================================
DEFINE_SCHEDULE
(
    SCHED_FOLLOW,

    "   Tasks"
    "       TASK_GET_PATH_TO_FOLLOW_POSITION 0"
    "       TASK_MOVE_TO_FOLLOW_POSITION    0"
    "       TASK_WAIT_FOR_MOVEMENT          0"
    "       TASK_SET_SCHEDULE               SCHEDULE:SCHED_TARGET_FACE "
    ""
    "   Interrupts"
    "       COND_NEW_ENEMY"
    "       COND_LIGHT_DAMAGE"
    "       COND_HEAVY_DAMAGE"
    "       COND_HEAR_DANGER"
    "       COND_PROVOKED"
    "       COND_PLAYER_PUSHING"
    "       COND_BETTER_WEAPON_AVAILABLE"
);

As far as I can tell, the idea here is that the NPC doing the following will try to complete those 4 tasks in a linear fashion. If at any time any of those conditions pop up, it'll immediately fail the schedule, and then pick a new one based on the new list of conditions. Keep in mind I'm only just starting to grasp all this myself, so don't take my word for it. --Rokiyo 02:17, 6 Dec 2006 (PST)