Jump to content

Recommended Posts

Have you ever felt like AI is too accurate? With this script, you can confirm your feelings.
This script was developed to test if suppression was working on AI. This script uses ACE3 to display some status messages and copy it to the clipboard. You can remove the status messages and use the Arma 3 copyToClipboard function to achieve a vanilla variant. 
In the following configuration rhs units are used. This can be changed to vanilla units.

 

The first 6 lines defines some settings you can change.
distances: distances are all distances that should be tested
suppressions: suppression are all suppression levels that should be checked
shooterclass,targetclass: The classes used as shooter and target
magazine:  magazines are refilled to keep AI shooting at full speed
shotsuntil: shoots for each round.

 

 The result are copied in an Excel format into you clipboard. (Testet with Google Sheets)

 

This should be used in a VR-Map. The units are spawned near 0,0.

distances = [50];
suppressions = [0];
shooterclass = "rhs_msv_emr_rifleman";
targetclass = "B_Survivor_F";
magazine = "rhs_30Rnd_545x39_7N10_AK";
shotsuntil = 300;


fnc_startRound = {
	params["_distance"];
	shot = 0;
	hit = 0;

	_grp = createGroup east;
	shooter = _grp createUnit [shooterclass, [0,0,0], [], 0, "FORM"];
	_grp = createGroup west;
	target = _grp createUnit [targetclass, [_distance,0,0], [], 0, "FORM"];

	shooter addEventHandler ["Fired", {
		params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
		shot = shot + 1;
	}];

	target removeAllEventHandlers "HandleDamage";
	target addEventHandler ["HandleDamage", {
		params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
		0;
	}];

	shooter removeAllEventHandlers "HandleDamage";
	shooter addEventHandler ["HandleDamage", {
		params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
		0;
	}];

	target addEventHandler ["Hit", {
		params ["_unit", "_source", "_damage", "_instigator"];
		hit = hit +1;
	}];
	shooter disableAI "PATH";
	target disableAI "PATH";
    shooter reveal target;
	target reveal shooter;
};

fnc_saveToClipboard = {
	"ace_clipboard" callExtension _this;
	"ace_clipboard" callExtension "--COMPLETE--";
};

fnc_saveResults = {
	tab = toString [9];
	output = "";
	{	
		{
			output = [output, (_x # 0) , tab , (_x # 1) , tab , (_x # 2) , tab , (_x # 3) , endl] joinString "";
		} forEach _x;
	} forEach results;
	output call fnc_saveToClipboard;
};

fnc_init = {
	call fnc_reset;

	["Accuracy", {if (shot==0) exitwith{0}; (hit/shot);}, [false]] call ace_common_fnc_watchVariable;
	["Suppression auf shooter", {getSuppression shooter}, [false]] call ace_common_fnc_watchVariable;
	["shot", {}, [false]] call ace_common_fnc_watchVariable;
	["hit", {}, [false]] call ace_common_fnc_watchVariable;
	["distancebetween", {}, [false]] call ace_common_fnc_watchVariable;
	["suppression", {}, [false]] call ace_common_fnc_watchVariable;

};

fnc_reset = {
	shot = 0;
	hit = 0;
	results=[];
};

fnc_start = {
	{
		distancebetween = _x;
		resultForDistance = [];
		{
			suppression = _x;
			[distancebetween] call fnc_startRound;
			waitUntil {shooter setSuppression suppression; shooter addMagazine magazine; uiSleep 0.3; (shot>=shotsuntil);};
			resultForDistance pushBack [distancebetween, suppression, hit, shot];
			deleteVehicle target;
			deleteVehicle shooter;
			uiSleep 1;
		} forEach suppressions;
		results pushBack resultForDistance;
	} forEach distances;
	
	call fnc_saveResults;
	systemChat "Finished";
};

call fnc_init;
run = [] spawn fnc_start;

 

 

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

×