Jump to content
Sign in to follow this  
hogmason

debug marker not updating using while command

Recommended Posts

gday all i am using the below code to follow spawned units but it is not updating there positions

     _HOGdebugunits = _this select 0; 
    _HOGdebugTEXT = _this select 1;

    while {alive _HOGdebugunits} do {				                   
        _DEBUGmarker = createMarker[str(_HOGdebugunits),position _HOGdebugunits]; str(_HOGdebugunits) setMarkerType "mil_dot"; str(_HOGdebugunits) setMarkerColor "ColorRed"; str(_HOGdebugunits)setMarkerText _HOGdebugTEXT;
	    sleep 1;
    };

any 1 know why thanks

Share this post


Link to post
Share on other sites

Hi mate.... first off... that code is creating 1 marker every 1 second.... and not moving them anywhere! They are piling up one on top of the other. Looks like one marker but you are creating hundreds.

Then what is _HOGdebugunits?.... because you can only use alive on an object not a group.

EDIT: You can also only use position on an object. Might pay to look the commands up when things aren't working mate.

Edited by twirly

Share this post


Link to post
Share on other sites

Yeah thanks mate.

i got it working by adding a few more commands but now i am stuck creating a few markers as this 1 piece of code is being called from multiple scripts so i need it to create a new mkr every time its called

this is my code thats now working

_HOGdebugUNITS = _this select 0;
_HOGdebugTEXT = _this select 1;
_HOGdebugCOLOUR = _this select 2;
_HOGdebugTYPE = _this select 3;

if (HOG_debug) then {

       _DEBUGmarker = createMarker ["dbgmkr",getPos _HOGdebugUNITS];
	_DEBUGmarker setMarkerType _HOGdebugTYPE;
	_DEBUGmarker setMarkerColor _HOGdebugCOLOUR;
	_DEBUGmarker setMarkerText _HOGdebugTEXT;
	_DEBUGmarker setMarkerDir (direction _HOGdebugUNITS);

    while {alive _HOGdebugUNITS} do 
	{
	 _DEBUGmarker setMarkerPos getPosATL _HOGdebugUNITS;
	 _DEBUGmarker setMarkerDir (direction _HOGdebugUNITS);
           sleep 0.5;
    };

};

this is how its called

_handle = [_Su34,"jet","ColorRed","mil_triangle"] spawn HOGdebugmkrs;

//explained
_handle = [the unit,"txt","Color","type"] spawn HOGdebugmkrs;


i tried this so it gives the marker a new name every time but it does funny things like change color every secound and stuff also i am not to clear what _x does i googled and looked but cant really find a decent explanation

_DEBUGmarker = createMarker [str(_x),getPos _HOGdebugUNITS];

---------- Post added at 14:17 ---------- Previous post was at 14:11 ----------

got it all going

_HOGdebugUNITS = _this select 0; 
_HOGdebugTEXT = _this select 1;
_HOGdebugCOLOUR = _this select 2;
_HOGdebugTYPE = _this select 3;
[color="#FF0000"]_mkrName = Format ["mkr_%1",_HOGdebugUNITS];[/color]

if (HOG_debug) then {

       _DEBUGmarker = createMarker [_mkrName,getPos _HOGdebugUNITS];
	_DEBUGmarker setMarkerType _HOGdebugTYPE;
	_DEBUGmarker setMarkerColor _HOGdebugCOLOUR;
	_DEBUGmarker setMarkerText _HOGdebugTEXT;
	_DEBUGmarker setMarkerDir (direction _HOGdebugUNITS);

    while {alive _HOGdebugUNITS} do 
	{
	 _DEBUGmarker setMarkerPos getPosATL _HOGdebugUNITS;
	 _DEBUGmarker setMarkerDir (direction _HOGdebugUNITS);
        sleep 0.5;
    };

};


Share this post


Link to post
Share on other sites

Try something like these for unique names...

_DEBUGmarker = createMarker [format [%1",diag_ticktime],getPos _HOGdebugUNITS];
//or
_DEBUGmarker = createMarker [format ["%1",_HOGdebugUNITS],getPos _HOGdebugUNITS];
//or
_DEBUGmarker = createMarker [format ["%1",random(999999)],getPos _HOGdebugUNITS];

Thing is when the time comes if you want to delete the marker from another script...you won't know the name to use.

Edited by twirly
Clarity

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  

×