Jump to content
mlamp89

Rescuing a downed support pilot and time change

Recommended Posts

I have a MP mission I've been creating that my friend and I play. I have supports one of which is transport via helos. I'd like to add in an optional mission that populates if an AI gets shot down. I have seen it in other missions I play. Basically, the crew is shot down, you're assigned to rescue, and when a player gets close, the downed crew(if alive) is added to your squad. How do I do that?

 

Also, is there a simple way to have a choice in game to change the time? We've played terrorist hunt scenarios where we go up to a briefing board and click change time. We'd just like to be able to switch from day to night. So we can do one task during the day and maybe RTB and switch to night for the next. 

 

Thanks,

Matt

Share this post


Link to post
Share on other sites

This should get you going. Review and try it. The pilot/survior will have a add action to join the group. 

 

time: 

https://community.bistudio.com/wiki/setDate

https://community.bistudio.com/wiki/skipTime

https://community.bistudio.com/wiki/Arma_3_Mission_Parameters

 

 

basic example: Place the markers for testing ("casualty","casualty_1","casualty_2","casualty_3","casualty_4")

private ["_sur","_mkr","_marker","_Pos"]; //variables


//Markers placed on the map. Can be as many as you want. 
_mkr = ["casualty","casualty_1","casualty_2","casualty_3","casualty_4"] call BIS_fnc_selectRandom; //select a random spot
_Pos = getMarkerPos _mkr; //position to spawn the casualty

//create the unit unassign the group
_sur =  (creategroup west) createUnit ["b_g_survivor_F", _Pos, [], 0, "NONE"];
[_sur] join grpNull;
_sur setBehaviour "COMBAT";
_sur setCaptive true; //so he doesn't get killed waiting for pickup. 

// create a action for survivor to join group, give him a gun, and set the captive back to false.
[[_sur,[("<t color=""#FF0000"">" + ("Join Group") + "</t>"),{ [_this select 0] join (group player); (_this select 0) removeAction (_this select 2);(_this select 0)addMagazine "30Rnd_9x21_Mag";(_this select 0)addWeapon "hgun_Rook40_F";(_this select 0) setCaptive false;},[_sur],0,false,true, "",'alive _target']],"addAction",true,true,false] call BIS_fnc_MP;

//create marker at least for testing
_marker = createMarker ["survivor", _Pos ];
_marker  setMarkerShape "ICON";
_marker setMarkerSize [1,1];
_marker setMarkertype "hd_dot";
_marker setMarkerText "Survivor location";
_marker setMarkerColor "ColorRED";


//do something, some condition, waituntil...?
//deleteMarker "survivor";

 

 

task example:  Place the markers for testing ("hostage","hostage1","hostage2","hostage3"). You can make more random after you understand the script. 

/**************************************************************************
downed pilot
thedubl 6-26-2016

null=[] execVM "scripts\tasks\hostage\hostage.sqf";
*********************************************************************/
private ["_h1","_mrkr","_hostage","_mkpos","_marker","_pos","_smoke","_veh"]; //variables

if (!isServer) exitWith {};
_mrkr = ["hostage","hostage1","hostage2","hostage3"]call BIS_fnc_selectRandom;
_hostage = getmarkerpos _mrkr;

hint format ["hostage pos %1",_hostage];

/****************************************************************
function to delete smoke
****************************************************************/
fnc_deleteObj = {
	_this addMPEventHandler ["MPKilled", {
		_this = _this select 0;
		{
			deleteVehicle _x;
		} forEach (_this getVariable ["effects", []]);
		if (isServer) then {
			deleteVehicle _this;
		};
	}];
	_this setDamage 1; 
};

//round(random 50) -25
//_pos = [(_hostage select 0) + 25, (_hostage select 1)  + 50, 0];
_pos = [(_hostage select 0) + round(random 50)-25, (_hostage select 1)  + round(random 100)-50, 0];

//Crash site
_veh = createVehicle ["Land_UWreck_MV22_F",_pos, [], 0, "NONE"]; 
_smoke = "test_EmptyObjectForSmoke" createVehicle position _veh; _smoke attachTo[_veh,[0,1.5,-1]]; 
_veh setVehicleVarName "crashedPlane"; crashedPlane = _veh;



//create the unit unassign the group
_h1 =  (creategroup west) createUnit ["b_g_survivor_F", _hostage, [], 0, "NONE"];//check pos
[_h1] join grpNull;
_h1 setBehaviour "COMBAT";
_h1 setCaptive true;

//addaction to join group
[[_h1,[("<t color=""#FF0000"">" + ("Join Group") + "</t>"),{ [_this select 0] join (group player); (_this select 0) removeAction (_this select 2);(_this select 0)addMagazine "30Rnd_9x21_Mag";(_this select 0)addWeapon "hgun_Rook40_F";(_this select 0) setCaptive false;},[_h1],0,false,true, "",'alive _target']],"addAction",true,true,false] call BIS_fnc_MP;

//create a task
[west, "Rescue", ["Rescue Mission","Rescue the pilot before the the enemy finds him first and takes him hostage.",""], [], true] call BIS_fnc_taskCreate;
["Rescue", "CREATED",true] call BIS_fnc_taskSetState;

sleep .5;
//create marker
_marker = createMarker ["hos", _pos ];
_marker  setMarkerShape "ICON";
_marker setMarkerSize [1,1];
_marker setMarkertype "hd_dot";
_marker setMarkerText "Transponder Signal";
_marker setMarkerColor "ColorRED";


//wait until _h1 is near the flag or dead.
waitUntil {sleep 2; (_h1 distance NatoFlag <= 20) || (!alive _h1)}; //marker at base

if(!(alive _h1)) then {
		["Rescue", "FAILED",true] spawn BIS_fnc_taskSetState;
		
	}else{
		["Rescue", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
       
                sleep 20;
		deleteVehicle _h1;

	};

//cleanup the markers, crash site, and smoke

deleteMarker "hos";
sleep 60;

deleteVehicle CrashedPlane;
_smoke spawn {
sleep 1;
_this call fnc_deleteObj;

};


["Rescue", west] call BIS_fnc_deleteTask;

 

Share this post


Link to post
Share on other sites
On 4/9/2018 at 8:08 PM, thedubl said:

This should get you going. Review and try it. The pilot/survior will have a add action to join the group. 

 

time: 

https://community.bistudio.com/wiki/setDate

https://community.bistudio.com/wiki/skipTime

https://community.bistudio.com/wiki/Arma_3_Mission_Parameters

 

 

basic example: Place the markers for testing ("casualty","casualty_1","casualty_2","casualty_3","casualty_4")


private ["_sur","_mkr","_marker","_Pos"]; //variables


//Markers placed on the map. Can be as many as you want. 
_mkr = ["casualty","casualty_1","casualty_2","casualty_3","casualty_4"] call BIS_fnc_selectRandom; //select a random spot
_Pos = getMarkerPos _mkr; //position to spawn the casualty

//create the unit unassign the group
_sur =  (creategroup west) createUnit ["b_g_survivor_F", _Pos, [], 0, "NONE"];
[_sur] join grpNull;
_sur setBehaviour "COMBAT";
_sur setCaptive true; //so he doesn't get killed waiting for pickup. 

// create a action for survivor to join group, give him a gun, and set the captive back to false.
[[_sur,[("<t color=""#FF0000"">" + ("Join Group") + "</t>"),{ [_this select 0] join (group player); (_this select 0) removeAction (_this select 2);(_this select 0)addMagazine "30Rnd_9x21_Mag";(_this select 0)addWeapon "hgun_Rook40_F";(_this select 0) setCaptive false;},[_sur],0,false,true, "",'alive _target']],"addAction",true,true,false] call BIS_fnc_MP;

//create marker at least for testing
_marker = createMarker ["survivor", _Pos ];
_marker  setMarkerShape "ICON";
_marker setMarkerSize [1,1];
_marker setMarkertype "hd_dot";
_marker setMarkerText "Survivor location";
_marker setMarkerColor "ColorRED";


//do something, some condition, waituntil...?
//deleteMarker "survivor";

 

 

task example:  Place the markers for testing ("hostage","hostage1","hostage2","hostage3"). You can make more random after you understand the script. 


/**************************************************************************
downed pilot
thedubl 6-26-2016

null=[] execVM "scripts\tasks\hostage\hostage.sqf";
*********************************************************************/
private ["_h1","_mrkr","_hostage","_mkpos","_marker","_pos","_smoke","_veh"]; //variables

if (!isServer) exitWith {};
_mrkr = ["hostage","hostage1","hostage2","hostage3"]call BIS_fnc_selectRandom;
_hostage = getmarkerpos _mrkr;

hint format ["hostage pos %1",_hostage];

/****************************************************************
function to delete smoke
****************************************************************/
fnc_deleteObj = {
	_this addMPEventHandler ["MPKilled", {
		_this = _this select 0;
		{
			deleteVehicle _x;
		} forEach (_this getVariable ["effects", []]);
		if (isServer) then {
			deleteVehicle _this;
		};
	}];
	_this setDamage 1; 
};

//round(random 50) -25
//_pos = [(_hostage select 0) + 25, (_hostage select 1)  + 50, 0];
_pos = [(_hostage select 0) + round(random 50)-25, (_hostage select 1)  + round(random 100)-50, 0];

//Crash site
_veh = createVehicle ["Land_UWreck_MV22_F",_pos, [], 0, "NONE"]; 
_smoke = "test_EmptyObjectForSmoke" createVehicle position _veh; _smoke attachTo[_veh,[0,1.5,-1]]; 
_veh setVehicleVarName "crashedPlane"; crashedPlane = _veh;



//create the unit unassign the group
_h1 =  (creategroup west) createUnit ["b_g_survivor_F", _hostage, [], 0, "NONE"];//check pos
[_h1] join grpNull;
_h1 setBehaviour "COMBAT";
_h1 setCaptive true;

//addaction to join group
[[_h1,[("<t color=""#FF0000"">" + ("Join Group") + "</t>"),{ [_this select 0] join (group player); (_this select 0) removeAction (_this select 2);(_this select 0)addMagazine "30Rnd_9x21_Mag";(_this select 0)addWeapon "hgun_Rook40_F";(_this select 0) setCaptive false;},[_h1],0,false,true, "",'alive _target']],"addAction",true,true,false] call BIS_fnc_MP;

//create a task
[west, "Rescue", ["Rescue Mission","Rescue the pilot before the the enemy finds him first and takes him hostage.",""], [], true] call BIS_fnc_taskCreate;
["Rescue", "CREATED",true] call BIS_fnc_taskSetState;

sleep .5;
//create marker
_marker = createMarker ["hos", _pos ];
_marker  setMarkerShape "ICON";
_marker setMarkerSize [1,1];
_marker setMarkertype "hd_dot";
_marker setMarkerText "Transponder Signal";
_marker setMarkerColor "ColorRED";


//wait until _h1 is near the flag or dead.
waitUntil {sleep 2; (_h1 distance NatoFlag <= 20) || (!alive _h1)}; //marker at base

if(!(alive _h1)) then {
		["Rescue", "FAILED",true] spawn BIS_fnc_taskSetState;
		
	}else{
		["Rescue", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
       
                sleep 20;
		deleteVehicle _h1;

	};

//cleanup the markers, crash site, and smoke

deleteMarker "hos";
sleep 60;

deleteVehicle CrashedPlane;
_smoke spawn {
sleep 1;
_this call fnc_deleteObj;

};


["Rescue", west] call BIS_fnc_deleteTask;

 

Holy crap.... that looks so far beyond my comprehension of the editor. I was hoping I could just type something into the init fields or something. 

Share this post


Link to post
Share on other sites

I can make an simple mission example which you can copy paste. Give me a day or so.

Share this post


Link to post
Share on other sites
On 4/9/2018 at 8:14 AM, mlamp89 said:

Also, is there a simple way to have a choice in game to change the time? We've played terrorist hunt scenarios where we go up to a briefing board and click change time. We'd just like to be able to switch from day to night. So we can do one task during the day and maybe RTB and switch to night for the next. 

 

One option is to put this in the Init of any object placed. (burning campfire, briefing board, etc.)

this addAction ["Rest for 1 hour","skiptime 1"]; this addAction ["Rest for 3 hours","skiptime 3"]; this addAction ["Rest for 6 hours","skiptime 6"];

Then look at the object, scroll mouse wheel and select the hours to skip.

Share this post


Link to post
Share on other sites
On 4/12/2018 at 6:59 AM, major-stiffy said:

 

One option is to put this in the Init of any object placed. (burning campfire, briefing board, etc.)


this addAction ["Rest for 1 hour","skiptime 1"]; this addAction ["Rest for 3 hours","skiptime 3"]; this addAction ["Rest for 6 hours","skiptime 6"];

Then look at the object, scroll mouse wheel and select the hours to skip.

I like that idea. I added the skiptime via the radio. But I like the rest idea. 

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

×