Community Forum

FillTypeManager:addFillType debugging

Forum Overview >> Scripting

Created26.12.2021 20:02

Philippe S (PhilOfGaming) 26.12.2021 20:02
Hello i tried to add a filltype in FS22 its the first time. I think i figured everything out how it works.Its a pretty simple programm but normaly it should work.

local modDir = g_currentModDirectory

FillTypeManager:addFillType("chips", "chips", true, 500, 5, 0, "", modDir, nil, nil, nil --[[Liter]], nil --[[Palette.xml]], {1, 2, 1, 0.5, 1, 1, 1, 1, 1,1,1,1}, nil, nil, nil, nil, nil, nil, nil, nil, false)

but when i load a world there is an error massage in the log.txt

2021-12-26 19:46 Load mod: testLuaMod
2021-12-26 19:46 Error: dataS/scripts/misc/FillTypeManager.lua(324) : attempt to index field 'nameToFillType' (a nil value)

it looks like either one of my strings is false or something in the code of the function is false.

local fillType = self.nameToFillType[name]

^^ thats the line containing the error so i think eiter my string "name" is wrong(the string name is the first string of the function) or the developers of giants maybe have an error in the script.

Maybe someone with more experience in lua and modding with FS22 can help me with my problem here.

Dennis Schmitt (Peppie) 28.12.2021 14:05
Hi Philippe, did you tried to use the `g_fillTypeManager` global variable instead to use the class name `FillTypeManager`?

Philippe S (PhilOfGaming) 28.12.2021 14:58
Nice ok with the global variable it worked thanks man :D

theEvil007 02.01.2022 17:19
Hi Philippe,

do you have a working script that adds a new filltype and this one is accepted by production point or selling station?

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