How to replace a graphic inside an array?
Posted: Sun Aug 16, 2020 5:56 pm
Hi,
I want to replace a graphic of a custom tank that has a list (or array) or 3 elements inside the layer element. The first one has the normal png file, the second the shadow and the third one the color mask png file.
How do I replace the first, the second and third element?
Does something like that work?
Thanks for your help!
Edit:
Ok this does not work. It says error in lua line 1 nil value.
Edit 2:
I could resolve all errors, but the graphics are still the same. I have now this line of code:
I doublechecked the path which is correct. The mod in general works also because the remnant is correct replaced, it seems that I only dont know how to specify a special element in the array.
I want to replace a graphic of a custom tank that has a list (or array) or 3 elements inside the layer element. The first one has the normal png file, the second the shadow and the third one the color mask png file.
How do I replace the first, the second and third element?
Does something like that work?
Code: Select all
data.raw.car["tank_name"].animation.layers[0].stripes.filename = "new path to base png"
Code: Select all
data.raw.car["tank_name"].animation.layers[1].stripes.filename = "new path to shadow png"
Code: Select all
data.raw.car["tank_name"].animation.layers[2].stripes.filename = "new path to mask png"
Edit:
Ok this does not work. It says error in lua line 1 nil value.
Edit 2:
I could resolve all errors, but the graphics are still the same. I have now this line of code:
Code: Select all
data.raw.car["kr-advanced-tank"].animation.layers[1].stripes[1].filename = "__KrastorioTankGraphics__/graphics/entities/advanced-tank/advanced-tank-base.png"