Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class cScripts {
class vehicle_getPylon {};

// Other
class vehicle_reset {};
class vehicle_addFlagAction {};
};
class modules {
Expand Down
6 changes: 3 additions & 3 deletions cScripts/functions/mission/fn_addGetOutHelo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ if (_useColor) then {
_rightSide = "<t color='#0000ff'>Get out Right Side</t>";
};

_vehicle addAction [
private _actionIDL = _vehicle addAction [
_leftSide,
{[_this select 0, true] call FUNC(doGetOutHeloSide)},
0, 1.5, true, true, "User12",
"(_target getCargoIndex _this) != -1"
];

_vehicle addAction [
private _actionIDR = _vehicle addAction [
_rightSide,
{[_this select 0, false] call FUNC(doGetOutHeloSide)},
0, 1.5, true, true, "User13",
"(_target getCargoIndex _this) != -1"
];

_vehicle setVariable [QEGVAR(Vehicle,doGetOutHeloSide),"true"];
_vehicle setVariable [QEGVAR(Vehicle,GetOutRightLeft), [_vehicle, [_actionIDL, _actionIDR]], true];
4 changes: 2 additions & 2 deletions cScripts/functions/mission/fn_addHaloJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (!isNil {_vehicle getVariable QEGVAR(Vehicle,Halo)}) exitWith {[format["Aircr
private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) && ((_target animationPhase 'ramp_bottom' > 0.64) or (_target animationPhase 'door_2_1' == 1) or (_target animationPhase 'door_2_2' == 1) or (_target animationPhase 'jumpdoor_1' == 1) or (_target animationPhase 'jumpdoor_2' == 1) or (_target animationPhase 'back_ramp_switch' == 1) or (_target animationPhase 'back_ramp_half_switch' == 1) or (_target doorPhase 'RearDoors' > 0.5) or (_target doorPhase 'Door_1_source' > 0.5) or (_target animationSourcePhase 'ramp_anim' > 0.5)) && ((getPosVisual _target) select 2 >= %1)", _minAltetude];

// Add hold action for jump
[
private _actionID = [
_vehicle,
"<t color='#800080'>HALO Jump</t>",
"cScripts\Data\Icon\icon_02.paa",
Expand All @@ -48,4 +48,4 @@ private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) &
false
] call BIS_fnc_holdActionAdd;

_vehicle setVariable [QEGVAR(Vehicle,Halo), [_vehicle, _minAltetude, _chuteBackpackClass]];
_vehicle setVariable [QEGVAR(Vehicle,Halo), [_vehicle, _actionID, _minAltetude, _chuteBackpackClass], true];
4 changes: 2 additions & 2 deletions cScripts/functions/mission/fn_addLineJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (!isNil {_vehicle getVariable QEGVAR(Vehicle,Jump)}) exitWith {[format["Aircr
private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) && ((_target animationPhase 'ramp_bottom' > 0.64) or (_target animationPhase 'door_2_1' == 1) or (_target animationPhase 'door_2_2' == 1) or (_target animationPhase 'jumpdoor_1' == 1) or (_target animationPhase 'jumpdoor_2' == 1) or (_target animationPhase 'back_ramp_switch' == 1) or (_target animationPhase 'back_ramp_half_switch' == 1) or (_target doorPhase 'RearDoors' > 0.5) or (_target doorPhase 'Door_1_source' > 0.5) or (_target animationSourcePhase 'ramp_anim' > 0.5)) && ((getPosVisual _target) select 2 >= %1) && ((getPosVisual _target) select 2 <= %2) && (speed _target <= %3)", _minAltetude, _maxAltetude, _maxSpeed];

// Add hold action for jump
[
private _actionID = [
_vehicle,
"<t color='#800080'>Jump</t>",
"cScripts\Data\Icon\icon_02.paa",
Expand All @@ -53,4 +53,4 @@ private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) &
false
] call BIS_fnc_holdActionAdd;

_vehicle setVariable [QEGVAR(Vehicle,Jump),[_vehicle, _minAltetude, _maxAltetude, _maxSpeed, _chuteVehicleClass]];
_vehicle setVariable [QEGVAR(Vehicle,Jump), [_vehicle, _actionID, _minAltetude, _maxAltetude, _maxSpeed, _chuteVehicleClass], true];
68 changes: 68 additions & 0 deletions cScripts/functions/vehicle/fn_vehicle_reset.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "..\script_component.hpp";
/*
* Author: CPL.Brostrom.A
* This function clears all function variables as well as its attachments
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Example:
* ["vic"] call cScripts_fnc_vehicle_reset;
*
* Public: No
*/

params [["_vehicle", objNull, [objNull]]];
if (!isServer) exitWith {};
if (_vehicle iskindOf "man") exitWith {};

// Clear cosmetics and labels
private _labels = _vehicle getVariable [QEGVAR(Vehicle,Labels), []];
if (count _labels != 0) then {{deleteVehicle _x} forEach _labels;};
_vehicle getVariable [QEGVAR(Vehicle,Labels), nil];
_vehicle setVariable [QEGVAR(Vehicle,Cosmetics), nil, true];

_vehicle setVariable [QEGVAR(Vehicle,Callsign), nil, true];
_vehicle setVariable [QEGVAR(Vehicle,Name), nil, true];


// Clear pylon
_vehicle setVariable [QEGVAR(vehicle,Pylon), nil, true];
_vehicle setVariable [QEGVAR(Vehicle,PylonApplyed), nil, true];


// Clear Functions variable and vehicle type
_vehicle setVariable [QEGVAR(Vehicle,Type), nil, true]; // Clear type in case of
_vehicle setVariable [QEGVAR(Vehicle,Functions), nil, true];


// Clear and remove helicopter Get Out or Jump actions
private _getOutActionIDs = _vehicle getVariable [QEGVAR(Vehicle,GetOutRightLeft), [_vehicle, [_actionIDL, _actionIDR]]];
if (!isNil {_vehicle getVariable QEGVAR(Vehicle,GetOutRightLeft)}) then {
{_vehicle removeAction _x} forEach _getOutActionIDs select 1;
};
private _jumpActionID = _vehicle getVariable [QEGVAR(Vehicle,Jump), [_vehicle, _actionID, _minAltetude, _maxAltetude, _maxSpeed, _chuteVehicleClass]];
if (!isNil {_vehicle getVariable QEGVAR(Vehicle,Jump)}) then {
[_vehicle, _jumpActionID select 1] call BIS_fnc_holdActionRemove
};
private _heloActionID = _vehicle getVariable [QEGVAR(Vehicle,Halo), [_vehicle, _actionID, _minAltetude, _chuteBackpackClass]];
if (!isNil {_vehicle getVariable QEGVAR(Vehicle,Halo)}) then {
[_vehicle, _heloActionID select 1] call BIS_fnc_holdActionRemove
};


// Reset vehicle inventory variable
_vehicle setVariable [QEGVAR(Vehicle,Inventory), nil, true];


// Clear radio
_vehicle setVariable [QEGVAR(Vehicle,Radio), nil, true];


// Reset ACE Medical Vehicle
_vehicle setVariable ["ace_medical_isMedicalVehicle", nil, true];


// Remove any other random stuff
_vehicle setPlateNumber "";
_vehicle forceFlagTexture "";