OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Nico [BOS] on 02 Jan 2011, 14:50:14

Title: Calculate accuracy of GAU-8 shot.
Post by: Nico [BOS] on 02 Jan 2011, 14:50:14
Hi,


I'm working on a training mission for Single-player.
The player learns to fly an A-10 and shoot a ground target (a wreck) with GAU-8.

I would like calculate player's accuracy.

To reach that, I need to count how many shells have hit the target.
But I don't know how to proceed, do you ?

Thanks you  :)
Title: Re: Calculate accuracy of GAU-8 shot.
Post by: Nico [BOS] on 18 Jan 2011, 06:17:13
Here is the solution if someone is interested :

Code: [Select]
_target = _this select 0;
impacts = 0;

_target addEventHandler["HandleDamage",{
         _level = _this select 2;
         _shell = _this select 4;
         if ((_level > 0.7) && (_shell isKindOf "B_30mmA10_AP")) then {
            impacts = impacts + 1;
           };
    }];

if (true) exitWith {};
nul=[YourTarget] execVM "YourScript.sqf"
Title: Re: Calculate accuracy of GAU-8 shot.
Post by: fleepee on 18 Jan 2011, 19:08:01
Well done!
Thanks for sharing it here!
 :good: