Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
Deji

[Coding] Decision Makers

Recommended Posts

Deji

I posted this back on my forum a while ago. I was going to post it here but got distracted by holidays. Anyway, now it's pasted here for anyone who doesn't grasp what these opcodes are for.

 

 

Decision Makers

 

 

Not a lot of people know how to properly use these. I'm going to shed a lot of light and also explain the rest of the found parameters.

 

 

Creating Decision Makers

 

Well, first we create a decision maker like this:

 

[sanny]060A: create_decision_maker_type 2 store_to [email protected][/sanny]

 

The type is actually more of a "set". Each set has different default decision events.

 

You can change these, of course. But it sets what they are before you change them.

 

0 - Blank

All peds assigned to this decision maker are dummies. They respond to nothing unless you use 0709. This one is like a blank canvas.

 

1 - Brave

Peds seem to attack anyone that attacks them. They will also go after any peds in the hate list. See ped.dat. They act like their default pedtype, not what you created them as.

 

2 - Violent

The peds will attack anyone who even aims at them.

 

3 - Coward

The peds will cower if you aim at them, then they'll run away panicked. They will flee from gunfire etc.

 

4 - Grouped

Like 1, if you attack a ped with this decision maker, he will attack you. But if there are any other peds that also have this decision maker, they will attack you too. They kinda work together. Sometimes they act like secret agents... Dunno why.

 

 

I'm not completely sure about all of these, but it seems to be what happens.

 

 

0709

 

Previously, the opcode line looked like this:

 

[sanny]0709: set_decision_maker $1230 on_event 36 taskID 1022 unknown 0.0 100.0 chance 0.0 unknown 0.0 1 0 // see *.ped files[/sanny]

 

The chance parameter confused me and was the inital prevention of me going down all sorts of incorrect paths... The other unknown parameters could have been something else similar to chance. What are the last two parameters?

 

The correct line, I believe to be:

 

[sanny]0709: set_decision_maker [email protected] on_event 31 task 413 respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 0 on_foot 1[/sanny]

 

Now let me explain the params.

 

 

set_decision_maker

 

This refers to the decision maker you created with 060A.

 

 

on_event

 

See this page for a list.

 

This specifies which event we are changing the effect of.

 

For example, with 31 (EVENT_GUN_AIMED_AT), we are changing what the ped does when someone aims at them.

 

 

task

 

See this page for a list.

 

This specifies what the ped does when the on_event returns true. Since we used 31, we'll be changing what happens when he is aimed at.

 

Task 413 is the TASK_SIMPLE_HANDS_UP, which means the ped will put his hands up when he's aimed at.

 

If we set it to 200 (TASK_NONE) nothing will happen when the ped is aimed at.

 

 

respect, hate, like, dislike

 

Now for the params that confused everyone. These we're previously unknown but are pretty obvious when see what it is.

 

These parameters aren't actually much use on many events. They are only useful for EventID's that involve another actor. 20 (EVENT_SEXY_PED), for example.

 

These are dependant on the ped.dat file (or the reconfiguration by the main.scm). If the ped in question is set to hate the sexy ped, the line could go like this:

 

 

0709: set_decision_maker [email protected] on_event 31 task 415 respect 0.0 hate 100.0 like 0.0 dislike 0.0 in_car 0 on_foot 1

 

 

This means that if the ped in question sees a sexy ped AND that ped is on it's hate list, the ped will duck... Not very realistic, but who cares.

 

The params are floats, which means it can be "hating" by a certain amount. If the hate is OVER that amount, the task will play.

 

 

Not convinced? The best example of this is in the main.scm:

 

[sanny]0709: set_decision_maker [email protected] on_event 15 taskID 1000 respect 0.0 hate 100.0 like 0.0 dislike 100.0 in_car 1 on_foot 1

0709: set_decision_maker [email protected] on_event 36 taskID 1000 respect 0.0 hate 100.0 like 0.0 dislike 0.0 in_car 1 on_foot 1

0709: set_decision_maker [email protected] on_event 9 taskID 1000 respect 0.0 hate 75.0 like 0.0 dislike 75.0 in_car 1 on_foot 1

0709: set_decision_maker [email protected] on_event 9 taskID 415 respect 0.0 hate 25.0 like 0.0 dislike 25.0 in_car 1 on_foot 1[/sanny]

 

Here we have 4 lines. TaskID 1000 is TASK_COMPLEX_KILL_PED_ON_FOOT, meaning the ped will attack the other ped.

 

The first line is set to make the ped attack when the other ped fires a shot AND the ped that fired the shot is hated by this ped.

 

The second line is set to EVENT_ACQUAINTANCE_PED_HATE, a special event that means the ped has seen another ped he hates. Here he does the same, kills the ped if he hates him.

 

The third line is different. Here the hate is set to less, so the ped in question doesn't hate the other ped quite as much. The event id is set to EVENT_DAMAGE, meaning that when the ped receives a punch of another ped he hates over 75%, he will kill him.

 

Do not get this third line confused. Because the other two lines have the hate param full, they HAVE to completely hate the ped in order to attack them because they fired a shot or the ped just saw them. On the third line, because the hate is set lower, the ped is more tolerant of what the other ped does. Which means he'll wait until he's actually hurt by the other ped before deciding to kill them.

 

The fourth line is set to have a pretty low hate amount. Meaning the ped doesn't really hate the other guy. Here even if the other guy attacks the ped, the ped will only duck. He's not angry enough at the other guy to attack back, which only leaves fear.

 

 

The third and fourth lines also have the dislike param set to the same amount as the hate param. The first has the dislike param set to 100%. I'm not too sure of the specifics on why.

 

This whole block of code is set to the ballas and groves on the last mission of the LS missions, before CJ is taken to the countryside. Before that code they are also set to not do anything on various events. This is to keep them focused on their job of fighting.

 

They are set to attack actors they hate on sight... So ballas attack groves and groves attack ballas.

 

 

in_car, on_foot

 

Simply put, these specify whether the task should be performed when in a car or on foot.

 

If the on_foot param is set to 0 and the in_car param is set to 1, the ped will only respond to the event with the task when they are in a car. Useful if you're using vehicle-specific tasks. on_foot being on 1 means the actor performs the actions when on foot. Both on 1 means he performs the action in both situations.

 

 

 

Pretty simple, really. It's just changing how actors react to stuffs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • 1 User Currently Viewing
    0 Members, 0 Anonymous, 1 Guest

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.