Jump to content
Sign in to follow this  
Windwalking

WW AICover

Recommended Posts



What is WW_AICover
By default, AI in Arma has two ways of reacting to audible gunfire. First is if its close to the AI enough to see the bullet or pinpoint your location. Second, is to completely and utterly ignore it. This behavior results in you waging war on one side of a village, to find a safe patrol loitering around as if they didnt hear the firefight at all. Also, because sometimes the AI wouldnt recognize you shooting at them as a threat right away, they can continue ignoring the very audible gunshots for a few seconds till someone see the bullet or die from it. Also the AI seems to not react to ambushes at all, resulting in the famous turn and laser shoot you to death even though you clearly had the jump on them. AI also seems to not react to threatening attacks like mortar strikes near by or grenades.

What WW_AICover does, is simply force AI into aware mode if there is an audible gunfire near them. If the fire is close enough, they will immediately seek cover and then assess the situation. It also factors in threatening attacks like mortars, to suppress the AI. Incase of a threatening attack, the AI will try to withdraw away from the source, possible exposing them, This makes flushing out tactics possible with this mod. The mod also utilizes functions from TPW_EBS if present, to invoke suppression effects on AI based on the situation in a broader manner than possible with TPW_EBS alone. Also the AI will react to flying helicopters near them by taking cover immediately. Hopefully this makes the AI more life like and hopefully improves the quality of missions by making stealth approach more rewarding, and firefights more tense.

Recommendation
I strongly recommend you download and install the awesome mod by TPW called TPW_EBS. Me and TPW are working on interoperability and this mod has enhanced features only if TPW_EBS is available.
http://forums.bistudio.com/showthread.php?161319-TPW-EBS-engine-based-suppression

Features
  • Alert AI to gunfire
  • Enhanced AI take cover routine (modified from TPWCAS take cover by Ollem)
  • Works for handgrenades
  • Factors silenced weapons and different weapon types to determine audible range
  • Friendly AI in group will react to unexpected fire by breaking formation and going to cover
  • AI make surprised sounds when under unexpected fire
  • AI react to most explosions correctly, even from vehicles
  • AI react to vehicle engine sounds and flying by helicopters
  • Utilizes suppression effects from TPW_EBS if present
  • Allows interesting tactics like flushing out AI out of cover by using mortars, grenades, and rockets
  • Handles ambushes on unexpected AI by making them retreat to cover, or apply suppression effects if TPW_EBS is present
  • AI seeks cover when detecting enemies even if no shots are fired



Features Working on

  • Further improving take cover function




Change Logs
Version 1.56

  • Units are completely silent while taking cover
  • fixed leader swapping again (hopefully)
  • Units wont attempt to take cover if too far from the leader. They will attempt to catch up first.
  • Units will not try to take cover if the leader already assigned a task for them



Version 1.54

  • Turned off take cover routines from player joined groups for now. You can still turn it on from the config (Recopy config file for this)
  • fixed the bug with leadership swapped in the group



Version 1.52

  • Made AI squad members much less spammy when they cover routine is active on them
  • AI takes cover and return from it more effeciently now.



Version 1.50

  • AI now run to cover when detecting enemy
  • Config parameter added



Version 1.32

  • Fixed an issue where stealthed friendly team mates go automatically to aware when there is fire nearby


Version 1.31

  • Added an option in the config file to prevent the take cover routine from activating on your squad memebers if the leader is a player
  • Fixed Vehicles bug regarding explosives



Version 1.30

  • AI react to sound based on distance. Sound reaches them when it should reach them.
  • If one squad memeber is under unexpected fire, the rest of the group are alerted and seek cover
  • Much better handling of TPW_EBS suppressions if available (seriously do get it though)
  • Better handling of charges, mines and satchels



Version 1.27

  • Fixed an issue with AI not shooting each other (For results on who won the staring contest, please contact me)
  • Code cleanup


Version 1.25

  • Enhanced take cover function even further
  • AI now retreat to cover even if already aware of attacks if the attack is of high threat, like grenades
  • Added suppression effects if TPW_EBS is present. Enable TPW_EBS debug to see how it works
  • AI react to vehicles nearby if engine is on
  • various bugfixes and code optimizations



Version 1.23

  • Fixed a bug concerning firing cannons or MG from vehicles
  • Made taking cover much more effecient
  • Friendly AI units now return to formation after taking cover IF you didnt give them the WAIT command



Version 1.22

  • HOT FIX to a major config related issue
  • Added support to placed charges, satchels and mines
  • Code optimizations



Version 1.21

  • HotFix to make it more compaitable with TPWCAS



Version 1.20

  • Fixed error message when no sufficient cover nearby
  • Added audible effects to most vehicles and rockets
  • Added audible effect to Grenade Launchers
  • AI will now watch the direction the sound came from
  • AI now make yelling sounds when running to cover (Thanks TPW)
  • Greately improved taking cover based on the direction of the threat
  • AI will take cover based on where explosions happened rather than the shooter
  • Added an extensive config variables for control over audible ranges



Version 1.05:

  • AI now look at noise source before reacting to it
  • AI reaction to noise is randomized
  • friendly AI in Group react to unexpected fire by going to cover (You have to call regroup to get them back)
  • Added support to Launcher explosions






Thanks
I am really thankful to TPW for taking the time to help me get my head around Arma's modding world. He is a very friendly person I am thankful for his help and code. I am really grateful to Ollem for allowing me to use and build on his amazing take cover routine from TPWCAS.

Download:https://dl.dropboxusercontent.com/u/3047338/%40WW_AICOVER_ver1.56.zip
Version:1.54
Date: 20130929
Authors:Windwalking, Ollem, TPW
Requires: Community Base Addons for Arma 3

Edited by Windwalking

Share this post


Link to post
Share on other sites

There is no conflict at all between this and TPWCAS or TPW_EBS. It should play nice with most AI mods.

Share this post


Link to post
Share on other sites

Look forward to trying it out.

Thanks for sharing this

Share this post


Link to post
Share on other sites

Any feedback would be appreciated. This is my first attempt at modding for Arma.

Edited by Windwalking

Share this post


Link to post
Share on other sites

^ seeing who you are working with I'm sure it's well done.. will test it out when I have time

Share this post


Link to post
Share on other sites

Looks great! Thanks for making and sharing...

/KC

Share this post


Link to post
Share on other sites

Thanks a lot. I will Be expanding on features a lot in the next few days. Will include reaction to explosives. Panic due to artillery and CAS. Will also apply the effect to friendly group members, but will avoid the effect if you revealed the targets first.

Edited by Windwalking

Share this post


Link to post
Share on other sites

very nice. looks very life like in the video. one little suggestion though. it seems like the AI reacts simultanously with the first gun shot. could you add a very small delay? right now it looks like the pulling of the trigger triggers it and as if the AI aren't processing the sound at all. other than that it looks perfect.

Share this post


Link to post
Share on other sites
very nice. looks very life like in the video. one little suggestion though. it seems like the AI reacts simultanously with the first gun shot. could you add a very small delay? right now it looks like the pulling of the trigger triggers it and as if the AI aren't processing the sound at all. other than that it looks perfect.

It's like you read my mind. I just added random delay per unit to fake processing sound. I will be releasing it with a couple more features very soon.

I might even make them turn towards the sound source first then run :)

Share this post


Link to post
Share on other sites
Is this MP-compatible?

Code wise, it should be just fine. I haven't tested it though, if u can verify I would be grateful.

Share this post


Link to post
Share on other sites
It's like you read my mind. I just added random delay per unit to fake processing sound. I will be releasing it with a couple more features very soon.

I might even make them turn towards the sound source first then run

yup. that's just what i do. if you don't like it you better get used to wearing tin foil head wear ;)

turning towards the sound source is an awesome idea! details like that can make a world of difference.

Share this post


Link to post
Share on other sites

Turning towards the source would be great and make a lot of sense with everything else it does.

Share this post


Link to post
Share on other sites

turning towards the sound source is an awesome idea! details like that can make a world of difference.

Yep on that! I've always kind of wanted enemy soldiers to turn, and somehow give the appearance of being alerted maybe thru pointing and shouting or such. I don't think theres a point animation but would be swell. :o

So far been AI mod mashing this with TPW's (Suppresion/LOS/Fall) and Zooloo75's Firefight and although I haven't specifically playtested what plays out more realistically -I'm definitely enjoying the mad dynamic behaviours :)

Edit: Also seeing one of those buggered

Undefined Variable _coverposition.

WW_aicover.sqf line 127

Edited by froggyluv

Share this post


Link to post
Share on other sites

Thanks guys for all the feedback.

Version 1.05 is out now. here is the link

https://dl.dropboxusercontent.com/u/3047338/%40WW_AICOVER_v1.05.zip

I made the AI look at the noise source. I am using Watch target command, which kinda make them glance at the noise source. I havent suffeciently tested it, but from brief tests, it works. I also wrote my own function to make AI turn to forcefully by setting direction. I hope I dont have to use it, because forcing direction never look good.

Also added effect to function on Friendly AI in group. If they get unexpected fire, they will break formation and go to cover. If you are the leader, you have to call regroup to get them back in formation. I thought that adds some dynamic to managing the group and trying to avoid ambushes.

Also I am thinking about lowering skill briefly after the effect happening. I do not know if I should. What does everyone think?

Share this post


Link to post
Share on other sites

So far been AI mod mashing this with TPW's (Suppresion/LOS/Fall) and Zooloo75's Firefight and although I haven't specifically playtested what plays out more realistically -I'm definitely enjoying the mad dynamic behaviours :)

I do that too! I usually even test my mod with TPW's stuff to see how they work together.

I think I might add the ability to yell sometimes while running as well. Thanks for the idea :D

Share this post


Link to post
Share on other sites

Really enjoying the mod - will try the new version once I'm at my arma machine.

Don't think I'd lower the skill (or maybe have it selectable in a user config?)

Again very nice work

cheers

Share this post


Link to post
Share on other sites

I wouldn't bother lowering the skill either, I think you'd be better off letting the skill be lowered when units are actually suppressed (eg by TPWCAS or TPW EBS). If there are too many scripts competing to change AI behaviour and parameters then the results can get a bit messy. Also, it probably would fly in the face of realism - NATO troops lose their shit as soon as they hear bullets!

EDIT: PS you might want to clean up the structure of the download, it contains 3 different script versions and 2 PBOs :)

Edited by tpw

Share this post


Link to post
Share on other sites
I wouldn't bother lowering the skill either, I think you'd be better off letting the skill be lowered when units are actually suppressed (eg by TPWCAS or TPW EBS). If there are too many scripts competing to change AI behaviour and parameters then the results can get a bit messy. Also, it probably would fly in the face of realism - NATO troops lose their shit as soon as they hear bullets!

EDIT: PS you might want to clean up the structure of the download, it contains 3 different script versions and 2 PBOs :)

Yeah I think so too. This mod works best when it's running with your EBS mod.

I will clean the download then :)

Share this post


Link to post
Share on other sites

Q whats the hearing range/ can it be added to the config? Im having wet dreams of GL4's hearing and reactions.

Share this post


Link to post
Share on other sites
Q whats the hearing range/ can it be added to the config? Im having wet dreams of GL4's hearing and reactions.

I will add them to config today. Would help if you guys helped find the sweet spot for audible ranges.

---------- Post added at 09:06 ---------- Previous post was at 09:02 ----------

Undefined Variable _coverposition. 
WW_aicover.sqf line 127

If anyone gets this error. Please specify what mission was it from. I having trouble finding why it happens.

Share this post


Link to post
Share on other sites

I figure this is similar. http://steamcommunity.com/sharedfiles/filedetails/?id=171124757

Except it is line 143.

I started shooting at 2 guys to my front. As you can see no real cover nearby. Once this error popped up my fps dropped to 20 and my rpt started being spammed uploading to dropbox will link in a sec

Mission http://steamcommunity.com/sharedfiles/filedetails/?id=170597306 Escape from Stratis by Hiltz

Small except

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Object id 93236fc7 (1991) not found in slot 109,153
Link cannot be resolved
Object id 93851dfd (1533) not found in slot 163,156
Link cannot be resolved
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

if ( !( unitReady _un>
 Error position: <_coverPosition );

if ( !( unitReady _un>
 Error Undefined variable in expression: _coverposition
File WW_AICOVER\ww_aicover.sqf, line 143
Error in expression < } do 
{
_dist = round ( _unit distance _coverPosition );

https://www.dropbox.com/s/leoyhlser1vk1vx/arma3_2013-08-20_01-44-22.rpt

gl4 ranges for hearing

// Enemy A.I. Advancing Smoke:

// ==============================================================

// Choose which smoke shells/grenades can be detected by enemy A.I.

// Smoke shells/grenades listed in this array can be detected by enemy A.I. within a range of 100 meters.

// Default: ["SmokeShell","SmokeShellYellow","SmokeShellRed","SmokeShellGreen","SmokeShellPurple","SmokeShellBlue","SmokeShellOrange","G_40mm_Smoke","G_40mm_SmokeRed","G_40mm_SmokeGreen","G_40mm_SmokeYellow"]

// GL4_Global set [33, (GL4_Global select 33) + [] ];

// Enemy A.I. Advancing Smoke Distance:

// Choose in which range enemy A.I. should react to dropped smoke shells/grenades.

// Note: This value set how close smoke shells/grenades have to be dropped within the enemy A.I. position.

// Warning: Do not set this value higher then 100 meters else enemy A.I. will react to smoke shells/grenades even if it was dropped more then 100 meters away from their position.

// 0 - 100, default is 100 meters

// GL4_Global set [34, 100];

// Enemy A.I. Advancing Weapons:

// ==============================================================

// Choose which weapons and ammo should be heared by enemy A.I. within wich range.

// Note: Weapons which are not listed in thouse arrays can heared by enemy A.I. from the "Rifle Distance" distance.

// Weapons and Ammo listed in this array can heared by enemy A.I. within a range of 15 meters.

// Note: Suppressed weapon classes are detected and added automatically.

// Default: ["B_556x45_SD","B_556x45_SD"]

// GL4_Global set [35, (GL4_Global select 35) + [] ];

// Muzzles and Ammo listed in this array can heared by enemy A.I. within a range of 50 meters.

// Default: ["M203Muzzle","GP25Muzzle","G_40mm_HE"]

// GL4_Global set [36, (GL4_Global select 36) + [] ];

// Weapons and Ammo listed in this array can heared by enemy A.I. within a range of 300 meters.

// Default: ["M136","JAVELIN","STINGER","RPG7V","STRELA","M9","Makarov","B_9x19_Ball","R_M136_AT"]

// GL4_Global set [37, (GL4_Global select 37) + [] ];

// Enemy A.I. Advancing Suppressed Weapons Distance:

// Choose in which range enemy A.I. can hear suppressed "M9SD/MP5SD/M4A1SD/MakarovSD" weapons.

// 0 - 100, default is 15 meters

// GL4_Global set [38, 15];

// Enemy A.I. Advancing Grenade Launcher Distance:

// Choose in which range enemy A.I. can hear Grenade Launcher "M16A2GL/M4GLAK74GL" weapons.

// 0 - 300, default is 50 meters

// GL4_Global set [39, 50];

// Enemy A.I. Advancing Pistoles and Rocket Launcher Distance:

// Choose in which range enemy A.I. can hear Pistoles/Rocket Launcher "M9/Makarov/M136/JAVELIN/RPG7V" weapons.

// 0 - 500, default is 300 meters

// GL4_Global set [40, 300];

// Enemy A.I. Advancing Rifle Distance:

// Choose in which range enemy A.I. can hear Rifles/Assault Rifles "M16A2/M16A4/M4AIM/M4A1/AK74" weapons.

// 0 - 1500, default is 600 meters

// GL4_Global set [41, 600];

I personally up smoke detection range to 600m-1km

Suppressed weapons to 100m-200m

Rifles to 600m-1km

Not those ranges are based on reactions that GL4 uses. AI will send scouts to investigate noises and such.

Edited by Masharra

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×