Player Brain Documentation

From Nexus Mods Wiki
Revision as of 11:09, 19 February 2020 by WarhorseStudios (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

 

Kingdom Come: Deliverance: Forum | Before you start | Tutorials & Instructions | Basic Mods | Tools | Documentation | Glossary | EULA