Siphon fuel from Vehicles

Audio Rejectz

Well-Known Member
I was wondering if someone could help me with this, please bare with me as im new to all this and im trying to learn.
I fancied try to add the ability to siphon fuel from vehicles, as it would make sense in a post apocalyptic world. After looking around i found this from DNK

addFuel.sqf
Code:
_m = _this select 3;
_j = 0;
if (playergas > 0) then {
    player playmove "AinvPknlMstpSnonWrflDnon_medic";
    sleep 3;
    player playmove "AinvPknlMstpSnonWrflDnon_medic2";
    sleep 9;
    player switchmove "AinvPknlMstpSnonWrflDnon_medicEnd";
    _j = ((fuel (_this select 0)) + (_m *((playergas/100)*0.1)));
    (_this select 0) setfuel _j;
    playergas = 0;
    hint "Your cannister is now empty.";
} else {
    hint "No gas in cannister.";

fuelcheck.sqf
Code:
fuel = round((fuel (vehicle player))*100);
    hint format["Tank is %1pc full.",_fuel];

misson.sqm
Code:
init="this addaction [""Check fuel"",""fuelcheck.sqf"",14,0,false,true,"""",""true""]; this addaction [""siiphon fuel"", ""takefuel.sqf"",0.8,0,false,true,"""",""true""]; this addAction [""Add fuel"", ""addfuel.sqf"",0.8,0,false,true,"""",""true""];";

Now if i put the sqf's in my misson, it seems i am able to add the code above to my misson.sqm but i can only get it to apply to vehicles that are in there to, meaning there static. Is there anyway to get around this?
 
The add action in your init line may be run before vehicles are spawned, so ones from dayz database aren't getting the init.

Maybe add

if (!isdedicated) then {
while {true} do
//Code

So it's continuous and not run by the server.


EDIT:
Also an anal retentive point, can you change gas to fuel in the hint? That way it's standardised and not so 'american' (for lack of a better word)
 
Good news is you don't need the add fuel script, its already in the DayZ code as is the logic to persist the fuel state in the vehicle.

The part that you need to work on most is the siphoning and it makes most sense there use the Jerrycan as the reciprocal. So to type it in human readable, you would set up a while condition around the cars current capacity where you can change itemJerrycanEmpty to itemJerrycan(full) until the car is empty. The logic will already be tied into the fuel stations for giving you the hint line and add-action to add fuel, a tip here is to get your own completely un'pbo'ed /ca directory so you can look at the configs for existing objects to see how they go about it (there is a script somewhere that does this, I will try and remember where I have it).

Incidentally I am just about to start working on a new fuel logic which will ration fuel through out the world (no more limitless supplies). I expect this will be helpful to your siphoning code, so we could combine the two if you agree.
 
Audio/shinkicker, have you guys done any work on this recently?

I had an idea yesterday to use Fuel trucks as big jerry cans, so I would be really interested in any progress!
 
I think I managed to disable the fuel stations after some work, I was also going to do the fuel trucks too. I will try and get round to this soon, just getting 2017 ready for its next release.
 
Sneaky hint there shinkicker :) People are going to start stocking up on fuel now :p

Your concept is nice Audio - I'm not great at mission editing so once you get this fully working I'd love to see your code :)
 
Question on this script.

I am looking to do this on my server also, siphon from vehicles and from fuel pumps (not just the tanks).. Since I am new to ARMA/DayZ coding (and game coding in general) does this script function, and can it function on fuel pumps?

Thanks,
Jantik
Gwilo Productions Gaming Admin
 
Oh god, disabling fuel stations, and enabling fuel syphoning/vehicle part scavenging - that would be awesome. Guys, we have to make this happen!
 
Oh god, disabling fuel stations, and enabling fuel syphoning/vehicle part scavenging - that would be awesome. Guys, we have to make this happen!

Disabling Fuel Stations is an idea, or mabybe modify it so they fuel really slow cuz someone has to manually charge the pump motor, or has to fuel the generator for the station to turn on the fuel pumps.

I would still like to fuel a jerry can from a fuel pump (like you would fill the little red containers IRL for like your lawnmower).. same idea is what im looking to do..


Thanks,
Jantik
Gwilo Productions Gaming Admin
Follow my adventures http://www.twitch.tv/jantik
 

I would love the disabled pumps, cause it would make the game more realistic. Another option would be is to actually "limit" the fuel capacity, like a gas tank can hold 12.000 litres of fuel, and every JC filling would drop this amount. If it reaches zero, its over, the tank is empty. But honestly, I really doubt if that can happen without seriously altering the basic game code.
 
That is also a good idea Don. I run a Tavania map, and there is a row of train tanker cars, so this idea would be perfect!

I wouldnt be surprised if you could just script it into the PBO, I have seen a lot of good stuff ( The lift script from =BTC= for example). But being an utter nub to it in general, thats way advanced for me. I suppose I could setup a local arma/dayz server so i can test changes, so as to not take the fun away from my regulars who are on almost everyday...

Might be time to actually build that small server ive been meaning too...

Thanks,
Jantik
Gwilo Productions Gaming Admin

Follow my adventures http://www.twitch.tv/jantik
 
Basically what I would want to do - All fuel nodes on the map have a random quantity (very limited to zero) at each restart. Force players to run around to diff locations each restart to get some fuel... Chance to get screwed by fuel nodes with nothing would happen to those thinking about camping near a fuel spot that always has a set amount of fuel.. so you gotta have a bit of random.

This would also limit vehicle use, naturally lots of vehicles SHOULD exist - but fuel should be the limiting factor for actually using them. And perhaps tweak the loot tables so jerry cans spawn less or empty. Every drop of fuel you find is gold, and it takes up a ton of inventory space... Again... have to weigh the cost of carrying it rather than survival supplies.
 
Definitely I'd love to be able to disable the oil-pumps, or at least limit their fuel. But I'm afraid all my research has amounted to nothing on the matter.

If anyone can give me some pointers as to where I should start looking at, I'll do what I can to reverse-engineer it.
 
Back
Top