Jump to content
_Winters_

Dynamic distance / direction indicator for Pilot?

Recommended Posts

I am attempting to create a single player scenario similar to several helicopter training scenarios I have seen, full disclosure, this is the first scenario I have attempted.  I realize this is kind of diving in head first.  I do have extensive computer programming experience and have modded other games in the past, but attempting to get a grasp on the whole structure and variety of commands has me feeling pretty far out of my depth.

 

I want to have the target indicated on the map, and also onscreen with a distance to the objective. I am not sure if I am missing something simple, but I can't seem to figure out what this functionality would be called, so even searching for it has been difficult.

 

So far I have tried setting a waypoint, creating and assigning a task , and using drawicon3d to draw text at the location. None of these really functioned as desired.

 

I used the following in my init.sqf for the waypoint, I have my player_character named helo_pilot

 

way1 = (group helo_pilot) addWaypoint [[7283.0,7917.0,167.6], 0];
way1 setWaypointType "MOVE";
way1 setWaypointBehaviour "aware";
way1 setWaypointCombatMode "yellow";
way1 setWaypointDescription "Helicopter Training.";
way1 setWaypointSpeed "FULL";
way1 setWaypointCompletionRadius 100;

 

The result is the waypoint shows up on the map, but nothing shows up on screen in game - i'm not sure if this is due to my  missing something or not.

 

For the task I tried.. 

 

_currentTask = player createSimpleTask ["La Trinte"];
 _currentTask setSimpleTaskDestination ([7283.0,7917.0,167.6]);
 _currentTask setTaskState "ASSIGNED";
 

The task shows the task as assigned and at the correct location, but doesn't show on screen when in game.

 

And finally for drawicon3d I tried ..

 

addMissionEventHandler ["Draw3D", {
    drawIcon3D ["", [1,1,0,1], [7283.0,7917.0,167.6], 0, 0, 0, "Objective", 1, 0.05, "PuristaMedium"];
}];

 

It does show my text in game, but it is static at the position, whereas the direction / distance thing i'm looking to have follows the edge of the screen like the koth zone marker does.

 

Anyhow, I was really hoping someone could point me in the right direction since I haven't been able to find this on my own and i'm beginning to question my sanity at this point. :dontgetit:

Share this post


Link to post
Share on other sites

Waypoint visibility depends on difficulty setting (and maybe other factors).

Something like this maybe? Will always stay visible, when not inside the field of view it will move along the edges:

addMissionEventHandler ["Draw3d",{

	_pos = getposatl targetVeh;
	_pos = _pos vectorAdd [0,0,3];

		drawIcon3D [

		"",
		[1, 1, 1, 1],
		_pos,
		1,
		1,
		0,
		format ["Target: %1m",round (player distance targetVeh)],
		2,
		0.03,
		"PuristaBold",
		"center",
		true
		];

}];

Place an object and name it targetVeh, then run the snippet.

 

Cheers

Share this post


Link to post
Share on other sites

You can also define tasks so the task icon stays visible when playing, and includes distance to the task position:

[player,"tMoveToHeistOP",["Move to observation post","Move to OP",""],markerPos "mrkHeistOP",1,3,true,"move"] call BIS_fnc_taskCreate;

See the wiki for this function: https://community.bistudio.com/wiki/BIS_fnc_taskCreate

 

The Task Destination parameter can be a position or an object.  That is where the icon will show and guide player to.  In my example above the Task Destination is a position for a marker:   markerPos "mrkHeistOP"

Share this post


Link to post
Share on other sites

Thanks so much to both of you for the help, I tried both methods.

 

I ended up with the following .. 

 

addMissionEventHandler ["Draw3D", {

     _pos = [7283.0,7917.0,167.6];    
     _distance_meters = round (player distance _pos);
     _distance_kilometers = floor (_distance_meters / 1000);
     _distance_meters_left = _distance_meters - (_distance_kilometers * 1000);
     _distance_hectometers = round (_distance_meters_left / 100);

     drawIcon3D ["", [1,1,0,1], _pos, 1, 1, 0, format ["%1.%2km",_distance_kilometers,_distance_hectometers], 2, 0.03, "PuristaMedium","center",true];
}];

 

I didn't need to to target an object so I used a static position - at some point this will be pulled from a list of locations, but for now one location worked fine for testing.

 

I got the task working but couldn't get it to show up on screen, just the map. The first method is more in line with what I needed anyhow since this is a general marker for where to fly to and I will have a area trigger there that creates a task.

 

So now that I have that working - any idea if its possible to use the game asset for the default task as the icon?

 

 

Share this post


Link to post
Share on other sites

Replace the first empty string inside the drawIcon3D command with

"\A3\ui_f\data\map\mapcontrol\taskIcon_ca.paa"

Cheers

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

×