Jump to content
Sign in to follow this  
bohemi

Focuse my binoculars over a target

Recommended Posts

How can I activate a trigger or something when I focuse my binoculars over a specific target?

example: I'm using my binoculars searching for an AA launcher... then I localize the launcher,

...then a sidechat its activated by me "AA threat find at grid ... , over."

Thanks any help..

Share this post


Link to post
Share on other sites

hi,

How can I activate a trigger or something when I focuse my binoculars over a specific target?

example: I'm using my binoculars searching for an AA launcher... then I localize the launcher,

...then a sidechat its activated by me "AA threat find at grid ... , over."

Thanks any help..

You can check the knowsAbout value between the unit and his target and then sideChat a message when the knowsAbout value is bigger than 0.105 which is the magic number in ofp 1.96

Here's a script to do what you want.

how to: Select your binoculars, aim at the AA and right click to reveal the target.

init.sqs

papabear=[West, "HQ"]
[p1,EastShilka1] exec "find_aa.sqs"

exit

find_aa.sqs

;*********************************************************************************
;Find AA Threat Script by Nikiller v0.9b
;If the unit find the target then he communicate the coords to HQ
;NOTE: You may need to tweak _v variable to obtain the result you want
;NOTE2: Select your binoculars, aim at the AA and right click to reveal the target
;contact: nikillerofp@hotmail.fr
;[unitName,targetName] exec "find_aa.sqs"
;*********************************************************************************

_u = _this select 0
_t = _this select 1

;MP Note knowsAbout returns a viable result only if left-hand parameter unit is local
if (local _u) then {} else {goto "ende"}

_v=0.105
_d=2

#check
~_d
_k=_u knowsAbout _t
if ((_k<=_v) && (alive _u) && (alive _t)) then {goto "check"}

if (!(alive _u) || !(alive _t)) then {goto "ende"}

_calcpos={private["_unitpos","_xpos", "_ypos","_letters","_numbers","_xcoor", "_ycoor","_return"];_xpos = getpos player select 0;_ypos = getpos player select 1;_letters=["Aa","Ab","Ac","Ad","Ae","Af","Ag","Ah","Ai","Aj","Ba","Bb","Bc","Bd","Be","Bf","Bg","Bh","Bi","Bj","Ca","Cb","Cc","Cd","Ce","Cf","Cg","Ch","Ci","Cj","Da","Db","Dc","Dd","De","Df","Dg","Dh","Di","Dj","Ea","Eb","Ec","Ed","Ee","Ef","Eg","Eh","Ei","Ej","Fa","Fb","Fc","Fd","Fe","Ff","Fg","Fh","Fi","Fj","Ga","Gb","Gc","Gd","Ge","Gf","Gg","Gh","Gi","Gj","Ha","Hb","Hc","Hd","He","Hf","Hg","Hh","Hi","Hj","Ia","Ib","Ic","Id","Ie","If","Ig","Ih","Ii","Ij","Ja","Jb","Jc","Jd","Je","Jf","Jg","Jh","Ji","Jj"];_numbers=["99","98","97","96","95","94","93","92","91","90","89","88","87","86","85","84","83","82","81","80","79","78","77","76","75","74","73","72","71","70","69","68","67","66","65","64","63","62","61","60","59","58","57","56","55","54","53","52","51","50","49","48","47","46","45","44","43","42","41","40","39","38","37","36","35","34","33","32","31","30","29","28","27","26","25","24","23","22","21","20","19","18","17","16","15","14","13","12","11","10","09","08","07","06","05","04","03","02","01","00"];_xcoor=_letters select ((_xpos-64)/128);_ycoor=_numbers select ((_ypos-64)/128);_return=[_xcoor,_ycoor];_return};

_pos=[getPos _t] call _calcpos

_xcoor=_pos select 0
_ycoor=_pos select 1

_u sideChat format [ "%1, this is %4, AA threat found at %2 %3. Over.",papabear,_xcoor,_ycoor,_u]

#ende

exit

I also made a little script to test the knowsAbout value between 2 units. In the demo use radio alpha to see the knowsAbout value in real time.

test_knowsabout.sqs

;************************************************************************
;KnowsAbout Test Script by Nikiller v0.9b
;Display hint format to know what is the knowsAbout value between 2 units
;contact: nikillerofp@hotmail.fr
;[unitName,targetName] exec "test_knowsabout.sqs"
;************************************************************************

_u = _this select 0
_t = _this select 1

if (local _u) then {} else {goto "ende"}

_k=_u knowsAbout _t

hint format [ "%1 knowsAbout %2 value is %3",_u,_t,_k]

#ende

exit

Here's a demo to show how it works.

DEMO LINK

cya.

Nikiller.

Edited by Nikiller

Share this post


Link to post
Share on other sites

T H A N X S very fine working for me :bounce3:

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
Sign in to follow this  

×