Nuclide
Software Development Kit for id Technology (BETA)
NPC: Schedules & Tasks

Scheduled tasks for computer controlled characters. More...

Detailed Description

Scheduled tasks for computer controlled characters.

Schedules

Computer controlled NPC actors execute tasks within the game-world as part of a Schedule.

Using Schedules

Schedules are defined within decl exclusively.

A schedule decl looks something like this:

scheduleDef dodgeEnemyFire
{
"task_1" "FindDodgeDirection 3"
"task_2" "Jump"
"OnLightDamage" "EndTask"
}

You will pass the name dodgeEnemyFire to ncSchedule::CreateSchedule() to assign the the above decl, if defined, to the targetted actor.

The actor will then iterate over each of the task_ keys, until it finishes every task in the named schedule.

You can also define when a schedule should end, besides when it's running out of tasks. Specifying a named output of an actor (such as OnLightDamage) will, if activated, trigger this schedule's' EndTask input.

Tasks

A task is a single action that an NPC can perform. They are routinely part of a Schedule.

A task is merely a predefined Input. So anything an Input can provide, can be utilized in a task.

Automatic Functionality

NPC classes call ncActor::SelectNewSchedule() routinely to find a new purpose within the game world.

The function will then return the handle of a new ncSchedule, or NULL if it's unable to do anything at all.

The NPC will then automatically perform the named schedule, if it is valid of course.

Testing Schedules

When debugging schedules, it is most convenient to use the following Input for this task:

input 125 PerformSchedule foobar

Will tell an actor with the entity id 125 to perform the named schedule foobar.

Classes

class  ncSchedule