Question About NPC Behavior In Combat

Discussion in 'Fallout General Modding' started by CPL, Mar 11, 2014.

  1. CPL

    CPL Still Mildly Glowing
    Modder

    294
    Mar 16, 2013
    There is one thing that I've noticed when an NPC is equipped with a weapon that is only burst fire only or explosion damage (I modded shotguns for this for the spread effect) that they'll switch weapons when someone in their party is right next to their opponent (say Sulik is shooting at a gecko and Vic is next to it.)

    What causes them to do this? A thing in the script files? Is there a way to change this behavior? Sometimes that's annoying when I want to do mass devastation with a large group of surrounding foes - another thing I modded, large encounters - but someone is in the way and they cheese out on me by pulling out another gun which has less desired results. :razz:

    Unfortunately, I'm not familiar with the scripting part of Fallout, so if that's what's required then I'm out of luck, unless it's something I can change by editing note pad, like you can with dialog and world map .txt files. Either way, I'm still curious what causes this. I know even enemies equipped with similar weapons will do this to in similar situations.
     
  2. Forgotten Knight

    Forgotten Knight Time traveler stuck in time... Modder

    258
    May 24, 2006
    Behavior of NPC is controlled by "AI packet". You can set "AI packet" for any critter by a mapper tool when placing a critter on the map. Critter's AI info is in master.dat\data\AI.txt, you can view it and slowly figure what's going on :mrgreen: With some different AI settings you can really see the difference
    :grin: "area_attack_mode=" line is what you're looking for.:ugly:
    Also, you can set AI packet via script: critter_add_trait(obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_PACKET_NAME);
     
    Last edited: Mar 12, 2014
  3. phobos2077

    phobos2077 Mildly Dipped
    Modder

    596
    Apr 24, 2010
    Nice thread. Does anyone know when NPCs choose to use grenades? If you give a throwing knife to a critter (who has appropriate animations) in a mapper and attack - he throws knife at you like crazy (picks it up and throws again, etc.). But the same critter (decent throwing skill) seems to ignore frag grenade in his hand and just approaches and attacks with bare hands. Even if I attack him from distance and without other critters around me.
    However, when I added grenades to some NPCs in worldmap.txt random encounter (with wielded flag), he used it (tested it in actual game, with two party members around). Is it because there are multiple targets in same place? It seems strange :P
     
  4. CPL

    CPL Still Mildly Glowing
    Modder

    294
    Mar 16, 2013
    Oh yeah, I know what you're talking about with the AI packet. I've actually tweaked it so that no one runs away for any encounter, although sometimes they still do early in the game. That annoys the shit out of me when people run off flailing their arms, even though they are well equipped to fight. I have thought about setting it to "burst always," and have done so in the past, but sometimes that can be problematic, depending on everyone's location at an encounter. I guess this thing is some sort of "friendly fire" prevention program, probably put in because of Ian from the first game. :razz:

    I've found with the grenades that if you set the weapons preference to "none" (at least with your party,) that they'll actually use them. Of course, you have to tweak everybody to have to have all of the modes, since originally not everybody has all of them. I think, for example, Vic didn't have a "berserk" mode or "run away never", so I changed that years ago. I couldn't deal with them running away, plus they will still get attacked and don't heal themselves and can get killed. At least with the "never" mode, they'll hang in there and heal up.