A decision maker defines how peds react to certain events under certain circumstances. Default decision makers are located in the
data/decision/allowed San Andreas directory. Decision makers can also be created by scripting to change how script peds deals with situations.
Format and Basics
The default decision maker files present in the San Andreas directory can be either in
.grp extension. The first defines decisions for individual ped types and the latter for a group of peds.
The files can be edited by using a text editor, but a spreadsheet software is heavily recommended due to the bad formating of the file.
The first line of the file is ignored, comments are not supported, and commas must be used.
Each line is an event type and it's reaction to it. The line begins with:
|A||The event to react to.|
|B||Unused. Always 4.|
Followed by the 6 possible responses to the event with the format:
|C||P||AC||AP||BC||BP||Task to perform in response to the event.|
|D||Q||AD||AQ||BD||BQ||Chance of executing this response when the event trigger is a friendly ped (i.e. on it's respect/like list)|
|E||R||AE||AR||BE||BR||Chance of executing this response when the event trigger is a threat ped (i.e. on it's hate/dislike list)|
|F||S||AF||AS||BF||BS||Chance of executing this response when the event trigger is the player ped|
|G||T||AG||AT||BG||BT||Chance of executing this response when the event trigger is not a ped, or a neutral ped (i.e. not on the relationship list).|
|H||U||AH||AU||BH||BU||A boolean specifying whether the task should be performed when the ped is on a vehicle|
|I||V||AI||AV||BI||BV||A boolean specifying whether the task should be performed when the ped is on foot|
- The used event should be registered in PedEvent.txt to work.
- The chance should be in the range between 0 and 100. It's percentage of actual chance is calculated based on the sum of all the chances. For example, if we have 2 responses with a 100.0 chance when the trigger is friendly, each of those response will have a 50% of chance since 100.0 is 50% of the sum of the friendly responses (200.0).
- To ignore one response parameter all it's value shall be set to 0 except for task id that shall be set to -1.
- Every token should be delimited by commas (',') unlike the other data files that commas are optional.
Although Rockstar ignored some of those rules in some lines, it's a mistake/bug, so be careful.
This file, in the directory
data/decision, is a enumeration file used to assign a internal index to a specific task id so it can be used as a event to be responded.
There should be a maximum of 41 entries and modifying it isn't recommended.
Each line contains a string and a task id, the string is ignored, only the task id matters.
The following line can be found in R_Norm.ped in response to the event 15, EVENT_PED_ENTERED_MY_VEHICLE.
When formatted properly we get those possible responses:
|Task||Chance On Friend Trigger||Chance On Threat Trigger||Chance On Player Trigger||Chance On Other Triggers||In Car||On Foot|
What do we have here is, if you enter the vehicle the ped is occupying, he'll either leave the car and flee or scream and leave, as you may be aware that's exactly how the random peds react when you enter in their vehicles.
Decision makers can be created and managed through scripts using the following commands:
- 060A (LOAD_CHAR_DECISION_MAKER) – Loads a pre-defined decision maker from a file
- 060B (SET_CHAR_DECISION_MAKER) – Sets the decision maker for a character
- 065C (CLEAR_ALL_DECISION_MAKERS) – Frees the previously loaded decision maker
- 06AD (SET_GROUP_DECISION_MAKER) – Sets the group decision maker for a group
- 06AE (LOAD_GROUP_DECISION_MAKER) – Loads a pre-defined group decision maker from a file
- 0708 (CLEAR_CHAR_DECISION_MAKER_EVENT_RESPONSE) – Clears the responses to a certain event in a decision maker
- 0709 (ADD_CHAR_DECISION_MAKER_EVENT_RESPONSE) – Adds a event response to a decision maker (max 6 responses per event)
- 0749 (CLEAR_GROUP_DECISION_MAKER_EVENT_RESPONSE) – Clears the responses to a certain event in a group decision maker
- 074A (ADD_GROUP_DECISION_MAKER_EVENT_RESPONSE) – Adds a event response to a group decision maker (max 6 responses per event)
- 07E5 (COPY_CHAR_DECISION_MAKER) – Clones a decision maker
- 07E6 (COPY_GROUP_DECISION_MAKER) – Clones a group decision maker
- 0978 (COPY_SHARED_CHAR_DECISION_MAKER) – Clones a decision maker shared between characters, essentially cloning a reference not the entire maker
- 09F2 (DOES_DECISION_MAKER_EXIST) – Checks if a decision maker exists
Default Decision Makers
Here is a listing of the available default decision makers, their use and their id usable in pedstats.dat.
|Cop.ped||1||Used for cop responses.|
|R_Norm.ped||2||Used for random normal peds responses.|
|R_Tough.ped||3||Used for random tough peds responses.|
|R_Weak.ped||4||Used for random coward peds responses.|
|Fireman.ped||5||Used for fireman responses.|
|m_empty.ped||6||Basic collision responses only. Seems like a template.|
|InDoors.ped||7||Used for peds spawned in interiors?|
|RANDOM.ped||N/A||Fallback decision maker used when peds lost their decision makers?|
|m_plyr.ped||N/A||Used for the player?|
|m_empty.ped||N/A||Empty decision maker for scripting. Accessible by scripting by loading a decision maker of type 0.|
|m_norm.ped||N/A||Normal decision maker for scripting. Accessible by scripting by loading a decision maker of type 1.|
|m_tough.ped||N/A||Tough decision maker for scripting. Accessible by scripting by loading a decision maker of type 2.|
|m_weak.ped||N/A||Coward decision maker for scripting. Accessible by scripting by loading a decision maker of type 3.|
|m_steal.ped||N/A||Patrolling decision maker for scripting. Accessible by scripting by loading a decision maker of type 4.|
|MISSION.grp||N/A||Basic group used on mission scripts. Accessible by scripting by loading a group decision maker of type 0.|
- ped.dat – Defines the relationship of friend/threat/neutral between ped types
- pedstats.dat – Defines the decision maker for each kind of ped.