Community Forum

PricePerLiter error

Forum Overview >> Scripting

CategoryScripting
Created15.03.2013 09:38


Dirk Peeters (jengske_BE) 15.03.2013 09:43
hi all,
i'm trying to get the mapfruitstrigger to work in fs2013, seems to have a minor problem in the code.

this is the result off the first test ingame, seems that it could not contact the pricing.
tested on the samplemodmap where i added two new fruits that i want to be able to buy from the trigger like in fs2011.

thx
jengske_BE


mapfruittrigger
ingame shown press R to fill, but no countdown on the budget
log error
D:/Code/Giants/lsim2013/build/finalbin/dataS/scripts/FruitUtil.lua(61) : attempt to index local 'desc' (a nil value)

Error: LUA running function 'update'
C:/Documents and Settings/dpeeters/Mijn documenten/My Games/FarmingSimulator2013/mods/MapFruitTrigger/MapFruitTrigger.lua(214) : attempt to perform arithmetic on field 'seedPricePerLiter' (a nil value)


code
if self.sell then
local desc = FruitUtil.fruitIndexToDesc[FruitUtil.fillTypeToFruitType[self.fillType]]

if desc ~= nil then
local price = deltaFillLevel*desc.pricePerLiter; /here is line 214 that gives the error
g_currentMission.missionStats.expensesTotal = g_currentMission.missionStats.expensesTotal + price;
g_currentMission.missionStats.expensesSession = g_currentMission.missionStats.expensesSession + price;
g_currentMission:addSharedMoney(-price);
end;

Marcus H (Xentro) 15.03.2013 18:58
if self.sell then
local desc = Fillable.fillTypeIndexToDesc[self.fillType];
if desc ~= nil then
local delta = deltaFillLevel * desc.pricePerLiter;
-- rest of your script --
end;
end;

That should be work for you.


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