Cerebus06 3 Posted July 23, 2018 I don't even know if this is possible, but I'm working on a mission where - I'm hoping - I can create a trigger when the player actually views an object. In this case, it would be enemy personnel, vehicles, helicopters, etc. The idea is that the player uses binoculars, a spotting scope, or a sniper scope to view the object, and once seen it fires the trigger. Is this something that's possible within the scope of ARMA 3 scripting, or is there a better method to accomplish something like this? Share this post Link to post Share on other sites
gc8 977 Posted July 23, 2018 I think you can use cursortarget command for that Share this post Link to post Share on other sites
stanhope 411 Posted July 23, 2018 I'm presuming a sniper spotter team, player being spotter sniper being AI? You could use a trigger with knowsabout or like gc8 said cursortarget combined with distance. If you're trying to have the AI fire use doWatch and doTarget. If you want him to shoot at a very specific moment you can use forceWeaponFire Share this post Link to post Share on other sites
POLPOX 778 Posted July 23, 2018 onEachFrame { _camDist = (positionCameraToWorld [0,0,0] distance pos) ; hintsilent str ((positionCameraToWorld [0,0,_camDist] distance pos)/_camDist/2) } ; onEachFrame { _screenPos = worldToScreen getPosATL sph ; if (count _screenPos != 0) then { hintsilent str (_screenPos distance2D [0.5,0.5]) } ; } ; These are my stupid opinion. Set pos the position, and the hint will show you the value. The later one has a slightly high performance. Share this post Link to post Share on other sites
Cerebus06 3 Posted July 23, 2018 Okay, awesome - thanks a lot! One more question - is there a way for knowsAbout to occur at a distance without the need to Reveal / Lock the target? Or is that just a necessary quirk of ARMA 3? Share this post Link to post Share on other sites
HazJ 1289 Posted July 23, 2018 @Larrow also posted some code (I think) somewhere but can't seem to find it... I believe he used a different approach (lineIntersects?) if my memory is correct. I think the thread was asking for use with rangefinder as well. EDIT: Not sure if this is it. Not Larrow... idk Share this post Link to post Share on other sites
pierremgi 4905 Posted July 24, 2018 cursorObject is fine for "targeting" an object without specific knowledge of friend or foe. That's very precise and that works for any object. No need to run a line intersect for that. cursortarget is more unit/vehicle oriented. Note: you need to enable auto reporting in game difficulties if you're playing in SP or MP one player, without any friendly unit in your group. Share this post Link to post Share on other sites
Larrow 2822 Posted July 24, 2018 20 hours ago, Cerebus06 said: The idea is that the player uses binoculars, a spotting scope, or a sniper scope to view the object, Maybe something like... _findTargetEH = addMissionEventHandler [ "EachFrame", { //Are we using optics mode AND the current target is TheTarget ( replace with who/what you want spotted ) _hasFoundTarget = if ( cameraView == "GUNNER" && { cursorObject == TheTarget } ) then { //If we are currently looking down some sort of binoclars if ( currentWeapon player isKindOf [ "Binocular", configFile >> "CfgWeapons" ] ) then { //We have spotted the target true }else{ //If the players current weapon has an optic if !( player weaponAccessories currentWeapon player select 2 isEqualTo "" ) then { //Get the optic name _scope = player weaponAccessories currentWeapon player select 2; //Get the optics different modes ( reticle or iron sights ) //If it has an array of zeroing distances with more than one value //This in vanilla arma3 will only happen for scopes... //["optic_SOS","optic_Nightstalker","optic_tws","optic_tws_mg","optic_DMS","optic_LRPS","optic_AMS","optic_AMS_khk","optic_AMS_snd","optic_KHS_blk","optic_KHS_hex","optic_KHS_old","optic_KHS_tan","optic_DMS_ghex_F","optic_SOS_khk_F","optic_LRPS_tna_F","optic_LRPS_ghex_F"] //And in vanilla arma3 there are no weapon scopes that have more than two modes ( ironsights and reticle ) //Select that optic mode _opticRangedCfg = (" isArray( _x >> 'discreteDistance' ) && { count getArray( _x >> 'discreteDistance' ) > 1 } " configClasses( configFile >> "CfgWeapons" >> _scope >> "ItemInfo" >> "OpticsModes" )) select 0; //Get the optics mode zeroing ranges _opticRanges = getArray( _opticRangedCfg >> "discreteDistance" ); //Get lowest zero _opticLowerRange = selectMin _opticRanges; //Get highest zero _opticUpperRange = selectMax _opticRanges; //Get players current zeroing _currentOpticZeroing = currentZeroing player; //If our current zero is inbetween the optic modes zeros //Then it is extremely likely we are currently looking down a high powered scope //You could add extra checks here, for example if you needed the player to spot the target //From atleast a minimum distance //OR a scope that has a specific zeroing range like the NightStalker only goes out to 1000m //Where most of the others have a higher max zero if ( _currentOpticZeroing >= _opticLowerRange && _currentOpticZeroing <= _opticUpperRange ) then { true }else{ false }; }else{ false }; }; }; if ( _hasFoundTarget ) then { //Do what ever you need here hint "You have spotted your target"; }; }]; ...may needs some finesse depending on the functionality you want. For trigger condition Spoiler if ( cameraView == "GUNNER" && { cursorObject == TheTarget } ) then { if ( currentWeapon player isKindOf [ "Binocular", configFile >> "CfgWeapons" ] ) then { true }else{ if !( player weaponAccessories currentWeapon player select 2 isEqualTo "" ) then { _scope = player weaponAccessories currentWeapon player select 2; _opticRangedCfg = (" isArray( _x >> 'discreteDistance' ) && { count getArray( _x >> 'discreteDistance' ) > 1 } " configClasses( configFile >> "CfgWeapons" >> _scope >> "ItemInfo" >> "OpticsModes" )) select 0; _opticRanges = getArray( _opticRangedCfg >> "discreteDistance" ); _opticLowerRange = selectMin _opticRanges; _opticUpperRange = selectMax _opticRanges; _currentOpticZeroing = currentZeroing player; if ( _currentOpticZeroing >= _opticLowerRange && _currentOpticZeroing <= _opticUpperRange ) then { true }else{ false }; }else{ false }; }; }; A little debug console script for whittling down scope types, may be useful? Spoiler _scopes = " getNumber( _x >> 'scope' ) isEqualTo 2 && getNumber( _x >> 'type' ) isEqualTo 131072 && count ( ' isArray( _x >> ''discreteDistance'' ) && { count ( getArray( _x >> ''discreteDistance'' )) > 1 } ' configClasses( _x >> 'ItemInfo' >> 'OpticsModes' )) isEqualTo 1 " configClasses( configFile >> "CfgWeapons" ) apply { configName _x }; copyToClipboard str _scopes //For all of CfgWeapons //That are spawnable ( scope 2 ) //That are an optic ( type 131072 ) //For all optic modes of the optic //That has a discreteDistance array //And the discreteDistance array has more than one value //Add more in here to whittle down scope type 1 2 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted July 25, 2018 On 24/7/2018 at 4:39 PM, Larrow said: Maybe something like... Larrow that was just great ! Thanks ! Share this post Link to post Share on other sites