This is a script that adds an "Open MV22 Ramp" and "Close MV22 Ramp" action to the pilot's menu, along with an animation for it.
*YOU WILL NEED TO UNBAN THE MV22 FROM YOUR SERVER BEFORE USE!*
Follow Duck's guide to adding banned material into DayZ
mv22_addAction.sqf
mv22_init.sqf
mv22_functions.sqf
*YOU WILL NEED TO UNBAN THE MV22 FROM YOUR SERVER BEFORE USE!*
Follow Duck's guide to adding banned material into DayZ


Installation
========================- Obtain a copy of your DayZ mission file (.pbo), located in \Arma 2\MPMissions(Chernarus is dayz_1.chernarus.pbo)
- Unpack your .pbo file using a program such as PBOView or cPBO
- Create a folder called "addons" (mind the lower case)
- Make three new files inside "addons"
mv22_addAction.sqf
mv22_init.sqf
mv22_functions.sqf - Copy and paste the code relative to each file (located at the end of this post)
- Go back into the folder with the mission.sqm, Description.ext, init.sqf
- Open init.sqf in a folder
- Add the following to the function of: if (!isDedicated) then...
Code:sleep 1; _mv22_ramp = [] execVM "addons\mv22_init.sqf";
- Pack the .pbo and upload it to your server
!Make sure your server is off when uploading an edited .pbo file, and KEEP BACKUPS - Test it out with an MV22 in your server OR in the Arma 2 Mission Editor.
Scripts
========================mv22_addAction.sqf
Code:
_array = _this select 3;
_param = _array select 0;
_code = _array select 1;
_spawn = _param spawn _code;
mv22_init.sqf
Code:
#include "mv22_functions.sqf"
{
_vcl = _this select 0; //set the vehicle to _vcl
_vcl setVariable ["mv22_ramp", 0, true]; //create a variable for the ramp
_openRamp = _x addaction ["Open MV22 Ramp","addons\mv22_addAction.sqf",[[],mv22_openramp],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""mv22_ramp""] != ""1"""]; //add action to open ramp, details to come
_closeRamp = _x addaction ["Close MV22 Ramp","addons\mv22_addAction.sqf",[[],mv22_closeramp],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""mv22_ramp""] == ""1"""]; //add action to close ramp
} foreach (nearestObjects [[3000,3000,0], ["MV22"], 50000]); //Get all MV22 vehicles in map
mv22_functions.sqf
Code:
mv22_openramp = //function to open ramp
{
_vcl = vehicle player; //assign the vehicle the pilot is in to _vcl
_vcl animate ["ramp_top",1]; //open the top part of the ramp
_vcl animate ["ramp_bottom",1]; //open the bottom part of the ramp
_vcl setVariable ["mv22_ramp", 1, true]; //set it open
WaitUntil {!Alive _veh || format ["%1",_veh getVariable "mv22_ramp"] != "1"}; //if mv22_ramp is 0 or it is destroyed, continue with the script
_veh setVariable ["mv22_ramp", 0,true]; //set mv22_ramp to 0, not needed, haven't tested if it's needed
};
mv22_closeramp = //function to close ramp
{
_vcl = vehicle player; //assign the vehicle the pilot is in to _vcl
_vcl animate ["ramp_top",0]; //close the top part of the ramp
_vcl animate ["ramp_bottom",0]; //close the bottom part of the ramp
_vcl setVariable ["mv22_ramp", 0,true]; //set it closed
};
Planned Features
========================- Add a script that will allow players to jump out of the back of the MV22 while it is moving, sort of like a paradrop.
- (?) Mounted weapon on the back, ramp opens to allow weapon to shoot?