Tutorial; FuelBurn - HWRM/KarosGraveyard GitHub Wiki

How to Give a Ship Fuel-Burn by IWAssassin, Tamerlane, and Thought

Introduction

First, download the "fuelburn.lua" script and install it into "Data\Scripts\Fuelburn".

Giving a ship fuel involves editing four main files:

  • ".ship"
  • ".subs"
  • ".level"
  • ".lua"

"<sShipName>.ship"

After the LoadModel() function call, add this line:

StartShipHardPointConfig(NewShipType, "Engine", "Weapon_FrontGun", "System", "Innate", "Damageable", "Kushan_int_Engine", "", "", "", "", "", "", "", "")

Weapon_FrontGun needs to be a valid hardpoint on the HOD file. For the interceptor I simply used the hardpoint for the gun. Ideally you'll want to add a "FuelTank" hardpoint.
Kushan_int_Engine needs to be the name of your fuel tank subsystem. I used the "hgn_C_engine" as a base.

"<sModuleName>.subs"

Add this line:

NewSubSystemType.Visible = 0

This ensures you don't see something like a carrier engine module strapped to an interceptor.
If there is a subsystem multiplier, remove it, or change Linear to "None" -- unless you want an interceptor with 50% fuel to move at 50% speed.

"<sLevelName>.level"

Here you need to create a sobgroup for EVERY ship that is in the ".level" file that uses fuel. Syntax for the sobgroup name is as follows:

SobGroup

So, if you have 3 Squadrons of Hiigaran Attack Bombers you will need three sobgroups, named:

"hgn_attackbomberSobGroup1"
"hgn_attackbomberSobGroup2"
"hgn_attackbomberSobGroup3"

Make sure you add the fighters to the sobgroups, as well using the addToSOBGroup function.

Note: if you dont have ships in the ".level" file that use fuel, you can ignore this edit.

"<sLevelName>.lua"

To reference the FuelBurn script, you need to add this line to the file:

dofilepath("data:scripts/fuelburn/fuelburn.lua")

For the initialization function add one line for every ship class you have that burns fuel, e.g.:

FuelBurn_Initialize(, , , )

<sShipType>: the name of the class of ship, e.g. "kushan_interceptor" or "hgn_attackbomber".
<iNumberOfShips>: the number of Ships of that class you have in the ".level" file.
<iFuelsize>: the duration (in 0.1 second intervals) that the fuel lasts. 5 minutes of fuel is 3000.
<sHardPointName> the name of the fuel tank. It is the second parameter in the StartShipHardPointConfig() function.

Next, add a rule that will handle fuel burn. In this rule, you need only one line:

FuelBurn_BurnAll()

Optionally, you MAY burn only some ships using the function:

FuelBurn_ShipType()

or:

FuelBurn_SobGroup(, , )

All parameters are the same as for FuelBurn_Initialize().

Known Bugs

  1. Some ships will not be able to dock with Hiigaran Carrier. This is because the ship is not maneuverable enough with the reduced speed in order to make the tight turns necessary to dock.
  2. Squadrons with more than one ship will only show fuel drain on the first Ship. If the first Ship is destroyed, the engine starts draining from the next ship which will have 100% fuel.

Related Pages

Tutorials

Discussion

Comments

The FuelConsumptionDemo.zip download on this page and the discussion is reporting the server cannot be found.

--YaFn (2007-04-03 18:02:07)

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial

⚠️ **GitHub.com Fallback** ⚠️