Jump to content
Sign in to follow this  
hellstorm77

Debug help

Recommended Posts

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

_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 by JShock

Share this post


Link to post
Share on other sites

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

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 by DreadedEntity

Share this post


Link to post
Share on other sites
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
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

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 by Iceman77

Share this post


Link to post
Share on other sites

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

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 by Iceman77

Share this post


Link to post
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×