Jump to content
Sign in to follow this  
hogmason

help with debug marker

Recommended Posts

Ok so i am trying to get a marker to follow a enemy jet i spawn via script so i can determine that it is doin what i whish it to do this is what i have done but it doesnt work any ideas.

on map i have a marker called debugjet

then the code

JetDeathLoopdeath ={	 		
		 sleep 5;
 		[] spawn JetMapPatrol;
	   };


JetMapPatrol ={ 

//hint "spawn a10";
	_grp = createGroup east;
		_a10 = createVehicle ["Su34", getmarkerpos "Enemy_Airport", [], 250, "FLY"]; 
		_a10 setDir 290;
   		_dir =  290;
		_speed = 500;
		_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
       	_a10 addEventHandler["killed", { (_this select 0) spawn JetDeath; }];

      		 //create pilot and move in plane
		_pilot = _grp createUnit ["RU_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"];
		_pilot moveInDriver _a10;
		_pilot = driver _a10;
		_pilot setskill 1;

		_wp1 = _grp addWaypoint [getPos eair1, 0];
		[_grp, 0] setWaypointType "SAD";
		[_grp, 0] setWaypointCompletionRadius 80;

		_wp2 = _grp addWaypoint [getPos eair2, 0];
		[_grp, 0] setWaypointType "SAD";
		[_grp, 0] setWaypointCompletionRadius 80;

		_wp3 = _grp addWaypoint [getPos eair3, 0];
		[_grp, 0] setWaypointType "SAD";
		[_grp, 0] setWaypointCompletionRadius 80;

		_wp4 = _grp addWaypoint [getPos eair4, 0];
		[_grp, 0] setWaypointType "CYCLE";
		[_grp, 0] setWaypointCompletionRadius 80;

};
/////////////////////////////////////////////////////////////////////////////////////////
if (isserver) then
{
[b]      _debug = true;[/b]
     //hint "spawning jets";
 [] spawn JetMapPatrol;	
    sleep 5;
[color="#FF0000"]////////=====> now the debug code <==////////////////////////////////////////////////////////////////////////[/color]
[b]	        if(_debug) then {    
	    hint "debug aircraft";
          [] spawn {
          while {not isnull _grp} do { "debugjet" setMarkerPos getpos _grp; sleep 0.5; };
      };
      };[/b]	   

};

Share this post


Link to post
Share on other sites

You cant getPos a group. Also you should use the new getPosASL or getPosATL they are much faster.

if (isserver) then
{
     _debug = true;
     //hint "spawning jets";
    [] spawn JetMapPatrol;    
    sleep 5;
////////=====> now the debug code <==////////////////////////////////////////////////////////////////////////
           if(_debug) then {    
           hint "debug aircraft";
          [] spawn {
          while {not isnull _grp} do { "debugjet" setMarkerPos getPosATL [color=#ff0000](leader _grp)[/color]; sleep 0.5; };
      };
      };       

};

Edited by Riouken

Share this post


Link to post
Share on other sites

this is all i can find for this particular script


Error in expression <ddWaypoint [getPos eair1, 0];
[_grp, 0] setWaypointType "SAD";
[_grp, 0] setWayp>
 Error position: <setWaypointType "SAD";
[_grp, 0] setWayp>
 Error Type Any, expected Group
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_v2_23.Chernarus\missions\setup\Task_Enemy\e_air.sqf, line 20
Error in expression < spawn JetMapPatrol;	
sleep 2;
if(debug == true) then {
{
hint "debug aircraft";>
 Error position: <== true) then {
{
hint "debug aircraft";>
 Error ==: Type Bool, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_v2_23.Chernarus\missions\setup\Task_Enemy\e_air.sqf, line 62


Share this post


Link to post
Share on other sites

Your waypoints are wrong too, you just keep setting the initial waypoint, not any of the other indexes.

		_wp1 = _grp addWaypoint [getPos eair1, 0];
		[_grp, 0] setWaypointType "SAD";
		[_grp, 0] setWaypointCompletionRadius 200;

		_wp2 = _grp addWaypoint [getPos eair2, [color="#FF0000"]1[/color]];
		[_grp, [color="#FF0000"]1[/color]] setWaypointType "SAD";
		[_grp, [color="#FF0000"]1[/color]] setWaypointCompletionRadius 200;

		_wp3 = _grp addWaypoint [getPos eair3, 2];
		[_grp, 2] setWaypointType "SAD";
		[_grp, 2] setWaypointCompletionRadius 200;

		_wp4 = _grp addWaypoint [getPos eair4, 3];
		_wp4 setWaypointType "CYCLE";
		_wp4 setWaypointCompletionRadius 200;

In the last example you'll see we just used the _wp4 instead of [_grp, 3] to set the waypoint. Also 80m is kinda small for an aircraft to complete a waypoint, so bumped it to 200. :)

Share this post


Link to post
Share on other sites
this is all i can find for this particular script

if(debug == true) then {
{
hint "debug aircraft";>
 Error position: <== true) then {
{
hint "debug aircraft";>
 Error ==: Type Bool, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_v2_23.Chernarus\missions\setup\Task_Enemy\e_air.sqf, line 62


That code is different from what you posted above.

Share this post


Link to post
Share on other sites
That code is different from what you posted above.

Yes it is. In the error he just posted your checking a bool var against a bool statement. You can't do that.

Debug is true or false, the if statement is the check.

In simpler terms you can't use:

== with a bool var type.

If (debug) then {  \\ checks if debug is true

If (!(debug)) then { \\ checks if debug is false

Share this post


Link to post
Share on other sites

sorry guys u are correct that was a earlier version of that code i forgot to delete my rpt file and start a new one the new one is

Error in expression <r _a10;
_pilot setskill 1;

_wp1 = _grp addWaypoint [getPos eair1, 0];
[_grp, 0]>
 Error position: <addWaypoint [getPos eair1, 0];
[_grp, 0]>
 Error 0 elements provided, 3 expected
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_v2_23.Chernarus\missions\setup\Task_Enemy\e_air.sqf, line 32
Error in expression < = this; this setVehicleVarName ""%1""",_unitname];
processInitCommands;			
slee>

that is the only error that refers to e_air.sqf

would any 1 have a working bit of code to create a marker to follow the enemy plane for debug

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

the actuall code i am trying now is

if (isserver) then
{
     _debug = true;
////////=====> now the debug code <==////////////////////////////////////////////////////////////////////////
           if(_debug) then {    
           hint "debug aircraft";
          [] spawn {
          while {not isnull _grp} do { "debugjet" setMarkerPos getPosATL (leader _grp); sleep 0.5; };
      };
      };           
};

---------- Post added at 22:24 ---------- Previous post was at 22:17 ----------

Your waypoints are wrong too, you just keep setting the initial waypoint, not any of the other indexes.

		_wp1 = _grp addWaypoint [getPos eair1, 0];
		[_grp, 0] setWaypointType "SAD";
		[_grp, 0] setWaypointCompletionRadius 200;

		_wp2 = _grp addWaypoint [getPos eair2, [color="#FF0000"]1[/color]];
		[_grp, [color="#FF0000"]1[/color]] setWaypointType "SAD";
		[_grp, [color="#FF0000"]1[/color]] setWaypointCompletionRadius 200;

		_wp3 = _grp addWaypoint [getPos eair3, 2];
		[_grp, 2] setWaypointType "SAD";
		[_grp, 2] setWaypointCompletionRadius 200;

		_wp4 = _grp addWaypoint [getPos eair4, 3];
		_wp4 setWaypointType "CYCLE";
		_wp4 setWaypointCompletionRadius 200;

In the last example you'll see we just used the _wp4 instead of [_grp, 3] to set the waypoint. Also 80m is kinda small for an aircraft to complete a waypoint, so bumped it to 200. :)

Thanks mate appreciate that :D

Share this post


Link to post
Share on other sites

Please post e_air.sqf, but the problem is on or around line 32 of that script. It appears to be something wrong with your string statement. We wont know till we can take a look.

Share this post


Link to post
Share on other sites

this is the full code thanks for your help.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////                                                           ////////////////////////////////////
///////////////////////  Air Patrol Script For Operation HOG BY =Mason=           /////////////////////////////////////
//////////////////////                                                           //////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

JetDeathLoop ={	 		
		 sleep 5;
 		[] spawn JetMapPatrol;
	   };


JetMapPatrol ={ 

//hint "spawn a10";
	_grp = createGroup east;
		_a10 = createVehicle ["Su34", getmarkerpos "Enemy_Airport", [], 250, "FLY"]; 
		_a10 setDir 290;
   		_dir =  290;
		_speed = 500;
		_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
       	_a10 addEventHandler["killed", { (_this select 0) spawn JetDeathLoop; }];

      		 //create pilot and move in plane
		_pilot = _grp createUnit ["RU_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"];
		_pilot moveInDriver _a10;
		_pilot = driver _a10;
		_pilot setskill 1;

		_wp1 = _grp addWaypoint [getPos eair1, 0];
		[_grp, 0] setWaypointType "SAD";
		[_grp, 0] setWaypointCompletionRadius 200;

		_wp2 = _grp addWaypoint [getPos eair2, 1];
		[_grp, 1] setWaypointType "SAD";
		[_grp, 1] setWaypointCompletionRadius 200;

		_wp3 = _grp addWaypoint [getPos eair3, 2];
		[_grp, 2] setWaypointType "SAD";
		[_grp, 2] setWaypointCompletionRadius 200;

		_wp4 = _grp addWaypoint [getPos eair4, 3];
		_wp4 setWaypointType "CYCLE";
		_wp4 setWaypointCompletionRadius 200;

};
/////////////////////////////////////////////////////////////////////////////////////////
if (isserver) then
{
     _debug = true;
     //hint "spawning jets";
    [] spawn JetMapPatrol;    
    sleep 5;
////////=====> now the debug code <==////////////////////////////////////////////////////////////////////////
           if(_debug) then {    
           hint "debug aircraft";
          [] spawn {
          while {not isnull _grp} do { "debugjet" setMarkerPos getPosATL (leader _grp); sleep 0.5; };
      };
      };           
};



Share this post


Link to post
Share on other sites

When using spawn, you spawn a new thread in a different scope. For example:

_a10 = objNull;
[] spawn 
{
    hint format ["%1",isNil "_a10"];
};

Notice that _a10 doesn't exist in the spawn. You have to pass the parameters you want to use into the new thread.

_a10 = objNull;
[_a10] spawn 
{
    _a10 = _this select 0;
    hint format ["%1",isNil "_a10"];
};

Share this post


Link to post
Share on other sites

righto so i got the marker moiving to the jets position on mission load but it doesnt follow the jet this is what ive done

           if(_debug) then {    
           hint "debug aircraft";
          "debugjet" setMarkerPos getPosATL (leader _grp);
	   sleep 0.5;
      }; 

now the full code

JetDeathLoop ={	 		
		 sleep 5;
 		[] spawn JetMapPatrol;
	   };


JetMapPatrol ={ 

//hint "spawn a10";
       [b][color="#FF0000"]_debug = true;[/color][/b]
	_grp = createGroup east;
		_a10 = createVehicle ["Su34", getmarkerpos "Enemy_Airport", [], 250, "FLY"]; 
		_a10 setDir 290;
   		_dir =  290;
		_speed = 500;
		_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
       	_a10 addEventHandler["killed", { (_this select 0) spawn JetDeathLoop; }];

      		 //create pilot and move in plane
		_pilot = _grp createUnit ["RU_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"];
		_pilot moveInDriver _a10;
		_pilot = driver _a10;
		_pilot setskill 1;

		_wp1 = _grp addWaypoint [getPos eair1, 0];
		[_grp, 0] setWaypointType "SAD";
		[_grp, 0] setWaypointCompletionRadius 200;

		_wp2 = _grp addWaypoint [getPos eair2, 1];
		[_grp, 1] setWaypointType "SAD";
		[_grp, 1] setWaypointCompletionRadius 200;

		_wp3 = _grp addWaypoint [getPos eair3, 2];
		[_grp, 2] setWaypointType "SAD";
		[_grp, 2] setWaypointCompletionRadius 200;

		_wp4 = _grp addWaypoint [getPos eair4, 3];
		_wp4 setWaypointType "CYCLE";
		_wp4 setWaypointCompletionRadius 200;  
[b][color="#FF0000"]			
		////////=====> now the debug code <==////////////////////////////////////////////////////////////////////////
           if(_debug) then {    
           hint "debug aircraft";
          "debugjet" setMarkerPos getPosATL (leader _grp);
	   sleep 0.5;
      };[/color] [/b]  

};
/////////////////////////////////////////////////////////////////////////////////////////
private ["_debug","_grp","_a10","_dir","_speed","_pilot","_wp1","_wp2","_wp3","_wp4","_debum"];

if (isserver) then
{
    // _debug = true;
     //hint "spawning jets";
    [] spawn JetMapPatrol;    
    sleep 5;    

};

any ideas

Share this post


Link to post
Share on other sites

I didn't test it but it should be close. But you really need to rethink all those spawns. You should pre-compile most of this and just call it. But you really shouldn't worry about that now, you need to take a look at how other scripts are structured and executed. You really need to understand the logic behind making scripting/programming work...

http://community.bistudio.com/wiki/Control_Structures

I would suggest you read through that and play around with simple examples of each one.

JetMapPatrol ={ 




//hint "spawn a10";
       _debug = true;
       _grp = createGroup east;
           _a10 = createVehicle ["Su34", getmarkerpos "Enemy_Airport", [], 250, "FLY"]; 
           _a10 setDir 290;
              _dir =  290;
           _speed = 500;
           _a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
           _a10 addEventHandler["killed", { (_this select 0) spawn JetDeathLoop; }];

               //create pilot and move in plane
           _pilot = _grp createUnit ["RU_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"];
           _pilot moveInDriver _a10;
           _pilot = driver _a10;
           _pilot setskill 1;

           _wp1 = _grp addWaypoint [getPos eair1, 0];
           [_grp, 0] setWaypointType "SAD";
           [_grp, 0] setWaypointCompletionRadius 200;

           _wp2 = _grp addWaypoint [getPos eair2, 1];
           [_grp, 1] setWaypointType "SAD";
           [_grp, 1] setWaypointCompletionRadius 200;

           _wp3 = _grp addWaypoint [getPos eair3, 2];
           [_grp, 2] setWaypointType "SAD";
           [_grp, 2] setWaypointCompletionRadius 200;

           _wp4 = _grp addWaypoint [getPos eair4, 3];
           _wp4 setWaypointType "CYCLE";
           _wp4 setWaypointCompletionRadius 200;  

[color=#ff0000]            ////////=====> now the debug code <==////////////////////////////////////////////////////////////////////////[/color]
[color=#ff0000]            if(_debug) then { [/color]
[color=#ff0000]                hint "debug aircraft";                [/color]
[color=#ff0000]                markerfollow = {[/color]
[color=#ff0000]                    _plane = _this select 0; [/color]
[color=#ff0000]                    while {alive _plane} do [/color]
[color=#ff0000]                    {[/color]
[color=#ff0000]                        "debugjet" setMarkerPos getPosATL _plane;[/color]
[color=#ff0000]                        sleep .5;[/color]
[color=#ff0000]                    };[/color]
[color=#ff0000]                };[/color]
[color=#ff0000]
[/color]
[color=#ff0000]                _handle = [_a10] spawn markerfollow;[/color]
[color=#ff0000]       };   [/color]

};

Share this post


Link to post
Share on other sites

Thanks very much mate that works perfect ill definantly read that link your a champ

Share this post


Link to post
Share on other sites

ok so i got the debug marker going now i am creating the same marker for 10 vehicles

im using this it works fine in editor test but not on dedi

                   _target1m = _this select 0; 

	    [sgt,nil,rgroupChat,"Creating supply Dump Debug Markers."] call RE;

                   _target1marker = createMarker[str(_target1m),position _target1m]; str(_target1m) setMarkerType "mil_dot"; str(_target1m) setMarkerColor "ColorOrange"; str(_target1m) setMarkerText "supply Dump";



this marker doesnt move i dont need it to move.

now i tried the _x instead of _target1m but it doesnt seem to work. i.e

_target1marker = createMarker[str(_x),position _x]; str(_x) setMarkerType "mil_dot"; str(_x) setMarkerColor "ColorOrange"; str(_x) setMarkerText "supply Dump";

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  

×