AgendaItemclass | actor.t[5511] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
On any given turn, an actor can carry out only one agenda item.
Agenda items are a convenient way of controlling complex behavior. Each agenda item defines its own condition for when the actor can pursue the item, and each item defines what the actor does when pursuing the item. Agenda items can improve the code structure for an NPC's behavior, since they nicely isolate a single background action and group it with the conditions that trigger it. But the main benefit of agenda items is the one-per-turn pacing - by executing at most one agenda item per turn, we ensure that the NPC will carry out its self-initiated actions at a measured pace, rather than as a jumble of random actions on a single turn.
Note that NPC-initiated conversation messages override agendas. If an actor has an active ConvNode, AND the ConvNode displays a "continuation message" on a given turn, then the actor will not pursue its agenda on that turn. In this way, ConvNode continuation messages act rather like high-priority agenda items.
class
AgendaItem : object
AgendaItem
BoredomAgendaItem
ConvAgendaItem
DelayedAgendaItem
agendaOrder
initiallyActive
isDone
isReady
execute
getActor
invokeItem
resetItem
agendaOrder | actor.t[5558] |
initiallyActive | actor.t[5525] |
isDone | actor.t[5550] |
By default, we simply return nil. Items can override this to provide a declarative condition of done-ness, or they can simply set the property to true when they finish their work. For example, an item that only needs to execute once can simply set isDone to true in its invokeItem() method; an item that's to be repeated until some success condition obtains can override isDone to return the success condition.
isReady | actor.t[5533] |
execute ( ) | actor.t[5587] |
getActor ( ) | actor.t[5518] |
invokeItem ( ) | actor.t[5565] |
resetItem ( ) | actor.t[5574] |