Jump to content
Sign in to follow this  
pognivet

How to attach a waypoint to a unit that is dead

Recommended Posts

I want to make it so when a certain unit is dead for a while that a search party is sent out to look for them.

 

To facilitate this I want to use addwaypoint on the search party, the location for the waypoint being the dead body.

 

You can't add waypoints to or do attachto on dead units. You can't getpos or setpos with them either. Is there any way around this? Maybe attaching a marker to them and making the addwaypoint destination the marker instead of the unit?

 

Please help.

 

Thanks.

Share this post


Link to post
Share on other sites

The trick is to track the living person until he's dead. The last known position is then the location of the body.

 

For instance I use this script to track groups on the map. When the group is empty (everyone is dead), the marker changes to a faded grey. With this I can see where they (the group leader) died.

 

For your purpose you would have to transform it a little bit. For instance have a invisible marker follow the unit until he dies and then make the marker visible and/or attach a waypoint to that position.

 

_group = _this select 0;
_type = _this select 1;
_label = _this select 2;
_countOn = _this select 3;

_marker = createMarker [_label, getPos (leader _group)];
_marker setMarkerShape "ICON";
_label setMarkerType _type;
_marker setMarkerText _label;


// Loop while group is alive
// -------------------------
while {{alive _x } count (units _group) > 0} do
{
	_marker setMarkerPos (getPos leader _group);
	if (_countOn) then {_marker setMarkerText format['%1 (%2)', _label, count units _group];};
	sleep 1;
};


// Change marker on exit script
// ----------------------------
if (count units _group > 0) then {
	_marker setMarkerColor "ColorBlack"; // destroyed vehicle
	_marker setMarkerAlpha .5;
} else {
	_marker setMarkerColor "ColorBlack"; // deleted vehicle
	_marker setMarkerAlpha 0;
};

 

Share this post


Link to post
Share on other sites

wouldnt it be more performant to add a killed eventhandler to soon-to-be-dead unit(s), that writes the position to some variable (or directly creates a marker object/position for the group ...). After all, who knows if OP wants just a specific mission unit or every unit in a certain gamemode to be tracked.

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  

×