Community Forum

Price formula

Forum Overview >> Scripting

CategoryScripting
Created18.12.2021 16:09


Fr Dmitry (Dmitry79) 18.12.2021 16:09
I can't calculate the final price.
Please tell me the formula for calculating prices.

Fr Dmitry (Dmitry79) 18.12.2021 18:43
Found a function:

function SellingStation:getEffectiveFillTypePrice(fillType, toolType)
if self.fillTypePrices[fillType] == nil then
log("Missing filltype", g_fillTypeManager:getFillTypeNameByIndex(fillType), tostring(self:getName()))
printCallstack()
end

if self.isServer then
local factor = 0
local period, alpha = g_currentMission.environment:getPeriodAndAlphaIntoPeriod()
local fillTypeDesc = g_fillTypeManager:getFillTypeByIndex(fillType)
local seasonalFactor = g_currentMission.economyManager:getFillTypeSeasonalFactor(fillTypeDesc, period, alpha)

if seasonalFactor == 0 then
return 0
else
return (self.fillTypePrices[fillType] * seasonalFactor + self.fillTypePriceRandomDelta[fillType] * SellingStation.RANDOM_DELTA_IMPACT) * self.priceMultipliers[fillType] * EconomyManager.getPriceMultiplier()
end
else
return self.fillTypePrices[fillType]
end
end

Bilbo Beutlin (BBeutlin) 19.12.2021 05:35
For more LUA documentation use the "gameSource.zip" which should be in your FS user folder "debugger".


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