Author Topic: Limited Fuel Script request  (Read 406 times)

0 Members and 1 Guest are viewing this topic.

Limited Fuel Script request
Hello everyone,

I implemented a limited fuel and drop tank system for the Diaspora campaign missions and released them as a mod in the 3rd party missions section of Diaspora.  I'd really like to be able to have this scripted so that I can just call the script instead of copying it from mission to mission which is obviously not the way to go.

I'm puttering around with scripting but I don't know how to do it yet.  I've attached a text file with all of the SEXP's I have written.

It relies on two variables, FuelQuantity and ExternalFuel, it calls four custom HUD gauges, those are all available in the download in the VP.

The script would need to evaluate the name of the player ship and then perform the same checks these SEXP's do.  Is the player ship moving in any direction?  Is GLIDE engaged?  Are the thrusters being used?

It should use fuel at the rate of speed in any axis every two seconds when thrusters are applied in either normal or glide but should not use fuel in glide if thrusters are not being used.

Thanks for any assistance on this.

 
Re: Limited Fuel Script request
Okay, this is a fairly complex set of events, and there are some red-flags for bugs, so I need some clarification before I start scripting. It looks like you want to do this:

- Every frame:
--- if the player is not gliding, sum the absolute value of the player's speed along each axis, and subtract that from both FuelQuantity and ExternalFuel;
--- if the player is gliding, do the same, but summing the speed only on those axes along which the player is actually thrusting;
--- set HUD gauge FuelBar to frame N, where N=( ( 13000 - FuelQuantity ) / 1000 );
--- set HUD gauge ExtFuelBar to frame N, where N=( ( 26000 - FuelQuantity ) / 2000 );
--- set HUD gauge FuelTankViper to frame N, where N=( ( 13000 - ExternalFuel ) / 1000 );
--- set HUD gauge FuelTankRaptor to frame N, where N=( ( 26000 - ExternalFuel ) / 2000 );

- At mission start, if the player has an external fuel tank equipped, set FuelQuantity and ExternalFuel and activate HUD gauges based on the player's ship class.

- Something funky involving the player's secondary ammo and jettisoning fuel tanks that I don't think I understand.

 
Re: Limited Fuel Script request
Okay, this is a fairly complex set of events, and there are some red-flags for bugs, so I need some clarification before I start scripting. It looks like you want to do this:

- Every frame:
--- if the player is not gliding, sum the absolute value of the player's speed along each axis, and subtract that from both FuelQuantity and ExternalFuel;
--- if the player is gliding, do the same, but summing the speed only on those axes along which the player is actually thrusting;
--- set HUD gauge FuelBar to frame N, where N=( ( 13000 - FuelQuantity ) / 1000 );
--- set HUD gauge ExtFuelBar to frame N, where N=( ( 26000 - FuelQuantity ) / 2000 );
--- set HUD gauge FuelTankViper to frame N, where N=( ( 13000 - ExternalFuel ) / 1000 );
--- set HUD gauge FuelTankRaptor to frame N, where N=( ( 26000 - ExternalFuel ) / 2000 );

- At mission start, if the player has an external fuel tank equipped, set FuelQuantity and ExternalFuel and activate HUD gauges based on the player's ship class.

- Something funky involving the player's secondary ammo and jettisoning fuel tanks that I don't think I understand.

Very close yes.  I was dividing the variables by 100 though in every case to display a four digit number on the HUD.

When you jettison a fuel tank I had it check the number of secondary stores of that bank, when that type of secondary store is equipped on the fighter.  If the variable was above the value of that tank plus the others (aka it wasn't empty) set the variable to the value of the remaining tanks.  I had each tank carry 65000 worth of fuel and internal was 130000 or 260000 for the Viper MKVII.

So if you had external tanks on a MKVII for example you have two tanks for 130000 in external plus 130000 internal for a total of 260000.  If you jettison one tank you lose whatever was left of that 65000 it it's above the internal plus external remaining.  So in that case above 195000 set the variable to 195000 total fuel and external to 65000.  Is that clear as mud?

 

Offline Colonol Dekker

  • HLP is my mistress
  • 213
  • Aken Tigh Dekker
    • My old squad sub-domain
Re: Limited Fuel Script request
I get the feeling this will be in BP soon...

 
Re: Limited Fuel Script request
Sometimes I get to things in a timely manner. This was not one of those times. I'm starting work for reals and should have a release ready by the end of the weekend.

  
Re: Limited Fuel Script request
Cool!   :yes: