Jump to content
Sign in to follow this  
USMCWall

Static fuel point that can be refilled and refuel.

Recommended Posts

Hey everyone, after searching through these forums I've seen lots of similar postings to what I would like to make, but I'm looking for some advice, and with some basic scripting knowledge some help in the long run.

I'm wanting to make a static fuel point (IE a fuel tank, etc) that can be filled with fuel, much like a fuel truck has a cargo capacity. Use basic scripting to set the max value of the fuel capacity for the tank and an action to use it to refuel like any other fuel truck. Optionally to add the ability to check how much fuel is stored in the tank as well.

If anyone could provide any insight I'd greatly appreciate it, thanks.

Share this post


Link to post
Share on other sites

For a script I'd do this. Start off with this in it's init line.

this setFuelCargo 0; this setVariable ["Fuel",10,true]; null = this addAction ["Refuel","refuel.sqf",];

In refuel.sqf you could use something along the lines of.


private["_tank","_vcls","_vcl","_remFuel"];

_tank = _this select 0;
_vcls = nearestObjects [getPos player, ["LandVehicle","Air","Ship","Tank"], 5];
if (count _vcls < 1) exitWith {};
_vcl = _vcls select 0;
if (fuel _vcl > 0.95) exitWith {};
if (_tank getVariable "Fuel" <= 0) exitWith {hint "Tank out of fuel!"};
_remFuel = 1 - fuel _vcl;
_tank setVariable ["Fuel",(_tank getVariable "Fuel") - _remFuel,true];
_vcl setFuel 0;
hint "Refueling...";
sleep 5;
hint "Vehicle Refueled!";
_vcl setFuel 1;

You can add other features using a similar system, Hope this helped.

Share this post


Link to post
Share on other sites

we use this running on the server to enable you to refuel/repair at gas stations - you could add in your own model unit to the array (like a vehicletype)

EGG_EVO_stationRepair = 
{
_vec = (vehicle player);
_type = typeOf vehicle player;
_EGG_stations = [];
_EGG_stations = nearestObjects [player, ["Land_A_FuelStation_Shed","Land_repair_center","FuelStation","FuelStation_army","Land_Mil_Repair_center_EP1","Land_A_FuelStation_Build","Land_A_FuelStation_Feed","Land_Ind_FuelStation_Feed_EP1","Land_Ind_FuelStation_Build_EP1","Land_Ind_FuelStation_Shed_EP1","Land_Ind_Garage01_EP1","Land_benzina_schnell","Land_fuelstation","Land_fuelstation_army"], 30];

if( (getDammage _vec > 0 or fuel _vec < 0.98) and (count _EGG_stations >0) and not (_vec isKindOf "Man") ) then
{
	if( (_vec != player) and (speed _vec > -2) and (speed _vec < 2) and (position _vec select 2 < 2.0) and (local _vec) ) then
	{
		 titleText [localize "STR_M04t83", "PLAIN DOWN",0.3];//Servicing
		 for [{_loop3=0}, {_loop3<1}, {_loop3=_loop3}] do
		 {
		    sleep 0.200;	    		    
		    if (getDammage _vec > 0) then {_vec setDammage ((getDammage _vec)-0.0125);};
		    if (Fuel _vec < 1) then {_vec setFuel ((Fuel _vec)+0.0125);};
		    if (getDammage _vec == 0 and Fuel _vec == 1) then {_loop3=1;};
		    if(_vec != vehicle player or speed _vec < -2 or speed _vec > 2 or position _vec select 2 > 2.0) then {_loop3=1;titleText [localize "STR_M04t84", "PLAIN DOWN",0.3];};
		    _dam = (getDammage _vec)*100;
		    _ful = (Fuel _vec)*100;
		    hint format["Damage: %1\nFuel: %2",Round _dam,Round _ful];
		};
	};
};
_EGG_stations = [];
};

Share this post


Link to post
Share on other sites

After finding the number of a particular fuel station, can one set it to 0 fuel so as to prevent people from refueling from said station?

Share this post


Link to post
Share on other sites
After finding the number of a particular fuel station, can one set it to 0 fuel so as to prevent people from refueling from said station?
i guess you mean horner's script? mine you can just take that type of gas station out of the array

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
Sign in to follow this  

×