Difference between revisions of "Player Brain Documentation"

From Nexus Mods Wiki
Jump to: navigation, search
Line 53: Line 53:
  
 
[[File:Player request1.png|RTENOTITLE]]
 
[[File:Player request1.png|RTENOTITLE]]
 +
  
 
== DudeProx ==
 
== DudeProx ==
Line 58: Line 59:
 
DudeProx is a system responsible for:
 
DudeProx is a system responsible for:
  
 
 
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
Hey, Henry has come to see us!
 
Hey, Henry has come to see us!
Line 72: Line 72:
 
#create a custom role  
 
#create a custom role  
 
#set one of these metarole to that role  
 
#set one of these metarole to that role  
#*KOMENTAR_NA_JINDRU (english COMMENT TO HENRY) for standard situations
+
#*in standard situations, use KOMENTAR_NA_JINDRU (english meaning = COMMENT ON HENRY)
#*KOMENTAR_NA_CHOZENI_POTME (english COMMENT WALKING IN DARK) when commenting on seeing player in dark without torch
+
#*when seeing player in dark without torch, use KOMENTAR_NA_CHOZENI_POTME (english meaning = COMMENT ON WALKING IN DARK)
#*KOMENTAR_NA_PLIZENI (english COMMENT CROUCHING) when commenting on seeing player in crouching stance 
+
#*when seeing player in crouching stance, use KOMENTAR_NA_PLIZENI (english meaning = COMMENT ON STEALTH)
#set priority > 0 to the your dialog topic  
+
#set priority > 0 to your root dialog topic  
 
#set the dialog type to ''ingame monolog''  
 
#set the dialog type to ''ingame monolog''  
  

Revision as of 17:41, 15 November 2019

In terms of AI systems the player is similar to an NPC.

Player's entity is called Dude.

Player's brain is defined in DB as player ans its implementatio is in XML file ..\Data\Libs\AI\player.xml

In order to view/edit the brain player, select the player entity in XGEN NPC Editor
Player brain.png
and then select the Subbrain tab.

The player's brain handles several critical systems or their parts. Systems like:

Zoomed out view of the player's subbrain
  • hit reactions
  • perception
  • different types of player requests
  • player dialogs and monologs
  • horse-mounting
  • crime
  • dudeProx
  • tutorial
  • digging
  • horse trading
  • hangover teleport
  • dog interactions
  • Timekeeper

 

 

 

 

 

 

 

Requests

There are several types of requests. You can request things like weapon draw, weapon holster, torch equip and so on. Each has its own message type.

Behavior Request

You can also take the controls out of player's hands and force the player entity to execute a specific behavior, icluding animations, item interaction etc.
This is done by sending a message of custom type player:request to the player entity (variable __player), with members:

  • target - source of the behavior
  • mode set to "tag" (for behavior tree tagname)
  • behavior - name of the behavior

RTENOTITLE


DudeProx

DudeProx is a system responsible for:

Hey, Henry has come to see us!
                          ~Some NPC~

The system forces NPCs in player's proximity, who recognize the player via perception, to react to the player and the states he might be in appropriate ways.

The major part of it is implemented in sb_daycycles.xml in BehaviorTree dude_prox. The other part can be found in player.xml in BehaviorTree dudeProx. The player's part handles cooldown on dudeprox requests.

This system is frequently used in situations when you need an NPC to shout a specific bark the moment they see the player. All you have to do is:

  1. create a custom role
  2. set one of these metarole to that role
    • in standard situations, use KOMENTAR_NA_JINDRU (english meaning = COMMENT ON HENRY)
    • when seeing player in dark without torch, use KOMENTAR_NA_CHOZENI_POTME (english meaning = COMMENT ON WALKING IN DARK)
    • when seeing player in crouching stance, use KOMENTAR_NA_PLIZENI (english meaning = COMMENT ON STEALTH)
  3. set priority > 0 to your root dialog topic
  4. set the dialog type to ingame monolog

The dudeProx logic will kick-in as usual but your new monolog will keep overriding the basic system barks as long as it's valid.