Community Forum

LUA error method 'update'.

Forum Overview >> Scripting

CategoryScripting
Created08.05.2020 10:31


Darkhayzz (looool) 08.05.2020 10:31
Hi, i have a big problem on my map ! I'm a french mapper so sorry for my bad english.

I have the Error : Running LUA method 'update'.
2020-05-08 10:10 dataS/scripts/placeables/Placeable.lua(1094) : attempt to index local 'storeItem' (a nil value)

This Error is for my husbandryCowLarge, husbandryChickenLarge, husbandryPigLarge,farmSilo and Bunker Silo.

First, i think the error come from my placeable, so i have recreate a husbandryCowLarge placeable and a have take a new

sample. I have take the same file pathes for the defaultItem and the modDesc. So when i start a game, the placeable

is on the map, i can buy a cow. But when a save the game and i restart the game, i dont have any error in the log and the

cow have stay. But when i buy a cars, tractor etc.... and i save and restart the game, i have the error in my log and the

cow have disapear.


Can you help me ? If you want more information, ask me.

Bilbo Beutlin (BBeutlin) 08.05.2020 22:04
You must declare additional items
- either in the modDesc.xml section <storeItems>
- or in the dedicated file linked by the map.xml <storeItems filename=..

Darkhayzz (looool) 09.05.2020 09:37
I have already declare my placeable, but i take for example the EstanciaLapacho and in the map.xml i dont found the <storeitem filename= ... > So in the map.xml.

But what is the difference with mapBoundID and className ? Because in my defaultItem i have only " mapBoundId " like :

<item mapBoundId="husbandryCowLarge" className="AnimalHusbandry" filename="$moddir$FS19_LaCampagneNormande/maps/placeables/animals/vache/husbandryCowLarge.xml" position="0 0 0" rotation="0 0 0" defaultFarmProperty="true" farmId="1"/>



Bilbo Beutlin (BBeutlin) 09.05.2020 13:30
Like I said: one can use both ways alternatively, <storeItems> in "modDesc.xml" or in an explicite storeItems file.

The declaration of 'className' is always required, since it determines the type of placeable and associated LUA script.

'mapBoundId' defines that a placeable is placed on a map directly, and with a unique ID.
(see https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=66&class=10359#new164115 )

The code in Placeable.lua line 1094 is:
maxVehicleAge = storeItem.lifetime
The error is caused by undefined 'storeItem'. So there is something missing or wrong in your <storeItems> declarations.

Darkhayzz (looool) 09.05.2020 16:35

In my modDesc i have this line : <storeItem xmlFilename="maps/placeables/animals/vache/husbandryCowLarge.xml" />

and in my defaultitems i have this :

<item className="AnimalHusbandry" filename="$moddir$FS19_LaCampagneNormande/maps/placeables/animals/vache/husbandryCowLarge.xml" position="0 0 0" rotation="0 0 0" defaultFarmProperty="false" farmId="1" />

The StoreItem has to be definied in the map.xml?

Bilbo Beutlin (BBeutlin) 09.05.2020 23:09
You can read, can't you? I have written two times where to declare the storeItems.

Beneath you shouldn't use the path filename="$moddir$MODNAME/.. anymore if the item is component of the map. Use filename="$mapdir$/.. instead.

Concerning your husbandry.xml:
Check the xml by comparing with a default husbandry.xml. Maybe there's something missing or wrong, so the item is not registered properly in store.
Also look into the game log for errors/warnings related to the husbandry.

Darkhayzz (looool) 12.05.2020 11:41
My Husandry.xml is correct. I dont have any error in the log when i buy cows.

Bilbo Beutlin (BBeutlin) 12.05.2020 16:16
If it was correct, you won't get errors.

Robsicky 17.08.2020 14:23
Yikes, I guess Bilbo never was known for his politeness.


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