Armored SUV Gun animations

McPimpin

Member
I am trying to take what Kind-Sir did with the MV22 Ramp animations and apply it to the Armored SUV.

Here is what I have:
suvpmc_addAction.sqf
Code:
_array = _this select 3;
_param = _array select 0;
_code  = _array select 1;
_spawn = _param spawn _code;

suvpmc_functions.sqf:
Code:
suvpmc_closecover = //function to close Cover
{
    _vcl = vehicle player; //assign the vehicle the pilot is in to _vcl
    _vcl animate ["HideGun_01",1]; //fold gun down
    _vcl animate ["HideGun_02",1]; //fold gun down
    _vcl animate ["HideGun_03",1]; //fold gun down
    _vcl animate ["HideGun_04",1]; //fold gun down
    _vcl animate ["CloseCover1",1]; //close cover1
    _vcl animate ["CloseCover2",1]; //close cover2
    _vcl setVariable ["suvpmc_cover", 1, true]; //set it closed
    WaitUntil {!Alive _veh || format ["%1",_veh getVariable "suvpmc_cover"] != "1"}; //if suvpmc_cover is 0 or it is destroyed, continue with the script
    _veh setVariable ["suvpmc_cover", 0,true]; //set suvpmc_cover to 0, not needed, haven't tested if it's needed
};
suvpmc_opencover = //function to open cover
{
    _vcl = vehicle player; //assign the vehicle the pilot is in to _vcl
    _vcl animate ["HideGun_01",0]; //fold gun down
    _vcl animate ["HideGun_02",0]; //fold gun down
    _vcl animate ["HideGun_03",0]; //fold gun down
    _vcl animate ["HideGun_04",0]; //fold gun down
    _vcl animate ["CloseCover1",0]; //close cover1
    _vcl animate ["CloseCover2",0]; //close cover2
    _vcl setVariable ["suvpmc_cover", 0,true]; //set it opened
};

suvpmc_init.sqf:
Code:
#include "suvpmc_functions.sqf"
{
    _vcl = _this select 0; //set the vehicle to _vcl
    _vcl setVariable ["suvpmc_cover", 0, true]; //create a variable for the cover
    _closeCover = _x addaction ["Close Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_closecover],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""suvpmc_cover""] != ""1"""]; //add action to close cover, details to come
    _openCover = _x addaction ["Open Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_opencover],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""suvpmc_cover""] == ""1"""]; //add action to open cover
} foreach (nearestObjects [[3000,3000,0], ["ArmoredSUV_PMC_DZ"], 50000]); //Get all Armored SUV vehicles in map

I grabbed the animation sequence from HERE

Does anyone see what i have done wrong?
I get the open and close cover only when in the drivers seat and not in the gunners seat.
What I would like to see happen is while in the gunners seat selecting the close cover would close the cover and put the gunner in the back seat position.
 
I changed:
Code:
_closeCover = _x addaction ["Close Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_closecover],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""suvpmc_cover""] != ""1"""]; //add action to close cover, details to come
    _openCover = _x addaction ["Open Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_opencover],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""suvpmc_cover""] == ""1"""]; //add action to open cover

To:
Code:
_closeCover = _x addaction ["Close Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_closecover],7,true,false,"","player == gunner _target && format [""%1"",_target getVariable ""suvpmc_cover""] != ""1"""]; //add action to close cover, details to come
    _openCover = _x addaction ["Open Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_opencover],7,true,false,"","player == gunner _target && format [""%1"",_target getVariable ""suvpmc_cover""] == ""1"""]; //add action to open cover

Works great except the gunner still sticks through the roof when its closed.
 
Not sure why you would bump this.....

But to the code, an idea would be that if its closed move the gunner to a ride in back seat.
Then if it's closed give ride in back the option to turn out.
 
You would use a moveInCargo to move the gunner to ride in back. Not sure how you can disable the gunner position while it is closed, but you can detect a unit there and force them to move seats.

Then it would be a matter of adding turn out to ride in back players.
 
You would just need to use something like this:
Code:
{_x moveInCargo chopper1} foreach units group this;

Maybe one of these days ill get a working Epoch script.
 
suvpmc_init.sqf:
Code:
#include "suvpmc_functions.sqf"
{
    _vcl = _this select 0; //set the vehicle to _vcl
    _vcl setVariable ["suvpmc_cover", 0, true]; //create a variable for the cover
    _closeCover = _x addaction ["Close Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_closecover],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""suvpmc_cover""] != ""1"""]; //add action to close cover, details to come
    _openCover = _x addaction ["Open Cover","addons\suvpmc_addAction.sqf",[[],suvpmc_opencover],7,true,false,"","player == driver _target && format [""%1"",_target getVariable ""suvpmc_cover""] == ""1"""]; //add action to open cover
} foreach (nearestObjects [[3000,3000,0], ["ArmoredSUV_PMC_DZ"], 50000]); //Get all Armored SUV vehicles in map
imo this is a bad way to add actions to vehicles ... it will only add the action to vehicles already on the map, new spawned/bought vehicles will not have the action untill you relog ... also this nearly crashes the client when you load into the server

you should rather add it in fn_selfactions.sqf instead
 
Back
Top