NPC Perception Design: Difference between revisions
Line 112: | Line 112: | ||
<uml> | <uml> | ||
participant LocateOperation | participant LocateOperation | ||
participant NPC | participant NPC | ||
Line 119: | Line 118: | ||
== During Perception Handling == | == During Perception Handling == | ||
[-> NPC : SetLastPerception | |||
activate NPC | |||
[<-- NPC | |||
deactivate NPC | |||
== During Script Execution == | == During Script Execution == | ||
Line 133: | Line 134: | ||
Deactivate NPC | Deactivate NPC | ||
LocateOperation -> Perception : GetLocation | alt Perception == NULL | ||
Activate Perception | [<-- LocateOperation : OPERATION_FAILED | ||
else Perception <> NULL | |||
LocateOperation -> Perception : GetLocation | |||
Activate Perception | |||
Perception -> Perception : GetTarget | Perception -> Perception : GetTarget | ||
note right: Default behavior get location from target if there is one. | note right: Default behavior get location from target if there is one. | ||
activate Perception | activate Perception | ||
deactivate Perception | deactivate Perception | ||
Perception --> LocateOperation | Perception --> LocateOperation | ||
Deactivate Perception | Deactivate Perception | ||
LocateOperation -> NPC : SetLocate | LocateOperation -> NPC : SetLocate | ||
Activate NPC | Activate NPC | ||
LocateOperation <-- NPC | LocateOperation <-- NPC | ||
Deactivate NPC | Deactivate NPC | ||
alt destination == "Active" | alt destination == "Active" | ||
LocateOperation -> NPC : SetTarget | |||
Activate NPC | |||
LocateOperation <-- NPC | |||
Deactivate NPC | |||
end | |||
end | end | ||
[<-- LocateOperation | [<-- LocateOperation : OPERATION_COMPLETED | ||
Deactivate LocateOperation | Deactivate LocateOperation | ||
Revision as of 14:41, 6 April 2013
See Behaviors_and_Reactions for User details about how to use Perceptions in the behavior.xml file.
This embodies any perception an NPC might have, or any game event of interest. Reaction objects below will subscribe to these events, and the networking system will publish them. Examples would be "attacked", "collided", "talked to", "hear cry".
NPC Perceptions
Class Hierarchy
The Perception class is used for simple perception and as the Base Class for a number of special perceptions.

Special Perceptions:
- TimePerception
- FactionPerception
- ItemPerception
- LocationPerception
- PositionPerception
- AttackPerception
- GroupAttackPerception
- DamagePerception
- SpellPerception
- DeathPerception
- InventoryPerception
- OwnerCmdPerception
- OwnerActionPerception
- NPCCmdPerception
Sequences
Personal NPC Perceptions Sequence
Show the typical sequence for a Perception fired for a NPC, might be perceptions like Damage Perception.

Broadcast NPC Perceptions Sequence
Show the typical sequence for a broadcasted Perception. Examples of broadcasted perceptions is the SpellPerception.

Special cases
Perceptions used from locate operation
The locate operation can locate objects of type perception. For this to make sence the perception need to implement the GetTarget.
