Community Forum

Why is my storage shared between multiple placeables?

Forum Overview >> Farming Simulator 17

CategoryFarming Simulator 17
Created26.01.2017 23:09

Tim Derks (timmiej93) 26.01.2017 23:14
I'm creating a placeable that has a fillTrigger, which takes from its own Storage when filling.

Everything works fine, as long as I only place one instance of my mod. As soon as I place a second one, both fillTriggers take from the Storage from the instance that was placed later on. No matter at which instance I fill my tool, it only reduces the fillLevel in the Storage of the second one. What can be the cause of this?

Bilbo Beutlin (BBeutlin) 27.01.2017 03:32
Are you using the standard fillTrigger or your mod'ed one which you described in an earlier thread?
"So I have my own Lua script for a placeable, which includes filltriggers."

Looks for me, you have bad LUA code.

Tim Derks (timmiej93) 27.01.2017 09:46
I am now using my own, custom code. However, this also happened when I used the normal Storage object, and had overridden the FillTrigger:fill method to deduct the delta from the storage (delta is normally used to calculate the price of the stuff you filled).

I basically have 3 classes now: MyMod, MyMod_FillTrigger and MyMod_Storage.
What would be the best method of passing the Storage object from MyMod (where it's created and loaded) to the FillTrigger?


I think I found out why this is happening. When I print the "self" value in the load function of the FillTrigger, the table ID (0x... number) is the same for every FillTrigger that gets created. How can I make sure that FillTrigger:new creates a new instance every time?

Tim Derks (timmiej93) 27.01.2017 14:11
After the edit of my last post, I figured out a workaround/fix. It's probably not the best, but it works.

Looking at FillTrigger:new in the LUADOCS (, it doesn't create anything by itself, which is probably why it always is the same table ID number. I simply added "local self = Object:new(isServer, isClient, mt);" at line 34 (line 34 on the LUADOC page that is). I don't think it really matters where it is, as long as it's BEFORE anything that has "self.RANDOMNAME = ....".

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