Jump to content
Sign in to follow this  
tpw

TPWC AI suppression system

Recommended Posts

@Coulom,

Is there a setFleeing command? I checked the BiKi, but cant find it... or did you mean allowFleeing? If you're going to use allowFleeing, then I would discourage it, because once the unit start fleeing then it would be quite a long time to make them fit for combat again. Reseting allowFleeing to 0 wont do any good, they will keep on fleeing all the way to the map edge (I only test it on desert map). The result was the firefight ended too quickly...

Using courage is good enough. I had a test battle where a Marine squad vs Russian Squad (with BIS Surrender module) at night one time and the russian routed the marines... the marines lost about 6 men fleeing, 1 surrendered and the rest KIA... that was quite amazing considering I usually saw only all dead or 1 fleeing. Maybe the surrender module had an effect?

Well, thats just my 2cents :D

[edit]

Thanks snafu, my mistake... I meant reseting allowFleeing 0

Edited by Mr_Centipede

Share this post


Link to post
Share on other sites

Doesn't setting allowFleeing to 1 make them the most likely to flee? With 0 being the least likely to flee.

Share this post


Link to post
Share on other sites
Hi TPW, will u be updating the first post?

Yep, once I hear from at least 1 (one) person that the addon works properly for them :)

EDIT

As a bonus, here's a slightly more polished version of my AI line of sight addon which works well with TPWCAS.

http://filesonly.com/download.php?file=384TPW_AI_LOS_100.zip

You'll need beta 94103 or greater to play it though (it won't be an official release until the line of sight commands in the recent betas stabilise).

Edited by tpw

Share this post


Link to post
Share on other sites
As a bonus, here's a slightly more polished version of my AI line of sight addon which works well with TPWCAS.

http://filesonly.com/download.php?fi...AI_LOS_100.zip

You'll need beta 94103 or greater to play it though (it won't be an official release until the line of sight commands in the recent betas stabilise).

Invalid download link unfortunately.

Share this post


Link to post
Share on other sites

Don't forget - you'll need to create a TPW_AI_LOS folder in your userconfig folder to put the .hpp into (the archive doesn't have one in there).

Otherwise you'll get the blessed:

Include file userconfig\TPW_AI_LOS\TPW_AI_LOS.hpp not found.

Share this post


Link to post
Share on other sites
Don't forget - you'll need to create a TPW_AI_LOS folder in your userconfig folder to put the .hpp into (the archive doesn't have one in there).

Otherwise you'll get the blessed:

Include file userconfig\TPW_AI_LOS\TPW_AI_LOS.hpp not found.

Thanks mate, my mistake.

Share this post


Link to post
Share on other sites

For some reason, icant get the new version to work on my dedicated server?? :-(

Share this post


Link to post
Share on other sites
For some reason, icant get the new version to work on my dedicated server?? :-(

Which versions did work for you?

As far as I know, according to our professional tester (Ollem), dedicated is still a bit touch and go.

Share this post


Link to post
Share on other sites
Which versions did work for you?

As far as I know, according to our professional tester (Ollem), dedicated is still a bit touch and go.

I tried wirth ollems code thread #181, and it worked though for some reason i cant turn of the debug balls over the ai's

Share this post


Link to post
Share on other sites

Don't have any visual effects from suppression on disabled PP with 1.02 addon version.

Also you probably forgot to turn off debugging in LOS addon because even with debug = 0 in userconfig there are stll blue balls over soldier heads and when my soldier (but not me) spots an enemy I get red targeting square around him.

Share this post


Link to post
Share on other sites

The main problem with these scripts is addCameraShake command - my system does not like it. When I comment those lines out there is no problem.

With heavily scripted missions (like my mashup with hundreds of AI) there is a delay in the AI reacting, but that is to be expected.

Please keep up the good work!

Share this post


Link to post
Share on other sites
Don't have any visual effects from suppression on disabled PP with 1.02 addon version.

Also you probably forgot to turn off debugging in LOS addon because even with debug = 0 in userconfig there are stll blue balls over soldier heads and when my soldier (but not me) spots an enemy I get red targeting square around him.

OK, I'd completely fucked up the script in the addon version. Here's the working version http://filesonly.com/download.php?file=384TPW_AI_LOS_100.zip, earlier posts also updated.

No idea what you mean about the red targetting square.

Well with no pp you won't see the radial blur (as you know), but the other visual effect is just a gamma colour correction, which I'd assumed was independent of pp.

---------- Post added at 22:24 ---------- Previous post was at 22:21 ----------

The main problem with these scripts is addCameraShake command - my system does not like it. When I comment those lines out there is no problem.

With heavily scripted missions (like my mashup with hundreds of AI) there is a delay in the AI reacting, but that is to be expected.

Please keep up the good work!

What problems does the camerashake cause? Do you also have problems when trucks or tanks drive by?

---------- Post added at 22:32 ---------- Previous post was at 22:24 ----------

I tried wirth ollems code thread #181, and it worked though for some reason i cant turn of the debug balls over the ai's

Not sure about the problem Sixt. The debug balls definitely can be turned off in the TPWCAS addon (but couldn't in the LOS addon until I fixed it 5 minutes ago). The 1.02 addon is basically the same code as Ollem's. You could probably help me out by saying what "doesn't work" actually means. No suppression? No startup hint, script error messages, debug issues etc

Share this post


Link to post
Share on other sites

Only "colorCorrections" are independent of PP settings I believe. Unless you used just that.

Share this post


Link to post
Share on other sites

Still struggling with dedicated... 2 steps forward 1 step back...

Added some MP specifics, and I moved some code around again - should have a minimal perf bonus: use 'switch' in stead of "if x > 0" -> " if x > 1" -> "if x == 3", e.g. at 3 some settings are overruling just set settings in >1

Balloons will appear and disappear now (but only none, green and yellow ???)

Still, the behavior in SP/local Server is much better then on Dedicated :mad:

Will post some updated code later again

Share this post


Link to post
Share on other sites
Only "colorCorrections" are independent of PP settings I believe. Unless you used just that.

he used colourcorrections and radialblur. So even with pp off you should get some effects (colour corrections). And just out of interest, why is it so important that pp be off? what's wrong with just having it on very low?

Still struggling with dedicated... 2 steps forward 1 step back...

Added some MP specifics, and I moved some code around again - should have a minimal perf bonus: use 'switch' in stead of "if x > 0" -> " if x > 1" -> "if x == 3", e.g. at 3 some settings are overruling just set settings in >1

Balloons will appear and disappear now (but only none, green and yellow ???)

Still, the behavior in SP/local Server is much better then on Dedicated

Will post some updated code later again

Thank you Ollem, your contributions are much appreciated.

Share this post


Link to post
Share on other sites

I found that when other units firing at the same time as a player, the player will get 'suppressed'... the camshake and screen blur. I admit that my bullet ignore radius was set at 15, not default 25. That maybe the problem...

So then I looked at the script and thought maybe this code could help? -> (tpwc_ai_sup_fired != _unit)

I tried it myself though, it doesnt work... so maybe need to set back tpwc_ai_sup_ir = 25;

Share this post


Link to post
Share on other sites
I found that when other units firing at the same time as a player, the player will get 'suppressed'... the camshake and screen blur. I admit that my bullet ignore radius was set at 15, not default 25. That maybe the problem...

So then I looked at the script and thought maybe this code could help? -> (tpwc_ai_sup_fired != _unit)

I tried it myself though, it doesnt work... so maybe need to set back tpwc_ai_sup_ir = 25;

Yes unfortunately that is a limiatation. We already have

if ((tpwc_ai_sup_fired distance _unit) > tpwc_ai_sup_ir) then

and

if ((side tpwc_ai_sup_fired != side _unit) && (vehicle _unit == _unit)) then

To detect if the unit is suppressing himself or nearby friendlies, but the problem is when units fire simultaneously, one unit is not going to be assigned as the tpwc_ai_sup_fired. This unit will then suffer from suppression effects. This is how it works ideally.

A unit fires.

He is now the tpwc_ai_sup_fired.

This means he cannot be suppressed.

and this is how it works in a firefight

two units fire practically simultaneously.

Only one can be tpwc_ai_sup_fired

He is impervious to suppression

The other guy suffers.

So unfortunately there is some self suppression, especially in heavy fighting. but usually it is only light (green ball). I can look into trying to reduce sway from this type of suppression though.

The only thing I can think of to truly fix the problem would be to make it so that more than one unit can be tpwc_ai_sup_fired - so that instead of a single unit, an array of units can be there. But I am not sure if this is possible and how you would then take away a unit from the tpwc_sup_fired array so he can once again be suppressed.

Is there a setFleeing command? I checked the BiKi, but cant find it... or did you mean allowFleeing? If you're going to use allowFleeing, then I would discourage it, because once the unit start fleeing then it would be quite a long time to make them fit for combat again. Reseting allowFleeing to 0 wont do any good, they will keep on fleeing all the way to the map edge (I only test it on desert map). The result was the firefight ended too quickly...

Using courage is good enough. I had a test battle where a Marine squad vs Russian Squad (with BIS Surrender module) at night one time and the russian routed the marines... the marines lost about 6 men fleeing, 1 surrendered and the rest KIA... that was quite amazing considering I usually saw only all dead or 1 fleeing. Maybe the surrender module had an effect?

Yes I would use allowfleeing and yes I know its ireversible. I would make it very gradual though so it takes like 300 continuous shots to get a low courage unit to run.But on second thought, I too think that the fleeing as is actually pretty good. I find that there are always some fleeing units now just because of the reduced courage alone. Forcing unit to flee might be kind of counter intuitive as well since it doesn't in any way increase the ai survivability or lethality. So I think I'll just leave the allowfleeing out.

Edited by -Coulum-

Share this post


Link to post
Share on other sites

Its working now, one of my co players had an older version of the mod installed and created the problem with the debug :-)

But it works alot slower on a server, and alot of the ai dont go prone, as if i play it local. So hope Ollem soon find a solution...

But i have say that the impact on single player is cool, really like this :-)

Thanks :-)

Sorry my bad english.

Sixt

Share this post


Link to post
Share on other sites

One of the issues with Dedicated server is (at least for me) that it's very hard to get more the 3 shots counted, so tpwc_ai_sup_st needs to be lowered.

At least that does clarify why only 'yellow' and no 'red'.

Still behaviour is not as responsive as SP, so might not work that well on MP afterall :-/

Will have al closer look at it

For now, this works more or less on Dedicated server:

/*  
TPWC AI SUPPRESSION  

Authors: TPW & -Coulum-  
Additional code: Fabrizio_T, Ollem 
1.02 20120626 
*/  

if (isServer || isDedicated) then { 

//Log it 
diag_log "======= TPWC AI SUPPRESSION STARTED ======="; 

////////////  
//VARIABLES  
///////////  

//Delay before suppression functions start. Allows time for other mods if needed 
tpwc_ai_sup_sleep = 2;  

//Debugging. Will display red balls over any suppressed units. 0 = no debugging, 1 = debugging  
tpwc_ai_sup_debug = 1;  

//Bullet detection radius (m). Bullets must pass within this distance of unit to suppress them. If set much below 10m, bullets may not be detected  
tpwc_ai_sup_br = 10;  

//Bullet ignore radius (m). Bullets from a shooter closer than this will not suppress.   
tpwc_ai_sup_ir = 25;  

//Shot threshold. More shots than this will cause unit to drop/crawl  
tpwc_ai_sup_st = 2;  

//Startup hint. 0 = no hint, 1 = hint  
tpwc_ai_sup_hint = 1;   

//Player suppression visuals. 0 = no player suppression, 1 = player suppression  
tpwc_ai_sup_playersup = 1;   

//Pistol and SMG ammo to ignore. Add custom ammo (eg suppressed) or change to taste      
tpwc_ai_sup_mags =[  
"30rnd_9x19_MP5",     
"30rnd_9x19_MP5SD",     
"15Rnd_9x19_M9",     
"15Rnd_9x19_M9SD",     
"7Rnd_45ACP_1911",     
"7Rnd_45ACP_1911",    
"8Rnd_9x18_Makarov",    
"8Rnd_9x18_MakarovSD",    
"64Rnd_9x19_Bizon",    
"64Rnd_9x19_SD_Bizon",    
"13Rnd_9mm_SLP",    
"17Rnd_9x19_glock17",    
"6Rnd_45ACP",    
"30Rnd_9x19_UZI",    
"30Rnd_9x19_UZI_SD"  
];    

//////////  
// SET UP  
//////////  

//Declare private variables  
private ["_stanceregain","_skillregain","_unit","_bc","_shots","_originalaccuracy","_originalshake","_originalcourage","_general","_ball1","_ball2","_ball3","_skillset","_asr","_tint","_blur","_x","_showBalls","_statusColor"];  

//Allow time for ASR AI skills to propagate  
sleep tpwc_ai_sup_sleep;  

//Start hint     
if (tpwc_ai_sup_hint == 1) then {  
0 = [] spawn { 
hintsilent "TPWC AI Suppress 1.02 Active";  
sleep 3;  
hintsilent ""};  
};     

//////////////////  
// MAIN FUNCTIONS   
//////////////////   

//BULLET DETECTION LOOP (TIME CRITICAL) 
//Do not touch this please 
tpwc_ai_sup_detect =       
{      
   {     
   _unit = _x; 
   if !(isnull tpwc_ai_sup_bullet) then      
       {     
       _bc = count ((getposatl _unit) nearobjects ["bulletbase",tpwc_ai_sup_br]);     
       if (_bc > 0) then      
           {    
           if ((tpwc_ai_sup_fired distance _unit) > tpwc_ai_sup_ir) then      
               {     
               if !(tpwc_ai_sup_mag in tpwc_ai_sup_mags) then      
                   {    
                   _unit setvariable ["tpwc_skillregain", diag_ticktime + (random 4)-((_unit getvariable "tpwc_general")+(_unit getvariable "tpwc_originalcourage"))];      
                   _unit setvariable ["tpwc_stanceregain", diag_ticktime + 10];     
                   _unit setvariable ["tpwc_supshots",(_unit getvariable "tpwc_supshots") + _bc];     
                   _unit setvariable ["tpwc_suppressedstance", 1]; 
                   if ((side tpwc_ai_sup_fired != side _unit) && (vehicle _unit == _unit)) then 
                       { 
                       _unit setvariable ["tpwc_suppressedstance", 2];                             
                       if (_unit getvariable "tpwc_supshots" > tpwc_ai_sup_st) then     
                           { 
                           _unit setvariable ["tpwc_suppressedstance", 3];
                           }; 
                       };      
                   };     
               };     
           };     
       };     
   } foreach allunits;     
};     


//UNIT STANCE/SKILL MODIFICATION LOOP (NON TIME CRITICAL) 
tpwc_ai_sup_behaviour =  
{ 
tpwc_ai_sup_supvisflag = 0; 
while {true} do  
   { 
       { 
       if (alive _x) then  
           { 
           _unit  = _x;
           _skillregain = _unit getvariable ["tpwc_skillregain", -1];      
           _stanceregain = _unit getvariable ["tpwc_stanceregain", -1];
		_statusColor = _unit getvariable ["tpwc_suppressedstance", 0];

           //Set initial parameters for each unit 
           if (_stanceregain == -1) then      
               {  
               _unit setvariable ["asr_ai_sys_aiskill_configured", false];   
               _unit setvariable ["tpwc_skillset", false];   
               _unit setvariable ["tpwc_combatmode", "unchanged"];  
               _unit setvariable ["tpwc_originalaccuracy", _unit skill "aimingaccuracy"];    
               _unit setvariable ["tpwc_originalshake",  _unit skill "aimingshake"];   
               _unit setvariable ["tpwc_originalcourage", _unit skill "courage"];    
               _unit setvariable ["tpwc_general", _unit skill "general"];   
               _unit setvariable ["tpwc_stanceregain", diag_ticktime];    
               _unit setvariable ["tpwc_skillregain", diag_ticktime];
               _unit addeventhandler ["fired",{tpwc_ai_sup_fired = _this select 0;tpwc_ai_sup_mag = _this select 5; tpwc_ai_sup_bullet = _this select 6}];     
               if ( ( assignedVehicleRole _unit) select 0 == "Turret"  ) then  
                   { 
                   (vehicle _unit) addeventhandler ["fired",{tpwc_ai_sup_fired = _this select 0;tpwc_ai_sup_mag = _this select 5; tpwc_ai_sup_bullet = _this select 6}];  
                   }; 
               if (tpwc_ai_sup_debug == 1) then    
                   {
				_ball1 = "Sign_sphere25cm_EP1" createvehicle getposatl _unit; 
                   _ball1 setObjectTexture [0,"#(argb,8,8,3)color(0.2,0.9,0.2,0.5,ca)"]; 
                   _ball1 attachTo [_unit,[0,0,2]];  
                   _unit setvariable ["tpwc_sup1ball",_ball1];
				_ball1 hideobject true; 

                   _ball2 = "Sign_sphere25cm_EP1" createvehicle getposatl _unit; 
                   _ball2 setObjectTexture [0,"#(argb,8,8,3)color(0.6,0.9,0.0,0.7,ca)"]; //yellow 
                   _ball2 attachTo [_unit,[0,0,2]];  
                   _unit setvariable ["tpwc_sup2ball",_ball2];
                   _ball2 hideobject true; 

                   _ball3 = "Sign_sphere25cm_EP1" createvehicle getposatl _unit; 
                   _ball3 setObjectTexture [0,"#(argb,8,8,3)color(0.8,0.5,0.5,0.5,ca)"]; //red 
                   _ball3 attachTo [_unit,[0,0,2]];  
                   _unit setvariable ["tpwc_sup3ball",_ball3];
                   _ball3 hideobject true; 					 

				if ( isDedicated ) then
					{
					wpc_statusball = [_ball1, true, _ball2, true, _ball3, true, _unit, "none"];
					[-1, {(_this select 0) hideobject (_this select 1);(_this select 2) hideobject (_this select 3);(_this select 4) hideobject (_this select 5);}, wpc_statusball] call CBA_fnc_globalExecute;					
					};
                   }; 
               };  

           //If unit skills are unsuppressed 
           if (diag_ticktime >= _skillregain) then     
               { 
               _originalaccuracy = _unit getvariable "tpwc_originalaccuracy";       
               _originalshake = _unit getvariable "tpwc_originalshake";                
               _originalcourage = _unit getvariable "tpwc_originalcourage";    
               _general = _unit getvariable "tpwc_general";          
               if((_unit skill "aimingaccuracy") < _originalaccuracy) then     
                   {   
                   _unit setskill ["aimingaccuracy",(_unit skill "aimingaccuracy")+((_originalaccuracy-(_unit skill "aimingaccuracy"))*.325)];      
                   };    
               if((_unit skill "aimingshake") < _originalshake) then     
                   {     
                   _unit setskill ["aimingshake",(_unit skill "aimingshake")+((_originalshake-(_unit skill "aimingshake"))*.325)];     
                   };   
               }; 

           //If unit stance is unsuppressed 
           if ( diag_ticktime >= _stanceregain) then      
               {
               _unit setvariable ["tpwc_supshots", 0];     
               _unit setunitpos "auto";    
               _originalcourage = _unit getvariable "tpwc_originalcourage";    
               _general = _unit getvariable "tpwc_general";
               _unit setvariable ["tpwc_suppressedstance", 0];
               if((_unit skill "courage") < (_originalcourage - 0.1)) then     
                   {     
                   _unit setskill ["courage",(_unit skill "courage")+(_general)*(0.1)];      
                   }    
                   else   
                   {   
                   if (_unit getvariable "tpwc_combatmode" != "unchanged") then  
                       { 
                       _unit setbehaviour str(_unit getvariable "tpwc_combatmode"); 
                       _unit setvariable ["tpwc_combatmode", "unchanged"];  
                       }; 
                   };   
               };    

		switch ( _unit getvariable "tpwc_suppressedstance" ) do
		{
			case 1: //If any bullets near unit
				{
				_unit setvehicleinit format ["this setunitpos 'middle';"];
				processinitcommands;
				clearVehicleInit _unit;
				};

			case 2: //If enemy bullets near unit
				{
				_unit setvehicleinit format ["this setunitpos 'middle';"];
				processinitcommands;
				clearVehicleInit _unit;
				_unit setvariable ["tpwc_combatmode", behaviour _unit];  
				if( !( behaviour _unit in ["COMBAT", "STEALTH"] ) ) then  
					{ 
					_unit setbehaviour "COMBAT";  
					};     
				_originalaccuracy = _unit getvariable "tpwc_originalaccuracy";      
				_originalshake = _unit getvariable "tpwc_originalshake";    
				_originalcourage = _unit getvariable "tpwc_originalcourage";     
				_general = _unit getvariable "tpwc_general";   
				_shots = _unit getvariable "tpwc_supshots";   
				if (diag_ticktime < _skillregain) then  
					{        
					_unit setskill ["aimingaccuracy",_originalaccuracy*_originalcourage*_general-(_shots*(1-_general)*.003)];       
					_unit setskill ["aimingshake",_originalshake*_originalcourage*_general-(_shots*(1-_general)*.003)];      
					_unit setskill ["courage",(_unit skill "courage")-(_shots*(1-_general)*(1-_originalcourage)*.07)];  
					}; 
				if ((isPlayer _unit) and (tpwc_ai_sup_playersup == 1) and (diag_ticktime < _skillregain)) then  
					{  
					addCamShake [1.5 - (skill _unit),(random 4)-((_unit getvariable "tpwc_general")+(_unit getvariable "tpwc_originalcourage")) , 2.5] 
					};
				};

			case 3: //If unit is suppressed with more than 5 enemy bullets 
				{
				_unit setvehicleinit format ["this setunitpos 'down';"];
				processinitcommands;
				clearVehicleInit _unit;
				_unit forcespeed -1; 
				if( !( behaviour _unit in ["COMBAT", "STEALTH"] ) ) then  
					{ 
					_unit setbehaviour "COMBAT";  
					};
				_unit setvariable ["tpwc_combatmode", behaviour _unit];	//TODO: verify right order
				_originalaccuracy = _unit getvariable "tpwc_originalaccuracy";      
				_originalshake = _unit getvariable "tpwc_originalshake";    
				_originalcourage = _unit getvariable "tpwc_originalcourage";     
				_general = _unit getvariable "tpwc_general";   
				_shots = _unit getvariable "tpwc_supshots";   
				if (diag_ticktime < _skillregain) then  
					{        
					_unit setskill ["aimingaccuracy",_originalaccuracy*_originalcourage*_general-(_shots*(1-_general)*.003)];       
					_unit setskill ["aimingshake",_originalshake*_originalcourage*_general-(_shots*(1-_general)*.003)];      
					_unit setskill ["courage",(_unit skill "courage")-(_shots*(1-_general)*(1-_originalcourage)*.07)];  
					}; 
				if ((isPlayer _unit) and (tpwc_ai_sup_playersup == 1) and (diag_ticktime < _skillregain)) then  
					{ 
					[] spawn tpwc_ai_sup_visuals; 
					addCamShake [2 - (skill _unit),(random 6)-((_unit getvariable "tpwc_general")+(_unit getvariable "tpwc_originalcourage")) , 5] 
					}; 
				};
		};

		//If debug set the debugmarkers right
		if ( ( _statusColor > 0 ) && (tpwc_ai_sup_debug == 1 ) ) then
			{
			//diag_log format ["AI-SUPPRESS: %1: %2 - %3",_unit, _statusColor, _unit getvariable "tpwc_suppressedstance"];

			_ball1 = _unit getvariable "tpwc_sup1ball";  
			_ball2 = _unit getvariable "tpwc_sup2ball";  
			_ball3 = _unit getvariable "tpwc_sup3ball"; 

			switch ( _unit getvariable "tpwc_suppressedstance" ) do
				{
				case 1: 
					{
					wpc_statusball = [_ball1, false, _ball2, true, _ball3, true, _unit, "green"];
					};

				case 2:
					{
					wpc_statusball = [_ball1, true, _ball2, false, _ball3, true, _unit, "yellow"];
					};

				case 3:
					{
					wpc_statusball = [_ball1, true, _ball2, true, _ball3, false, _unit, "red"];
					};

				default
					{
					wpc_statusball = [_ball1, true, _ball2, true, _ball3, true, _unit, "none"];
					};
				};

			wpc_statusball call {(_this select 0) hideobject (_this select 1);(_this select 2) hideobject (_this select 3);(_this select 4) hideobject (_this select 5);diag_log format ["TPW-AI-SUPPRESS: %1 - %2", _this select 6, _this select 7];};

			if ( isDedicated ) then
				{
				[-1, {(_this select 0) hideobject (_this select 1);(_this select 2) hideobject (_this select 3);(_this select 4) hideobject (_this select 5);}, wpc_statusball] call CBA_fnc_globalExecute;
				//[-1, {diag_log format ["TPW-AI-SUPPRESS: %1: %2 - %3 - %4 - %5", _this select 6, _this select 7, _this select 1, _this select 3, _this select 5];}, wpc_statusball] call CBA_fnc_globalExecute;
				};
			};
           }; 
       } foreach allunits;  

       //Remove debug balls from dead AI 
       if (tpwc_ai_sup_debug == 1) then 
           { 
               { 
                   _unit = _x; 
                   _ball1 = _unit getvariable "tpwc_sup1ball"; 
                   if ( !(_ball1 == objNull) ) then  
                       {   
                       detach _ball1;  
                       deleteVehicle _ball1; 
                       _unit setvariable ["tpwc_sup1ball",nil];         
                       }; 
                       _ball2 = _unit getvariable "tpwc_sup2ball"; 
                   if ( !(_ball2 == objNull) ) then  
                       {   
                       detach _ball2;  
                       deleteVehicle _ball2; 
                       _unit setvariable ["tpwc_sup2ball",nil];         
                       }; 
                       _ball3 = _unit getvariable "tpwc_sup3ball"; 
                   if ( !(_ball3 == objNull) ) then  
                       {   
                       detach _ball3;  
                       deleteVehicle _ball3; 
                       _unit setvariable ["tpwc_sup3ball",nil];         
                       }; 
               } foreach allDead; 
           }; 
   sleep 1;     
   } 
}; 

//BLUR PLAYER VISION WHEN SUPPRESSED 
tpwc_ai_sup_visuals =  
{ 
if (tpwc_ai_sup_supvisflag == 0) then  
   { 
   tpwc_ai_sup_supvisflag = 1; 
   _tint = ppEffectCreate ["Colorcorrections", 1552]; 
   _tint ppEffectEnable true; 
   _blur = ppEffectCreate ["RadialBlur", 1551]; 
   _blur ppEffectEnable true; 
   _blur ppEffectAdjust [0.001,0.001,0.1,0.1]; 
   _blur ppEffectCommit 0; 
   _tint ppEffectAdjust[1, 1, -0.002, [0,0,0,0], [0,0,0,1], [0,0,0,1]]; 
   _tint ppEffectCommit 0; 
   sleep 0.1; 
   _blur ppEffectAdjust [0.002,0.002,0.1,0.1]; 
   _blur ppEffectCommit 0; 
   _tint ppEffectAdjust[1, 1, -0.004, [0,0,0,0], [0,0,0,1], [0,0,0,1]]; 
   _tint ppEffectCommit 0; 
   sleep 0.1; 
   _blur ppEffectAdjust [0.003,0.003,0.1,0.1]; 
   _blur ppEffectCommit 0; 
   _tint ppEffectAdjust[1, 1, -0.006, [0,0,0,0], [0,0,0,1], [0,0,0,1]] ;  
   _tint ppEffectCommit 0; 
   sleep 0.1; 
   _blur ppEffectAdjust [0.004,0.004,0.1,0.1]; 
   _blur ppEffectCommit 0; 
   _tint ppEffectAdjust[1, 1, -0.008, [0,0,0,0], [0,0,0,1], [0,0,0,1]] ;  
   _tint ppEffectCommit 0; 
   sleep 5; 
   _blur ppEffectAdjust [0.003,0.003,0.1,0.1]; 
   _blur ppEffectCommit 0; 
   _tint ppEffectAdjust[1, 1, -0.006, [0,0,0,0], [0,0,0,1], [0,0,0,1]] ; 
   _tint ppEffectCommit 0; 
   sleep 0.1; 
   _blur ppEffectAdjust [0.002,0.002,0.1,0.1]; 
   _blur ppEffectCommit 0; 
   _tint ppEffectAdjust[1, 1, -0.004, [0,0,0,0], [0,0,0,1], [0,0,0,1]] ; 
   _tint ppEffectCommit 0; 
   sleep 0.1; 
   _blur ppEffectAdjust [0.001,0.001,0.1,0.1]; 
   _blur ppEffectCommit 0; 
   _tint ppEffectAdjust[1, 1, -0.002, [0,0,0,0], [0,0,0,1], [0,0,0,1]] ; 
   _tint ppEffectCommit 0; 
   ppEffectDestroy _blur; 
   ppEffectDestroy _tint; 
   tpwc_ai_sup_supvisflag = 0; 
   }; 
}; 


//IF ASR AI HAS SET UNIT SKILLS, MAKE THESE THE "ORIGINALS" FOR EACH UNIT   
tpwc_ai_sup_asrskills =  
{  
sleep 3;  
while {true} do   
   {  
       {  
       _unit = _x;  
       _asr = _unit getVariable "asr_ai_sys_aiskill_configured";  
       _skillset = _unit getVariable "tpwc_skillset";  
       if ((_asr) && !(_skillset))then   
           {  
           _unit setvariable ["tpwc_originalaccuracy", _unit skill "aimingaccuracy"];    
           _unit setvariable ["tpwc_originalshake", _unit skill "aimingshake"];   
           _unit setvariable ["tpwc_originalcourage", _unit skill "courage"];    
           _unit setvariable ["tpwc_general",_unit skill "general"];   
           _unit setvariable ["tpwc_skillset", true];  
           };  
       } foreach allunits;  
   sleep 30;  
   };  
};   

///////////////// 
// RUN IT 
///////////////// 

//Spawn behaviour loop 
[] spawn tpwc_ai_sup_behaviour;  
sleep 1; 

//Spawn ASR_AI skill set loop if running ASR_AI > 1.15.1      
if (isclass (configfile >> "cfgPatches">>"asr_ai_sys_aiskill")) then   
   {  
   _asr_ai_va = getArray (configfile>>"cfgPatches">>"asr_ai_main">>"versionAr"); 
   if (_asr_ai_va select 0 >= 1 && _asr_ai_va select 1 >= 15 && _asr_ai_va select 2 >= 1) then  
       { 
       [] spawn tpwc_ai_sup_asrskills;  
       };     
   };  

//Call time critical bullet detection loop 
[tpwc_ai_sup_detect,0] call cba_fnc_addPerFrameHandler;   

};

Share this post


Link to post
Share on other sites
he used colourcorrections and radialblur. So even with pp off you should get some effects (colour corrections). And just out of interest, why is it so important that pp be off? what's wrong with just having it on very low?

2 FPS more for not much visual difference.

Share this post


Link to post
Share on other sites

I also play with PP turned off. It's a must for PCs with weak graphics cards (and you can get by with a weak GPU in ArmA).

Share this post


Link to post
Share on other sites

saw last code posted by Ollem, some minor stuff: I would change tpwc_ai_sup_detect to

tpwc_ai_sup_detect =        
{       
   {      
   _unit = _x;  
   if !(isnull tpwc_ai_sup_bullet && (vehicle _unit == _unit) ) then       
       {      
       _bc = count ((getposatl _unit) nearobjects ["bulletbase",tpwc_ai_sup_br]);      
       if (_bc > 0) then       
           {     
           if ((tpwc_ai_sup_fired distance _unit) > tpwc_ai_sup_ir) then       
               {      
               if !(tpwc_ai_sup_mag in tpwc_ai_sup_mags) then       
                   {     
                   _unit setvariable ["tpwc_skillregain", diag_ticktime + (random 4)-((_unit getvariable "tpwc_general")+(_unit getvariable "tpwc_originalcourage"))];       
                   _unit setvariable ["tpwc_stanceregain", diag_ticktime + 10];      
                   _unit setvariable ["tpwc_supshots",(_unit getvariable "tpwc_supshots") + _bc];      
                   _unit setvariable ["tpwc_suppressedstance", 1];  
                   if ((side tpwc_ai_sup_fired != side _unit) ) then  
                       {  
                       _unit setvariable ["tpwc_suppressedstance", 2];                              
                       if (_unit getvariable "tpwc_supshots" > tpwc_ai_sup_st) then      
                           {  
                           _unit setvariable ["tpwc_suppressedstance", 3]; 
                           };  
                       };       
                   };      
               };      
           };      
       };      
   } foreach allunits;      
};  

Moved "&& (vehicle _unit == _unit)" way up up in order to save unneeded processing for any units being into vehicles.

Also adding there some handling for "unconscious" units would be useful, maybe something like:

tpwc_ai_sup_detect =        
{       
   {      
   _unit = _x;  
   if !(isnull tpwc_ai_sup_bullet && (vehicle _unit == _unit) && (lifeState _unit == "ALIVE") ) then       
       {      
       _bc = count ((getposatl _unit) nearobjects ["bulletbase",tpwc_ai_sup_br]);      
       if (_bc > 0) then       
           {     
           if ((tpwc_ai_sup_fired distance _unit) > tpwc_ai_sup_ir) then       
               {      
               if !(tpwc_ai_sup_mag in tpwc_ai_sup_mags) then       
                   {     
                   _unit setvariable ["tpwc_skillregain", diag_ticktime + (random 4)-((_unit getvariable "tpwc_general")+(_unit getvariable "tpwc_originalcourage"))];       
                   _unit setvariable ["tpwc_stanceregain", diag_ticktime + 10];      
                   _unit setvariable ["tpwc_supshots",(_unit getvariable "tpwc_supshots") + _bc];      
                   _unit setvariable ["tpwc_suppressedstance", 1];  
                   if ((side tpwc_ai_sup_fired != side _unit) ) then  
                       {  
                       _unit setvariable ["tpwc_suppressedstance", 2];                              
                       if (_unit getvariable "tpwc_supshots" > tpwc_ai_sup_st) then      
                           {  
                           _unit setvariable ["tpwc_suppressedstance", 3]; 
                           };  
                       };       
                   };      
               };      
           };      
       };      
   } foreach allunits;      
};  

Can't run the game here, maybe somebody may check ...

Edited by fabrizio_T
improved ...

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×