diff --git a/Dev_Actions_Schedules.md b/Dev_Actions_Schedules.md index ba53d89..498d90e 100644 --- a/Dev_Actions_Schedules.md +++ b/Dev_Actions_Schedules.md @@ -1,9 +1,9 @@ -Actions and Schedules -====================== +# Actions and Schedules The interesting part of Advanced NPC is its ability to simulate realistic behavior in NPCs. Realistic behavior is defined simply as being able to perform tasks at a certain time of the day, like usually people do. This allow the NPC to go to bed, sleep, get up from it, sit in benches, etc. But how all of this is simulated? The answer is: tasks and scheduling. The implementation resembles a rough OS process scheduling algorithm where only one process is allowed at a time. The processes or tasks are held in a queue, where they are executed one at a time in queue fashion. Interruptions are allowed, and the interrupted action is re-started once the interruption is finished. -###Actions and Tasks + +### Actions and Tasks Actions are "atomic" executable actions the NPC can perform. Tasks are sequences of actions that are common enough to be supported by default. Advanced NPC supports 16 actions and tasks by default which can be used together to simulate tasks that players can do. Each action or task is wrapped on a Lua table which tells the action/task to be executed and the arguments to be used. However, this is encapsulated to the user in the following two functions: - `npc.add_action(action, args)` - `npc.add_task(task, args)`