Home   Help Search Login Register  

Author Topic: Fuel control...  (Read 641 times)

0 Members and 1 Guest are viewing this topic.

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Fuel control...
« 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
Weeee...

asmodeus

  • Guest
Re:Fuel control...
« Reply #1 on: 23 Jan 2003, 20:59:28 »
Do you mean so that the fuel stations will eventually be empty if they are used alot??

More details please.   ;)

Asmo

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Fuel control...
« Reply #2 on: 25 Jan 2003, 14:47:35 »
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
Weeee...

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:Fuel control...
« Reply #3 on: 25 Jan 2003, 23:50:13 »
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?

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Fuel control...
« Reply #4 on: 26 Jan 2003, 10:24:40 »
Thanks mate, I'll try and see if it works.

Cheers, and thanks again!  ;D
Weeee...

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Fuel control...
« Reply #5 on: 26 Jan 2003, 10:42:17 »
Worked just fine, thx :)
Weeee...

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Fuel control...
« Reply #6 on: 26 Jan 2003, 11:45:29 »
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
Weeee...

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Fuel control...
« Reply #7 on: 26 Jan 2003, 12:09:39 »
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
« Last Edit: 26 Jan 2003, 17:53:31 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Fuel control...
« Reply #8 on: 26 Jan 2003, 17:43:05 »
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 ;)
Weeee...

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Fuel control...
« Reply #9 on: 26 Jan 2003, 17:54:27 »
its my worng ;D

just gotta add

_vehicle b4 da addaction

i fixed da script in my post above check it ;)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta