hellstorm77 2 Posted September 30, 2014 was wonder if someone could help me i want to make a debug in my mission. When i turn it on it shows a icon above all the AI placed in the editor on the map screen and i can turn it off also Share this post Link to post Share on other sites
jshock 512 Posted September 30, 2014 (edited) _allMrks = []; _markUnits = (_this select 0); if (_markUnits) then { _inc=0; { _objpos = getPos _x; _objmrk = createMarker ["Marker"+str _inc, _objpos]; _objmrk setMarkerShape "ICON"; _objmrk setMarkerType "MIL_DOT"; _inc=_inc+1; _allMrks pushback _objMrk; } forEach allUnits; } else { {deleteMarker _x} foreach _allMrks; }; This is a script that would be called via addActions, like below: player addAction ["Marker Toggle On", "markertoggle.sqf", [true], 6, false, true]; player addAction ["Marker Toggle Off", "markertoggle.sqf", [false], 6, false, true]; Edited September 30, 2014 by JShock Share this post Link to post Share on other sites
hellstorm77 2 Posted September 30, 2014 im getting an error Error in expression <s = []; _markUnits = (_this select 0); if (_markUnits) then { _inc=0; { _ob> Error position: <if (_markUnits) then { _inc=0; { _ob> Error if: Type Object, expected Bool File C:\Users\Hellstorm77\Documents\Arma 3\missions\mission_test.Takistan\debug.sqf, line 4 Share this post Link to post Share on other sites
dreadedentity 278 Posted September 30, 2014 (edited) everything = allUnits; markers = []; player addAction ["Show Markers", { { deleteMarker _x }forEach markers; //delete all markers to prevent duplicates markers = []; { _marker = createMarker ["Unit" + (str _forEachIndex), (getPos _x)]; _marker setMarkerShape "ICON"; _marker setMarkerType "MIL_DOT"; markers pushBack _marker; }forEach everything; }]; player addAction ["Remove Markers", { { deleteMarker _x }forEach markers; markers = []; }]; Since this is just for debug we don't have to worry about local variables Edited September 30, 2014 by DreadedEntity Share this post Link to post Share on other sites
benargee 20 Posted September 30, 2014 im getting an error Error in expression <s = []; _markUnits = (_this select 0); if (_markUnits) then { _inc=0; { _ob> Error position: <if (_markUnits) then { _inc=0; { _ob> Error if: Type Object, expected Bool File C:\Users\Hellstorm77\Documents\Arma 3\missions\mission_test.Takistan\debug.sqf, line 4 try adding a variable infront _mkun = if (_markUnits) then Source: https://community.bistudio.com/wiki/if Share this post Link to post Share on other sites
Fluit 13 Posted October 1, 2014 im getting an error Error in expression <s = []; _markUnits = (_this select 0); if (_markUnits) then { _inc=0; { _ob> Error position: <if (_markUnits) then { _inc=0; { _ob> Error if: Type Object, expected Bool File C:\Users\Hellstorm77\Documents\Arma 3\missions\mission_test.Takistan\debug.sqf, line 4 Hi Hell! _markUnits should be true or false. Not an object like you've done now. Good luck! Share this post Link to post Share on other sites
iceman77 18 Posted October 1, 2014 (edited) If you want the markers to track the units then you'll need a loop. I modified Dreadentity's code a bit. description.ext - For MP Lobby parameters (options). Else, disregard description.ext. class Params { class debug { title = "Debug:"; values[] = {0,1}; default = 1; texts[] = {"OFF","ON"}; }; }; dreadScript.sqf if (paramsArray select 0 == 1) then { // For MP lobby only (parameters). Else comment out or delete. toggleOn = false; _xIDx = player addAction ["Toggle Markers", { if (!toggleOn) then { toggleOn = true; everything = allUnits; markers = []; { _marker = createMarker ["Unit" + (str _forEachIndex), (getPos _x)]; _marker setMarkerShape "ICON"; _marker setMarkerType "MIL_DOT"; markers pushBack _marker; }forEach everything; while {toggleOn} do { sleep 1; for "_i" from 0 to (count everything) - 1 do { call compile format ["(markers select _i) setMarkerPos getPosATL (everything select _i)", _i]; }; }; } else { toggleOn = false; { deleteMarker _x }forEach markers; }; }]; }; // For MP only. If SP comment out or delete this bracket Edited October 1, 2014 by Iceman77 Share this post Link to post Share on other sites
tryteyker 28 Posted October 1, 2014 The only thing wrong with JShock's code is that _this select 0 is the unit that the addaction is assigned to - use _this select 3 instead and you should be good to go. Share this post Link to post Share on other sites
iceman77 18 Posted October 1, 2014 (edited) It also doesn't track the units? What good is spawning and despawning markers for debugging if they don't track the objects you want to debug? I'm just saying. LOL. Cheers. Edited October 1, 2014 by Iceman77 Share this post Link to post Share on other sites
hellstorm77 2 Posted October 1, 2014 thank you Iceman77 Share this post Link to post Share on other sites
iceman77 18 Posted October 1, 2014 You're welcome. I just modified Dread's snippet. JShock's and Dread's snippets were both great, aside from the tracking. Share this post Link to post Share on other sites