OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wildebeest on 23 Jan 2003, 20:10:25
-
Is it by any chance possible to control the amount of gas spent when filling up a vehicle? I would like to add gas rather than just set a new value disregarding the actual quantity. I suppose that a script, checking the fuel level all the times, together with the "setfuel" command would do the trick, but I'm not sure. I'm not too good at scripting, so please help =)
Thx, you guys are always the best...
Cheers
-
Do you mean so that the fuel stations will eventually be empty if they are used alot??
More details please. ;)
Asmo
-
Well, I don't want to use barrels nor fuel stations. I'm talking about filling up vehicles using commands. In the mission you are to have imaginary fuel cans that you can use together with your vehicle. Picture this scenario:
"Oh no, I'm running low on gas, I have to fill her up!" You get out of the vehicle and fuel the vehicle with a fuel can using either the action or radio menu (haven't made up my mind yet).
Now, the only way I know of doing something even similar to this is to use the "setfuel" command, but that command doesn't care about how much fuel you had in the first place, it just sets a new value, and I don't want the fuel cans to fill the vehilce up to max. I also want the player to be able to use more than one can at the time, which will make it possible to fill up the vehicle to the limit using many.
This nut might be impossible crack... it's not very easy for me to explain this anyways :)
Cheers
-
try something like this
_vehicle = vehicle player
_fuel = fuel _vehicle
_fuelcan = 0.25
? usedcans >= howmanycans : vehicle player removeaction usefuel ; exit
_vehicle setfuel _fuel + _fuelcan
usedcans = usedcans +1
and execute it like this
usefuel = vehicle player addaction["Refuel","fuel.sqs"];howmanycans = 4;usedcans = 0;
is that what you want?
-
Thanks mate, I'll try and see if it works.
Cheers, and thanks again! ;D
-
Worked just fine, thx :)
-
All except for one small detail... :-[
When I use the fuel cans the last one won't work at all. Is there some way to fix this minor bug? ???
Cheers
-
dere is a way but try dis 1 ;D
execute like dis
(vehicle player) addaction [format["Refuel (%1 cans left)",cans],"fuel.sqs"];cans = 4;
and da script
_vehicle = vehicle player
_fuel = fuel _vehicle
_vehicle setfuel _fuel + 0.25
cans = cans-1
_vehicle removeaction (this select 2)
? cans > 0 : _vehicle addaction [format["Refuel (%1 cans left)",cans],"fuel.sqs"]
exit
wil work perfect wid less variables ;D
LCD OUT
-
Hmm, thanks man but for some reason I receive an error message: "? cans > 0 : addaction [format["Refuel (%1 cans left)",cans],"fuel.sqs"]: Error unknown operator" when executing the script. :'(
Ah, I'm sure someone will help me out, you rock
Cheers ;)
-
its my worng ;D
just gotta add
_vehicle b4 da addaction
i fixed da script in my post above check it ;)
LCD OUT