sion 1 Posted February 1, 2013 hi guys hope someone can help me i want to make a script, that makes a ai spotter in your group able to tell u (via chat) the range to the point wich you (as sniper) are actual looking at (e.g. with the scope of ur sniper rifle). Until know i found that script: _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 }; This one is working "ok", but with "cursortarget" u only get ranges for objects (Houses, Units etc ....) But if u are pointing just somewhere else (grass, trees, plants etc) u dont get an value... so i need an alternative to "cursortarget". I need something that works like the rangefinder wich gives u all ranges and not only those of objects. anybody got an idea? aimpos or vectorDir doesnt work or i maybe used them wrong? pls post every idea you might have :) thanks Share this post Link to post Share on other sites
maddogx 13 Posted February 1, 2013 (edited) I believe you're looking for screenToWorld: _pos = screenToWorld [0.5,0.5]; _pos should then contain the coordinates of whatever is at the center of the screen (even if it is empty terrain). Give it a try. :) Edited February 1, 2013 by MadDogX Share this post Link to post Share on other sites
sion 1 Posted February 1, 2013 i love u THANKS :D works much better just sometimes when aiming onto a building i get a value > 3000 but i guess its ok know :D Share this post Link to post Share on other sites
Mattar_Tharkari 10 Posted February 1, 2013 There is one already in game - not used it yet but it looks interesting: [player,nameAIunit] spawn BIS_fnc_spotter; I think the AI spotter must already exist - if you click right mouse button on an enemy target he reports the distance. Share this post Link to post Share on other sites
sion 1 Posted February 1, 2013 There is one already in game - not used it yet but it looks interesting: [player,nameAIunit] spawn BIS_fnc_spotter; I think the AI spotter must already exist - if you click right mouse button on an enemy target he reports the distance. thx but i think the first one is better ;) In the mission (coop) u can recruit units (e.g. u spawn as sniper and can recruit units to your group) thats why the spotter (ai) has no name and i guess this function wouldnt work :) but now i have a new problem the ranging itself is working quite well but it is working all the time (u can ask for range without conditions) dont know how to add a condition i want that u only can ask for range if u are a sniper and a friendly spotter is near (40m or less) both alive of course :) maybe someone could help me here? thats the init yet: JG_SPOTTING_PATH = "jg_spotter\"; //Classes that can Use spotting jg_sniper_classes = tfor_sniper; //spotters jg_spotter_classes = tfor_spotter; if(isDedicated) exitWith{}; if(not (typeOf player in jg_sniper_classes) && count jg_sniper_classes > 0) exitWith{}; jg_spotteraction = player addAction ["Range me",(JG_SPOTTING_PATH+"rangeme.sqs")]; player addEventHandler ["KILLED",{ [] spawn { WaitUntil{alive player}; player removeAction jg_spotteraction; jg_spotteraction = player addAction ["Range me",(JG_SPOTTING_PATH+"rangeme.sqs")]; }; }]; Share this post Link to post Share on other sites
Mattar_Tharkari 10 Posted February 2, 2013 (edited) _sptr = group player createUnit ["US_Soldier_Spotter_EP1", Position player, [], 0, "FORM"]; nul = [player,_sptr] spawn BIS_fnc_spotter; (group player) setCombatMode "BLUE"; works with spawning too. When using in and count you must refer to an array jg_sniper_classes = [tfor_sniper,"US_Soldier_Spotter_EP1"]; Edited February 2, 2013 by Mattar_Tharkari Share this post Link to post Share on other sites