Jump to content
Sign in to follow this  
*tcf*jackal

Fuel Stations

Recommended Posts

Hi all,

im about to start testing some code to see if its possible to find the nearest fuel station to the player. Having a look through CfgLocationTypes, nothing really stands out to suggest their locations might be obtainable this way. Before I start testing, does anyone know if the fuel stations are in CfgLocationTypes and if so, what they are called?

Many thanks!

Share this post


Link to post
Share on other sites

you could use nearestObjects to retrieve the gas pumps on the map within X radius (classname is under cfgVehicles). Objects closer to the front of the returned array should be closer in theory.

Share this post


Link to post
Share on other sites

The fuel icons on the in game map are defined by the bowser objects, not by locations.

Bowser classnames:

"Land_FuelStation_Feed_F"

"Land_fs_feed_F"

Share this post


Link to post
Share on other sites

To prevent any performance hit using nearestobjects mid mission with higher distances

you could execute the function via call in init.sqf and store all fuel stations from the entire map in an array,

then when needed sort that array by distance to the player.

Cheers

Share this post


Link to post
Share on other sites

Thanks Grumpy, very good idea. I haven't yet used the nearestobjects command, but I'll have a crack at it this weekend!

Share this post


Link to post
Share on other sites

/*
32 pump locations on altis

create triggers on pump locations to disable auto refueling for vehicles.
*/

VIR_fuelPump_locations = [
[9205.75,12112.2,-0.0487213],
[11831.6,14155.9,-0.0342026],
[12024.7,15830,-0.0298138],
[12026.6,15830.1,-0.0342979],
[12028.4,15830,-0.0388718],
[9025.78,15729.4,-0.0206451],
[9023.75,15729,-0.027153],
[9021.82,15728.7,-0.0293427],
[16750.9,12513.1,-0.0525188],
[6798.15,15561.6,-0.0441475],
[6198.83,15081.4,-0.0912437],
[14181.6,16549.3,0.00917625],
[5023.26,14429.6,-0.0978947],
[5019.68,14436.7,-0.0114822],
[4001.12,12592.1,-0.0966644],
[17417.2,13936.7,-0.10652],
[3757.14,13477.9,-0.0540285],
[3757.54,13485.9,-0.010498],
[16875.2,15469.4,0.0373325],
[16871.7,15476.6,0.0102873],
[8481.69,18260.7,-0.0266876],
[15297.1,17565.9,-0.2838],
[14221.4,18302.5,-0.0697174],
[15781,17453.2,-0.285282],
[19961.3,11454.6,-0.0349312],
[19965.1,11447.6,-0.0483704],
[5768.99,20085.7,-0.0189667],
[21230.4,7116.56,-0.0604248],
[20784.8,16665.9,-0.0521202],
[20789.6,16672.3,-0.0213318],
[23379.4,19799,-0.0544052],
[25701.2,21372.6,-0.0774155]
];

//-------------------------------------------------------------------------------

{
_trg=createTrigger["EmptyDetector",_x];
_trg setTriggerArea[5,5,0,false];
_trg setTriggerActivation["NONE","PRESENT",false];
_trg setTriggerStatements["true", "{if (_x isKindOf 'Land_fs_feed_F') then {_x enableSimulation false; _x allowDamage false}} forEach nearestObjects [thisTrigger,[],10]", ""]; 
/*
_mrk = createMarker [format["%1_fuelpump", floor (random 100000)], _trg];
_mrk setMarkerShape "ICON";
_mrk setMarkerType "hd_dot";
_mrk setMarkerColor "ColorRed";	
*/
} foreach VIR_fuelPump_locations;

Borrowed from here: http://forums.bistudio.com/showthread.php?172888-Fuel-(Gas)-Station-Disable

Check it out, OP. Fits your case.

  • Like 1

Share this post


Link to post
Share on other sites

Hey all. This seems to be a hard thing to find.

 

Anyone have a solution to disable auto refuel at gas stations. Have attempted 2-3 things with

((position this) nearestObject 1665890) setFuelCargo 0; ((position this) nearestObject 1665891) setFuelCargo 0

and disabling all on Altis with code init.sqf

// Empty all Fuel Stations

{_x setFuelCargo 0;} forEach (nearestObjects [(getmarkerpos "center"), ["Land_FuelStation_Feed_F"], 12000]);

Both didnt work.

 

ideas?

Share this post


Link to post
Share on other sites

Hey all. This seems to be a hard thing to find.

 

Anyone have a solution to disable auto refuel at gas stations. Have attempted 2-3 things with

((position this) nearestObject 1665890) setFuelCargo 0; ((position this) nearestObject 1665891) setFuelCargo 0
and disabling all on Altis with code init.sqf

// Empty all Fuel Stations

{_x setFuelCargo 0;} forEach (nearestObjects [(getmarkerpos "center"), ["Land_FuelStation_Feed_F"], 12000]);
Both didnt work.

 

ideas?

Dummies guide to not refuel automatically:

Step 1. Park your car at a fuel station.

Step 2. Wait until you reach your desired amount.

Step 3. Park your car outside of the station.

Step 4. Pick one of the following methods:

Choice 1. Grab some charges and lay them near the feed.

Choice 2. Grab a tank and load the SABOT.

Choice 3 (My favourite). If in Altis Life, lay some charges at the feed and wait for a Gas Station thief/player.

Step 5. Using one of the choices above, blow up the gas station. (If you picked Choice 3, disconnect from the server.)

Step 6. Profit. (Probably richer if you did Choice 3 :p )

That is the basics of stopping a gas station refuelling you. :)

If you would like the script version, I'm sorry but I am not on PC as usual. ;)

Share this post


Link to post
Share on other sites

While I appreciate humor, I don't know if I want to blow every gas station on altis. Is there a way to just set damage to all. I guess I could place damaged vehicles in the way too. Would setting damage disable the refueling? What's the code to set damage to gas stations? I am sure its different than to vehicles.

Share this post


Link to post
Share on other sites

Try replacing the classname with "Land_FS_Feed_F".

{_x setFuelCargo 0} foreach nearestObjects [[16000,16000], ["Land_FS_Feed_F"], 16000]

this should cover entire Altis.

Share this post


Link to post
Share on other sites

Try replacing the classname with "Land_FS_Feed_F".

{_x setFuelCargo 0} foreach nearestObjects [[16000,16000], ["Land_FS_Feed_F"], 16000]
this should cover entire Altis.

I can try this. I have a feeling the lag may kill it. May be a trigger after every thing loads first and then that. Thanks.

Is there a setdamage or destroy building code that would be less laggy?

Share this post


Link to post
Share on other sites

It should be very fast to run, like a tenth of a second or so. And you need to execute it only once.

Share this post


Link to post
Share on other sites

Fuel depletion for vehicles needed.

 

As it is now, hardly any use for fuel trucks which is sad it's not incorporated into the base vanilla game.  You can drive forever and never need fuel.

Can you add into a module or plain script to run on dedicated servers for fuel uptake? The one thing that's missing badly in Arma3 is shorter fuel time. The islands are half the size, so the fuel should be double the speed of fuel consumption.  On Tom's blog tom_48_97, he has scripted an uptake script but I can't seem to make it work for the clients on a dedicated server. http://tom4897.info/...el-consumption/It  increases the fuel uptake taking into account the speed of the player vehicle. The script doesn't cancel and replace the default, it adds to it and the base consumption of ground vehicle is already greater.

Share this post


Link to post
Share on other sites

Bumping this to add what I think is the most efficient solution working on all maps.

Runs extremely fast in version 1.64 stable branch.

_allFuelStations = ([0,0,0] nearObjects 150000) select {getFuelCargo _x > 0};
{_x setFuelCargo 0} foreach _allFuelStations;

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Bumping this to add what I think is the most efficient solution working on all maps.

Runs extremely fast in version 1.64 stable branch.

_allFuelStations = ([0,0,0] nearObjects 150000) select {getFuelCargo _x > 0};
{_x setFuelCargo 0} foreach _allFuelStations;

Cheers

Is that even faster that nearestTerrainObjects by classname and without distance sorting?

 

edit. oh, sorry; didn't notice that was a global solution without predetermined classes.

Share this post


Link to post
Share on other sites

Stratis: 11.6279 ms

Altis: 161 ms

Tanoa: 92.4545 ms

 

Shouldn't really matter though, since you'll run it only once at init.sqf anyway.

Should work on all maps, that's right.

 

Alternatively you can use this if you have fuel trucks or other fuel sources placed on the map that should remain intact:

_exclude = ["StorageBladder_01_fuel_forest_F","B_Truck_01_fuel_F","etc"];
_allFuelStations = ([0,0,0] nearObjects 150000) select {getFuelCargo _x > 0 AND !(typeof _x in _exclude)};
{_x setFuelCargo 0} foreach _allFuelStations;

Cheers

  • Like 2

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  

×