Jump to content
Sign in to follow this  
eggbeast

making fuel station work as repair centres

Recommended Posts

here's a little script I developed from Evolution's FARP script, it basically repairs and refuels your vehicle if you are anywhere near a fuel station or repair depot.

_EGG_stations = [];

EGG_EVO_stationRepair = 
{
_vec = (vehicle player);
_type = typeOf vehicle player;
_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"], 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];
		};
	};
};
};

for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{
[] call EGG_EVO_stationRepair;
sleep 1.011;
};

---------- Post added at 07:26 PM ---------- Previous post was at 05:50 PM ----------

hmmm it doesn't work for the schnell station in lingor. i've been all over the pbo's for that map, anyone know what classname the schnell station is?

Share this post


Link to post
Share on other sites

hmmm this script doesn't work on takistan (it does for the repair centres but not the fuel stations)

does anyone know where I can find the takistan fuels station class list?

I have searched through all the pbo's but must have missed it somewhere

taki_fuel.jpg

Edited by eggbeast

Share this post


Link to post
Share on other sites

thanks man

I already did - it's not there - see pic I added above

Share this post


Link to post
Share on other sites

copyToClipboard typeOf ((getPos player) nearestObject 123456)

...will the classname to your clipboard.

Share this post


Link to post
Share on other sites

this looks promising thanks - how do I type this? using a console? what key is console? can't see it in the controls options...

I just went into the editor and stood by the fuel station but can't figure out how to run this... do I need to add it as an action?

Share this post


Link to post
Share on other sites

You can place it in a game logic or your player.

You will need to change nearestObject 123456 ID number with the one you want to check.

The result is now in your clipboard you can just paste it in notepad or in the game itself where any code or text can be placed.

you should see a result something like this Land_A_FuelStation_Feed this will change depending what number your checking.

On Takistan it maybe Land_Ind_FuelStation_Shed_EP1 you don't seem to have that one listed but there are probably more.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

nice one - i found it in

structures_e/ind/ind_FuelStation

new script is

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"], 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];
		};
	};
};
};

Share this post


Link to post
Share on other sites

hmm, it works now but the vehicles keep repairing for ever.

i think it needs a

_EGG_stations = [];

before the last curly bracket - testing now

Share this post


Link to post
Share on other sites

yeah that sorted it lol... was a bit of a game breaker before hehe

Share this post


Link to post
Share on other sites

Looks like a neat script I'll add, with credit to you of course, to a few missions... thanks!

I added "Land_FuelStation_Feed_PMC" for Proving Grounds but didn't see any stations on Shapur.

Share this post


Link to post
Share on other sites

ok sure well if you credit me please be sure to credit Kiljoy as he wrote the original script which I have adapted.

and thanks for the tip on the PMC fuel station - didn't find that yet

Share this post


Link to post
Share on other sites
ok sure well if you credit me please be sure to credit Kiljoy as he wrote the original script which I have adapted.

and thanks for the tip on the PMC fuel station - didn't find that yet

Ok, will do, if I get it working... :)

Share this post


Link to post
Share on other sites
here's a little script I developed from Evolution's FARP script, it basically repairs and refuels your vehicle if you are anywhere near a fuel station or repair depot.

_EGG_stations = [];

EGG_EVO_stationRepair = 
{
_vec = (vehicle player);
_type = typeOf vehicle player;
_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"], 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];
		};
	};
};
};

for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{
[] call EGG_EVO_stationRepair;
sleep 1.011;
};

---------- Post added at 07:26 PM ---------- Previous post was at 05:50 PM ----------

hmmm it doesn't work for the schnell station in lingor. i've been all over the pbo's for that map, anyone know what classname the schnell station is?

How do you get this to work. What part of the script do i use and where do i put it in. Thanks.

Share this post


Link to post
Share on other sites

copy the script above into a file called repairc.sqf

in your mission place a sensor to initialise the player

(if you dont already have one. if you do, just edit it to include the line below)

	class Item23
	{
		position[]={4650.8359,0.37295699,1911.5852};
		timeoutMin=1;
		timeoutMid=1;
		timeoutMax=1;
		interruptable=1;
		age="UNKNOWN";
		text="pinit";
		name="pinit";
		expCond="local player";
		expActiv="plays = [] execVM ""pinit.sqf"";";
		class Effects
		{
		};
	};

and then make a server player init function - pinit.sqf which calls a the repair script for the clients

_cthread = [] execVM "repairc.sqf";

job done

Share this post


Link to post
Share on other sites

I cant get this to work. I put a hint in script so I know script is running.

Anyone care to look at my test mission?

http://www.mediafire.com/file/mvpcyws6qqjwbpu/testing.Chernarus.pbo

---------- Post added at 10:02 PM ---------- Previous post was at 09:51 PM ----------

Nevermind. It does work, I just had to get out of vehicle then back in. I guess I made a example mission for ya :-)

Share this post


Link to post
Share on other sites

hmmm i'm not sure why your test didn't work - I drove into the station and it refueled as normal, then i drove up to the shed at the back of the station, got out and shot the car once, then got in and it serviced - so the script in your test does work! try it - get out, shoot the car and get in again.

not sure why i had to shoot the car first... it does check for damage, maybe adding the damage to the car before spawn tricks the script somehow.

just one point, i have modified the script since the first post

it now looks like this:

EGG_EVO_stationRepair = 
{
_vec = (vehicle player);
_type = typeOf vehicle player;
_EGG_stations = [];
//added new classes of fuelstation - will put duala ones in when i have them
_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];
//optional
//			_vec setVehicleAmmo 1;	
		};
	};
//adding to stop car fixing itself permanently!
_EGG_stations = [];
};
};

Edited by eggbeast

Share this post


Link to post
Share on other sites

Yeah thanks, I'll give it a try now. :)

Share this post


Link to post
Share on other sites

added these 3 for duala into the script above

Land_benzina_schnell

Land_fuelstation

Land_fuelstation_army

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  

×