May 11 2010, 10:32 AM Post #1 | |
Coding like a Rockstar! Posts: 1,468 From: ??? Joined: 28-May 09 | 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 0@ 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 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 0@ on_event 31 task 413 respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 0 on_foot 1 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: CODE 0709: set_decision_maker 0@ 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 231@ 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 231@ 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 231@ 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 231@ on_event 9 taskID 415 respect 0.0 hate 25.0 like 0.0 dislike 25.0 in_car 1 on_foot 1 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. -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |