Difference between revisions of "Decision Maker"
m |
m |
||
Line 1: | Line 1: | ||
− | A '''decision maker''' defines how peds react to certain events under certain circumstances. Default decision makers are located in the <code>data/decision/allowed</code> [[San Andreas]] directory. Decision makers can also be created by [[# | + | A '''decision maker''' defines how peds react to certain events under certain circumstances. Default decision makers are located in the <code>data/decision/allowed</code> [[San Andreas]] directory. Decision makers can also be created by [[#Scripting |scripting]] to change how script peds deals with situations. |
== Format and Basics == | == Format and Basics == |
Revision as of 17:52, 2 February 2015
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.
Contents
Format and Basics
The default decision maker files present in the San Andreas directory can be either in .ped
or .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:
Column | Description |
---|---|
A | The event to react to. |
B | Unused. Always 4. |
Followed by the 6 possible responses to the event with the format:
C1 | C2 | C3 | C4 | C5 | C6 | Description |
---|---|---|---|---|---|---|
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 |
J | W | AJ | AW | BJ | BW | Unused. |
K | X | AK | AX | BK | BX | Unused. |
L | Y | AL | AY | BL | BY | Unused. |
M | Z | AM | AZ | BM | BZ | Unused. |
N | AA | AN | AA | BN | BA | Unused. |
O | AB | AO | AB | BO | BB | Unused. |
Rules
- 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.
PedEvent.txt
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.
Example
The following line can be found in R_Norm.ped in response to the event 15, EVENT_PED_ENTERED_MY_VEHICLE.
17,4,706,50.000000,50.000000,50.000000,50.000000,1,1,0,0,0,0,0,0,708,50.000000,50.000000,50.000000,50.000000,1,1,0,0,0,0,0,0,-1,0.0,0.0,0.0,0.0,0,0,0,0,0,0,0,0,-1,0.0,0.0,0.0,0.0,0,0,0,0,0,0,0,0,-1,0.0,0.0,0.0,0.0,0,0,0,0,0,0,0,0,-1,0.0,0.0,0.0,0.0,0,0,0,0,0,0,0,0,
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 |
---|---|---|---|---|---|---|
TASK_COMPLEX_LEAVE_CAR_AND_FLEE | 50% | 50% | 50% | 50% | true | true |
TASK_COMPLEX_SCREAM_IN_CAR_THEN_LEAVE | 50% | 50% | 50% | 50% | true | true |
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.
Scripting
Decision makers can be created and managed through scripts using the following commands:
- 060A – Loads a pre-defined decision maker from a file
- 060B – Sets the decision maker for a character
- 065C – Frees the previously loaded decision maker
- 06AD – Sets the group decision maker for a group
- 06AE – Loads a pre-defined group decision maker from a file
- 0708 – Clears the responses to a certain event in a decision maker
- 0709 – Adds a event response to a decision maker (max 6 responses per event)
- 0749 – Clears the responses to a certain event in a group decision maker
- 074A – Adds a event response to a group decision maker (max 6 responses per event)
- 07E5 – Clones a decision maker
- 07E6 – Clones a group decision maker
- 0978 – Clones a decision maker shared between characters, essentially cloning a reference not the entire maker
- 09F2 – 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.
Filename | Id | Description |
---|---|---|
GangMbr.ped | 0 | ? |
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.grp | 8 | ? |
RANDOM2.grp | 9 | ? |
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. |
See also
- ped.dat – Defines the relationship of friend/threat/neutral between ped types
- pedstats.dat – Defines the decision maker for each kind of ped.