Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

[Research/Guide] Combat Behaviour Flags


Eddlm
 Share

Recommended Posts

So, I'm doing some researching to be able to control the ped behavior like the game does: with flags.

AI behavior flags work similar to the driving behavior, explained here.

 

So far, this is what's known:

- Combat Behaviour flags are defined in real time in combatbehaviour.meta.

- Combat Behaviour flags for any ped can be enabled/disabled using the PED::SET_PED_COMBAT_ATTRIBUTES native.

- While Combat Behaviour flags are defined with descriptive texts in combatbehaviour.meta, they are defined as integers when using the native mentioned, so we have a little problem here. We need to know which integer corresponds with what flag.

- The highest integer used by "PED::SET_PED_COMBAT_ATTRIBUTES" is 82, by looking at the scripts.

- Looks like there can be an "order" that can help us translate the behaviour flags from the file to an integer. Example:

DEFAULT CCombatInfo uses:

<BehaviourFlags>BF_CanUseCover BF_CanUseVehicles BF_CanDoDrivebys BF_CanLeaveVehicle BF_UseProximityFiringRate BF_CanTauntInVehicle BF_CanUsePeekingVariations BF_CanCommandeerVehicles BF_MaintainMinDistanceToTarget BF_CanUseDynamicStrafeDecisions BF_DisableBlockFromPursueDuringVehicleChase BF_DisableSpinOutDuringVehicleChase BF_DisableCruiseInFrontDuringBlockDuringVehicleChase</BehaviourFlags>

I've tried disabling the integers from 0 to 3, and they correspond with these flags:

0 =BF_CanUseCover

1=BF_CanUseVehicles

2=BF_CanDoDrivebys

3=BF_CanLeaveVehicle

 

So, with some luck, we can continue correlating the flags and discover more of them. Problem is: some CCombatInfo's skip a few flags, so we have to be careful and compare multiple CCombatInfo's to make sure the flags are in the correct order.

 

Here is the list of known flags:

0 = BF_CanUseCover1 = BF_CanUseVehicles2 = BF_CanDoDrivebys3 = BF_CanLeaveVehicle..17/46 = stops peds from fleeing? One of them could be BF_AlwaysFight or BF_CanFightArmedPedsWhenNotArmed

Note: These flags control that the ped can and cannot do (and how) while left alone (using its own AI), but you can still force the ped to do anything with a TASK_. For example, peds that have 3 (BF_CanLeaveVehicle) disabled can still get out of their vehicle if they're tasked to (AI::TASK_LEAVE_VEHICLE).

 

This is all I know about this topic, I'll try to discover more flags in my free time. If you're in need of knowing them, feel free to do your own research and post your findings here.

I hope this information was useful to you.

Edited by Eddlm
  • Like 3
Link to comment
Share on other sites

Yep, I believe they refer to the floats defined in combatbeaviour.meta.

 

I already left some information on the native documentation, but I'll post it here again:

<BlindFireChance value="0.1"/><WeaponShootRateModifier value="1.0"/><TimeBetweenBurstsInCover value="1.25"/><BurstDurationInCover value="2.0"/><TimeBetweenPeeks value="10.0"/><WeaponAccuracy value="0.18"/><FightProficiency value="0.8"/><StrafeWhenMovingChance value="1.0"/><WalkWhenStrafingChance value="0.0"/><AttackWindowDistanceForCover value="55.0"/><TimeToInvalidateInjuredTarget value="9.0"/><TriggerChargeTime_Near value="4.0"/><TriggerChargeTime_Far value="10.0"/>

These are the floats defined in combatbehaviour.meta. Its likely that each CombatType(int) refers to one of these variables.

Edited by Eddlm
  • Like 2
Link to comment
Share on other sites

  • 1 month later...

I've tested with 17 and 46:

17- When I set it to true, peds just flees when they face enemies with weapons(those shooting bullets).46- When set to true, peds with melee weapons will fight peds with weapons.

I don't understand.

Link to comment
Share on other sites

Great thread.

 

I have tested 20 now for hours without any ped giving me the middle finger from inside vehicles. The player can't do it either.

So that makes me believe BF_CanTauntInVehicle to be 20. BF_CanDoDrivebys also makes the player unable to show the middle finger but peds still can.

 

BF_CanTauntInVehicle does not need to be looped. BF_CanDoDrivebys does when set to false.

 

These are all the behavior flags found in the XML:

http://pastebin.com/XSgajbtN

 

All attributeIndexes found in the b617d decompiled scripts:

http://pastebin.com/ZLkLSgLp Highest value found to be 88. PED::SET_PED_COMBAT_ATTRIBUTES(a_0, 88, 1);

Edited by R3QQ
  • Like 1
Link to comment
Share on other sites

Yep, I believe they refer to the floats defined in combatbeaviour.meta.

 

I already left some information on the native documentation, but I'll post it here again:

<BlindFireChance value="0.1"/><WeaponShootRateModifier value="1.0"/><TimeBetweenBurstsInCover value="1.25"/><BurstDurationInCover value="2.0"/><TimeBetweenPeeks value="10.0"/><WeaponAccuracy value="0.18"/><FightProficiency value="0.8"/><StrafeWhenMovingChance value="1.0"/><WalkWhenStrafingChance value="0.0"/><AttackWindowDistanceForCover value="55.0"/><TimeToInvalidateInjuredTarget value="9.0"/><TriggerChargeTime_Near value="4.0"/><TriggerChargeTime_Far value="10.0"/>

These are the floats defined in combatbehaviour.meta. Its likely that each CombatType(int) refers to one of these variables.

Hi, I've discovered several "CombatType"(int) by editing combatbehaviour.meta and then checking with GET_COMBAT_FLOAT

p1:0=BlindFireChance1=BurstDurationInCover3=TimeBetweenBurstsInCover4=TimeBetweenPeeks5=StrafeWhenMovingChance8=WalkWhenStrafingChance11=AttackWindowDistanceForCover12=TimeToInvalidateInjuredTarget16=OptimalCoverDistance
  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
InfamousSabre

5 is BF_CanFightArmedPedsWhenNotArmed

...searched for that for a while. lol..

Edited by InfamousSabre
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
GeorgeZhang

 

5 is BF_CanFightArmedPedsWhenNotArmed

 

...searched for that for a while. lol..

 

Great work, thank you a lot. But how does it differ from AlwaysFight? I ask because when setting 46 to true it has the effect to make ped fight armed peds(all kinds of situation) .

Edited by GeorgeZhang
Link to comment
Share on other sites

InfamousSabre

 

 

5 is BF_CanFightArmedPedsWhenNotArmed

 

...searched for that for a while. lol..

 

Great work, thank you a lot. But how does it differ from AlwaysFight? I ask because when setting 46 to true it has the effect to make ped fight armed peds(all kinds of situation) .

 

If the ped does not have a firearm and they are told to combat a ped who is currently wielding a firearm, and 5 (BF_CanFightArmedPedsWhenNotArmed) is not true, they will run away even if 46 is true. If your ped is still fighting, their BF_CanFightArmedPedsWhenNotArmed flag is already set.

Link to comment
Share on other sites

  • 2 weeks later...

Seems like all values between 1311 and 1376 crashes the game instantly when set to true.

Edited by R3QQ
Link to comment
Share on other sites

  • 4 years later...
En3rgized247

Anyone know what the integer index is for WeaponShootRateModifier in GET_COMBAT_FLOAT?

Link to comment
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
 Share

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

×
×
  • Create New...

Important Information

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