PHP Code:
//Script created with major help from F2k Sel
//act3 = truck_start addaction ["Refuel truck","fill.sqf","",1,false,true,"","scase distance truck_start <= 5 and player distance truck_start <= 5 and take==0"];
//act2 = truck_start addaction ["Attach Options","attachtruck.sqf",[1],1,false,true,"","player distance truck_start < 4 and player distance scase < 4 and take==0"];
// (These inits I placed on the Jerry Can instead of the Truck, not sure if it changes the effectiveness of the script, check AttachOption.sqf for full attachment on Jerry Can)
// take = state of object:0 on ground : 1 carried by player : 2 dropped close to vehicle: 3 refueling : 4 attacehed to truck : 5 dropped close to fuel suppliy.
player removeAction act1;
//truck_start removeAction act2;// remove initial action on truck Attach.
//truck_start removeAction act5;// remove initial action on truck Refuel.
_man = player;
//Fasten jerry can to back of truck
switch (take) do
{
case 2 :
{
detach scase;
scase say ["TapeCan",5];
titleCut ["Fastening Jerry Can to Truck","PLAIN",0.5];
player removeAction act2;
scase removeaction act1;
truck_start removeaction act3;
player playmove "ActsPercSnonWnonDnon_assembling";
sleep 10;
player playMoveNow "AmovPercMstpSlowWrflDnon";
scase attachTo [truck_start,[-0.9,-3.1875,-0.5]]; // attach to vehicle
titleText ["Jerry Can is secured","PLAIN"];
act2 = scase addaction ["Remove from Truck","scripts\take_fill_attach\attachtruck.sqf","",1,false,true,"","player distance scase < 4"];//change action for next case
take=4;
};
//Attach Jerry Can to hip after removing jerry can from back of truck
case 4:
{
detach scase;
titleText ["Unfastening Fuel Can","PLAIN"];
player switchmove "c7a_bravoTOerc_idle1";
scase removeAction act2;
sleep 5;
player switchmove ",";
scase setvelocity[0,0,-.3];
// scase attachto [_man, [-0.23,0,-0.15],"Pelvis"]; // attach to player
// scase setdir 75;
act2 = _man addaction ["Attach to back of Truck","scripts\take_fill_attach\attachtruck.sqf","",1,false,true,"","player distance truck_start < 5 and scase distance truck_start < 5 and take==2"];
act1 = scase addaction ["Take Jerry Can","scripts\take_fill_attach\carry.sqf","",1,false,true,""];
take=2;
};
};
PHP Code:
//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: What's his name.
//////////////////////////////////////////////////////////////////
//Script pulled from F2k Sel
//init: take=0; act1 = this addaction ["Take Fuel Can","carry.sqf",[0],1,false,true,"","player distance scase < 2"]
//Jerry Can starts at case 0 so first the player can pick it up
// take = state of object:0 on ground : 1 carried by player : 2 dropped close to vehicle: 3 refueling : 4 attacehed to truck
private ["_In_out","_man"];
////////////// checks for player in or out of car ////////////////
_in_car = {
_In_out = createTrigger["emptyDetector",[0,0,0]];
_In_out setTriggerArea [0,0,0,false];
_In_out setTriggerActivation ["any","present",True];
//_In_out setTriggerStatements["(vehicle player) != player and take == 1",";scase hideobject true;","scase hideobject false;"];// hides object
_In_out setTriggerStatements["(vehicle player) != player and take == 1","player action ['getout',nearestObject [player,'car']]; Hint 'Get out you idiot!';",""];// kicks you out if carrying
_return
};
////////// checks if player is dead ///////////////////
_evh_Killed = {
_man removeeventHandler ["killed",0];
_man addEventHandler ["killed", {
detach scase;
scase removeAction act1;
act1 = scase addaction ["Take Jerry Can","scripts\take_fill_attach\carry.sqf","",1,false,true,""];
take=0;at=1;(_this select 0) removeeventHandler ["killed",0]; } ];
_return
};
switch (true) do
{
//pick up jerry can
case (take == 0 or take == 2) :
{
_scase = _this select 0;
_man = _this select 1;
_fuel = scase getvariable "fuel";
_fuelCount = _fuel;
if (_fuel >=1) then {_fuelCount=10; _fuel=1};
if (_fuel > 0 and _fuel < 1) then {_fuelCount=_fuel*10};
if (_fuel == 10) then { titleText ["This feels full","PLAIN",0.3]};
if (_fuelCount >=5 and _fuelCount < 10) then {titleText ["This feels somewhat full","PLAIN",0.3]};
if (_fuelCount >=3 and _fuelCount < 5 ) then {titleText ["This feels half way full","PLAIN",0.3]};
if (_fuelCount >=1 and _fuelCount < 3 ) then {titleText ["This feels close to empty","PLAIN",0.3]};
if (_fuel == 0) then {titleText ["This feels empty","PLAIN"]};
_man playmove "AinvPknlMstpSnonWnonDnon_3";
sleep 2;
_scase attachto [_man, [-0.23,0,-0.15],"Pelvis"];
_scase setdir 75;
_scase removeAction act1;
_man removeAction act2;
truck_start removeAction act3;
act1 = _man addaction ["Drop Jerry Can","scripts\take_fill_attach\carry.sqf","",1,false,true,""];
take=1;scase = _scase;_man call _in_car; _man call _evh_Killed;
hintSilent format ["Jerry Can Has %1 Liters of Fuel",_fuelCount];
};
// drop jerry can
case (take == 1) :
{
_man = _this select 0;
detach scase;
scase setvelocity[0,0,-.3];
_man removeAction act1;
act1 = scase addaction ["Take Jerry Can","scripts\take_fill_attach\carry.sqf","",1,false,true,""];
_close_veh = nearestObjects [_man,["car"],5];
take=0;deletevehicle _In_out;
if (_close_veh select 0 != truck_start) then {take=0} else {
take = 2;
act3=truck_start addaction ["Refuel truck","scripts\take_fill_attach\fill.sqf","",1,false,true,"","(vehicle player) == player and scase distance truck_start <= 5 and player distance truck_start <= 5 and take==2"];
act2 = _man addaction ["Attach to back of Truck","scripts\take_fill_attach\attachtruck.sqf","",1,false,true,"","player distance truck_start < 5 and scase distance truck_start < 5 and take==2"];
};
_man removeeventHandler ["killed",0];
};
};