Jump to content
Amar Amrullah

Check multiple units killed to spawn marker

Recommended Posts

Hi i would like to make a situation where once an HVT is killed, it will spawn a marker at its' position, but my problem is there is multiple HVT.

so im trying to simplify the code so i dont have to do it for each HVTs

 

Note: HVT is the variable name for the unit that i need the script to check. (HVT1,HVT2...HVT10)

 

In every HVT's Init:

//null = [ this ] execVM "HVTChecker.sqf";

 

In HVTChecker.sqf:

_HVTs = _this select 0;

if (!alive _HVTs) then {
    _marker = createMarker [format["%1_area",vehicleVarName _this], position _HVTs];
    _marker setMarkerShape "ELLIPSE";
    _marker setMarkerSize [10,10];
    _marker setMarkerColor "ColorOrange";
    sleep 300;
    deleteMarker _marker;
};

So it doesnt spawn any marker, but it is not showing any error either. I have been searching around but found no solution. Can anyone help me please.

 

Share this post


Link to post
Share on other sites

what is a HVT?

Seems to be a unit and seems that u r executing the script in units init line.

this would mean that ur code is executed once in mission start when the unit is probable alive...

maybe you need to use a killed event handler or something similar.

Share this post


Link to post
Share on other sites

Try waitUntil command.

 

_HVTs = _this select 0;

waitUntil {!alive _HVTs};
_marker = createMarker [format["%1_area",vehicleVarName _HVTs], position _HVTs]; // Don't forget to name all your HVTs
_marker setMarkerShape "ELLIPSE";
_marker setMarkerSize [10,10];
_marker setMarkerColor "ColorOrange";
sleep 300;
deleteMarker _marker;

 

  • Sad 1

Share this post


Link to post
Share on other sites
2 hours ago, Crazy_Man said:

Try waitUntil command.

 


_HVTs = _this select 0;

waitUntil {!alive _HVTs};
_marker = createMarker [format["%1_area",vehicleVarName _HVTs], position _HVTs]; // Don't forget to name all your HVTs
_marker setMarkerShape "ELLIPSE";
_marker setMarkerSize [10,10];
_marker setMarkerColor "ColorOrange";
sleep 300;
deleteMarker _marker;

Nice! It work like a charm. Thank you so much @Crazy_Man !

 

Share this post


Link to post
Share on other sites

 

3 hours ago, Amar Amrullah said:

but my problem is there is multiple HVT.

so im trying to simplify the code so i dont have to do it for each HVTs 

 

Use killed event handler?

  • Like 2

Share this post


Link to post
Share on other sites
20 hours ago, sarogahtyp said:

what is a HVT?

High Value Target. A important person that needs to be killed/captured/saved.

Though when one means to save the person, the designation VIP is usually used.

  • Thanks 1

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

×