killerwhale 1 Posted November 9, 2014 Hi, im making a mission where BLUFOR group will come into contact with OPFOR tanks. As soon as the BLUFOR detects the tanks, I want a marker created on one of the tanks. Now that ofcourse is easy if the tank was named, but the catch is, this is not a named unit. i would appreciate if anyone could help. I have tried many commands such as findNearestEnemy nearestObjects nearesEntity with no luck so far Share this post Link to post Share on other sites
jshock 512 Posted November 9, 2014 Could you share how you where using those commands? Because before I saw that you used nearestObject, I was going to recommend trying it, you may have had it setup wrong or incompletely. Share this post Link to post Share on other sites
iceman77 18 Posted November 9, 2014 (edited) Hi. Something like this could work. Untested but I hope that helps. Don't see what's wrong with naming a couple tanks anyhow =). private ["_mrk","_tanks","_tank"]; _tanks = allMissionObjects "O_MBT_02_cannon_F"; waitUntil { {_x distance (leader myGrp) <= 300} count _tanks > 0 && {{(leader myGrp) knowsAbout _x >= 4} count _tanks > 0} }; [[(leader myGrp),"Tank Spotted!!! Marked!!!"],"groupChat"] call BIS_fnc_mp; _mrk = createMarker [ format ["tank_M%1", random 1000], getPosATL (_tanks select 0) ]; _mrk setMarkerShape "ICON"; _mrk setMarkerType "o_armor"; _mrk setMarkerColor "colorRed"; _mrk setMarkerSize [1,1]; /* -- OR Maybe _tank = (_tanks select 0); [ { ["tank3DIcon", "onEachFrame", { private [ "_visPos" ]; _visPos = visiblePosition _tank; _visPos set [ 2, ( ( getPosATL _tank ) select 2 ) + 10 ]; drawIcon3D [ "\A3\ui_f\data\map\markers\nato\o_armor.paa", [ 0, 1, 0, 0.75 ], _visPos, 1, 1, 0, "Enemy Tank", 0, 0.03 ]; }] call BIS_fnc_addStackedEventHandler; }, "BIS_fnc_execVM", true ] call BIS_fnc_mp; */ Edited November 9, 2014 by Iceman77 Share this post Link to post Share on other sites
killerwhale 1 Posted November 9, 2014 it doesnt seem to work but thanks for the help Share this post Link to post Share on other sites
iceman77 18 Posted November 9, 2014 It works as intended. I opened a new mission in the editor. Placed a player unit. Assigned him to myGrp (as in the script). Placed 2 opfor T-100's 500m away. Gave them a waypoint to the player's position. Saved it. Copy and pasted the code into an init.sqf. It marks the tank's position when the condition is met. If you want the marker to track the unit then that's just a bit more code. Share this post Link to post Share on other sites
killerwhale 1 Posted November 11, 2014 It works as intended. I opened a new mission in the editor. Placed a player unit. Assigned him to myGrp (as in the script). Placed 2 opfor T-100's 500m away. Gave them a waypoint to the player's position. Saved it. Copy and pasted the code into an init.sqf. It marks the tank's position when the condition is met. If you want the marker to track the unit then that's just a bit more code. does the marker have a name? Share this post Link to post Share on other sites
jshock 512 Posted November 11, 2014 does the marker have a name? Well, yes, all markers must have a name, but specifically in Iceman's example, he formats the marker name as "tank_M#" where # is a random number between 0 and 1000 so the odds of the name being a repeat are slim to none. In the second commented out portion of his code it creates a 3D marker instead, not the standard map markers, which from the code, I can see it doesn't need a new variable name for its creation. Not sure if that what you meant? Share this post Link to post Share on other sites
killerwhale 1 Posted November 11, 2014 could you be kind enough to make an example mission, im banging my head over this. Share this post Link to post Share on other sites
iceman77 18 Posted November 12, 2014 https://www.dropbox.com/s/xl8jjp3bqfiphw9/TANK_CHECK.Stratis.rar?dl=0 Share this post Link to post Share on other sites
killerwhale 1 Posted November 12, 2014 Thank you Iceman77 so much Share this post Link to post Share on other sites
iceman77 18 Posted November 12, 2014 No worries. When the tanks are within 300m and the player knows enough about them they get marked on the map. There are other ways to do such an event also. Maybe have actual spotters spotting these objects for your squad. Or require the player to acquire a visual via binocular or rangefinder... or laser designator and then mark the target. Maybe even with smoke? Could also have the marker track the target on the map, or in 3D. Share this post Link to post Share on other sites