Forum Jump :

Author Message


Posts: 10
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2010-11-22 22:09        
     
hey, i tried searching for some form of script that relates to the ai calling out ranges for a sniper/spotter mission im working on, but im beat. the OA mission that uses this script isnt what i was looking for either.


basically i want to make a script that when pointing at something and pressing a key (p for instance) would get my ai spotter to determine the range to where i was pointing and give that data back to me via the radio chat (custom voice feedback is too complicated for me to make)


is there a way of doing this? i thought about using cursortarget but it seems very limited as to what you can actually spot and determine the range of.


Author Message

VIPER[CWW]  

I'm a stable whore


Posts: 2125
Rank:


Level: Member

Country: en
Location:
Occupation:
Age: 31
In-game name: VIPER [RR]

 
#2 Posted at 2010-11-23 02:30        
     
Have you by any chance played the OA scenario "One Shot One Kill"; when you are scoping out the area and your spotter is close, he sometimes calls out the target range in text and speech form, you mayu want to open up the missions.pbo and see how BIS did it. :-)

Thats if you have Operation Arrowhead


Advertisement


Author Message


Posts: 10
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2010-11-23 03:21        
     
# VIPER[CWW] : Have you by any chance played the OA scenario "One Shot One Kill"; when you are scoping out the area and your spotter is close, he sometimes calls out the target range in text and speech form, you mayu want to open up the missions.pbo and see how BIS did it. :-)

Thats if you have Operation Arrowhead

yea thats the mission i was toying around with in the editor, but unfortunatly that script is limited in the fact that it can only give range if you focus your scope on human targets and large buildings, as well as vehicles. and also, theres a tendency where even when your looking at a tank from your scope and see it clearly, the cursortarget wont detect the unit as it hasnt been discovered yet by either yourself or the ai. not sure why this happens, but apparently knows about confirmation of a target only gets triggered at certain angles (ex. standing up, or moving a bit, then it just detects).

any other ideas?


Author Message

VIPER[CWW]  

I'm a stable whore


Posts: 2125
Rank:


Level: Member

Country: en
Location:
Occupation:
Age: 31
In-game name: VIPER [RR]

 
#4 Posted at 2010-11-30 12:36        
     
this is the script your reffering to right?

_sniper = _this select 0;
_spotter = _this select 1;

_teamDistanceMax = 50;

_dis = 0;

while {alive _sniper && alive _spotter} do {
	if (player == _sniper) then {
		if (cameraview == "GUNNER") then {
			if (_sniper distance _spotter < _teamDistanceMax) then {
				if !(isnull leader cursortarget) then {
					_disTemp = _sniper distance cursortarget;
					_disRel = abs (_dis - _disTemp);
					if (_disRel > 100) then {
						_disText = (round (_disTemp / 100)) * 100;
						if (_disText > 1000) then {_disText = -1};
						_spotter sidechat format ["%1 M",_disText];
					};
					_dis = _disTemp;
				};
			};
		};
	};
	sleep 1
};

With that script it seems the spotter has to be within 50m of you, and you have to be looking at down the sight before he ranges, been testing it myself and it does sometimes just not give ranges, but if i RMB then it will give the range.

This post was edited by VIPER[CWW] (2010-11-30 13:26, ago)


Author Message


Posts: 10
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2010-12-01 23:33        
     
yup thats the one i was looking at as well, but its very iffy to use.

thankfully i managed to find a much better solution to my problem when i downloaded RMM Functions as it contains a function that can calculate the distance between two objects (in my case cursortarget and player) and feeds back the range through the radio chat. not the greatest but its defintly more reliable then the one from that mission. and the code from that mission is really difficult to isolate as it intertwined with other unnecessary scripts.

+ im pretty new to scripting myself, but thankfully managed to get a working range me script going ^^


Author Message

VIPER[CWW]  

I'm a stable whore


Posts: 2125
Rank:


Level: Member

Country: en
Location:
Occupation:
Age: 31
In-game name: VIPER [RR]

 
#6 Posted at 2010-12-02 15:22        
     
Nice one *THUMBS UP* perhaps you can post it here for others to see and use :-)