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. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    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 IV 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 SA Mods
    10. GTA Vice City

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA III 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

Eddlm

[Research/Guide] Combat Behaviour Flags

Recommended Posts

Eddlm

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

Share this post


Link to post
Share on other sites
reditec

Good work!

Share this post


Link to post
Share on other sites
gtaVmod

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

 

There is also PED::SET_COMBAT_FLOAT frequently used in game scripts

Share this post


Link to post
Share on other sites
Eddlm

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

Share this post


Link to post
Share on other sites
GeorgeZhang

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.

Share this post


Link to post
Share on other sites
R3QQ

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

Share this post


Link to post
Share on other sites
GeorgeZhang

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

Share this post


Link to post
Share on other sites
InfamousSabre

5 is BF_CanFightArmedPedsWhenNotArmed

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

Edited by InfamousSabre

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
R3QQ

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

Edited by R3QQ

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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