Jump to content
Gunter Severloh

Target Feedback - Impact Measuring Code

Recommended Posts

Target Feedback - Impact Measuring Code

by

Rydygier & Gunter Severloh

 

Hello Arma 3 fans!

I have a little code for you ....

 

Description

This started out as an idea to gather some information on where exactly my bombs were landing (impacting)

during my practice sessions dive bombing with my JU87 Stuka.

      i went to Rydygier and asked him, how can i mark exactly where the bombs i have dropped landed, obviously i could just

fly around the impact area and see where the crater was but i wanted something more accurate.

   So Rydygier came up with a solution, typed up the code below and it did exactly what i was looking for

and i called it Target Feedback 😉

 

Video Demonstration/Overview

Features

- This will create a + sign marker in realtime (not on map) on the exact impact point of whatever you used (weapon) or was in (vehicle) to create the impact.

- The marker will be a blue + if hit (Target Hit!)  Green + if close, Yellow + if Target missed, Orange + target missed, and red + if target missed.

- The colors indicate how far away from the target you are with the impact of your round or landed bomb, missile, rocket, or whatever ammunition was used.

- Along with the color indicator, there will be a number for example 1.08m (with same color of plus sign) which is how far from the target or on target you were.

- The plus sign markers remove or are deleted in about 60 seconds by default which can be changed to whatever number you wish.

- There are 20 markers you can create, every new one created after 20, the first and following are deleted as more are created, this default 20 can be increased or lowered.

=====================

Download the demo mission seen in the video

https://drive.google.com/file/d/1P0t04AD6mcyjJyPMyYVw8FZX20hH_Er3/view?usp=sharing

 

How does this work?

In an init.sqf add the following code:

Spoiler

[] spawn
	{
	RYD_HitMarks = [];
	
	sleep 1;
	
	_eachFrame = 
		{
		_deleteAt = [];
		_icon = getText (configFile >> "CfgMarkers" >> "mil_destroy" >> "icon");
		
			{
			_tme = _x select 1;
			
			if ((time - _tme) < 60) then//change here how long mark should stay visible (in seconds, 60 by default)
				{
			
				_pos = _x select 0;
				_pos set [2,0];
				_dst = _pos distance2D T1;
				_cl = switch (true) do
					{
					case (_dst > 80) : {[1,0,0,1]};
					case (_dst > 60) : {[1,0.5,0,1]};
					case (_dst > 40) : {[1,1,0,1]};
					case (_dst > 20) : {[0.5,1,0,1]};
					case (_dst > 10) : {[0,1,0,1]};
					default {[0,0.25,1,1]};
					};
				
				drawIcon3D [_icon,_cl,_pos,1,1,0,(format ["%1m",(_dst toFixed 1)]),1,0.035,"EtelkaNarrowMediumPro"];
				}
			else
				{
				_deleteAt pushBack _foreachIndex
				}
			}
		foreach RYD_HitMarks;
		
		while {((count RYD_HitMarks) > 20)} do//change here how many marks can be drawn simultaneously - oldest beyond that limit will be deleted (20 by default)
			{
			RYD_HitMarks deleteAt 0
			};
		
		reverse _deleteAt;
		
			{
			RYD_HitMarks deleteAt _x
			}
		foreach _deleteAt
		};

	RYD_EFEH = addMissionEventHandler ["EachFrame",_eachFrame];
	
	RYD_fired = 
		{
		_proj = _this select 6;
		
		_pos = getPosATL _proj;
		
		waitUntil
			{
			if not (isNull _proj) then
				{
				_pos = getPosATL _proj;
				};
				
			_alt = _pos select 2;
			((isNull _proj) or {(_alt < 0.01)})
			};
			
		RYD_HitMarks pushBack [_pos,time];
		
		_dst = _pos distance2D T1;
		
		_txt = if (_dst < 10) then
			{
			"Target hit: %1"
			}
		else
			{
			"Target missed: %1"
			};
		
		systemchat format [_txt,_dst];
		};
	
	{
	_x addEventHandler ["Fired",{_this spawn RYD_fired}];
	}
	foreach [V1,V2,V3];
	};

 

 

Components of the code that can be adjusted

How long the marker will stay 60sec default

if ((time - _tme) < 60) then//change here how long mark should stay visible (in seconds, 60 by default)

How many markers can be created 20 default

while {((count RYD_HitMarks) > 20)} do//change here how many marks can be drawn simultaneously - oldest beyond that limit will be deleted (20 by default)

T1 is the name of the target, you can name it anything you want,

but the target to be impacted requires a name

_dst = _pos distance2D T1;

The player and or vehicle that is to be used to create the marker, each V1 , V2, and V3 are individual vehicles,

again name can be changed but is required.

foreach [V1,V2,V3];

============

 

Credits

I want to thank Rydygier for taking the time out to help me turn my idea into reality.

He further enhanced the idea with the markers and the distance and the customization.      

  • Like 6
  • Thanks 1

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

×