Community Forum

Change Fuel price

Forum Overview >> Scripting

Created20.01.2017 16:17

Daniel Andersen (dakar2008) 20.01.2017 16:17
Hi there is it possible to change the fuel price with a script?

Bilbo Beutlin (BBeutlin) 21.01.2017 20:46
The price of a Fill/FruitType is determined when registering it: (float) pricePerLiter.
Note that this is map specific and the registering is done usually when loading the map.

To get the ID of a certain FillType use:
fTypeId = Fillable.fillTypeNameToInt[name]; -- example (string) name = "fuel"

To get the FillType description use:
fDesc = Fillable.fillTypeIndexToDesc[fTypeId];

Now you can read out the price:
price = fDesc.pricePerLiter;

Or set the price:
fDesc.pricePerLiter = myPrice;

At least so it was working in FS15. But I can't guarantee it works in FS17 also, since there were some changes and now there's an "economyManager": g_currentMission.economyManager:getCostPerLiter(FillUtil.FILLTYPE_XYZ)

On the other hand there should exist an appropriate function "setCostPerLiter(..)".

Try out.

Note: Log in to post. Create a new account here.