Page 1 of 1

I want to replace some images

Posted: Sat Mar 22, 2025 4:51 pm
by HACHAPURY
I want to replace fish related sprites (items, achievemnts, technologies) with new ones. I tried to do it myself for 2 hours but failed to write a code. What is wrong in here? Game doesnt show any errors after installing. And images are still not replaced.

require("global")

for set in each(data.raw.item, data.raw.achievement, data.raw.technology, data.raw.recipe) do
for old, new in pairs({
["/so-long-and-thanks-for-all-the-fish.png"] = "achievement/so-long-and-thanks-for-all-the-fish.png",
["/todays-fish-is-trout-a-la-creme.png"] = "achievement/todays-fish-is-trout-a-la-creme.png",
["/fish.png"] = "icons/fish.png",
["/fish-entity.png"] = "icons/fish-entity.png",
["/fish-breeding.png"] = "icons/fish-breeding.png",
["/fish-breeding.png"] = "technology/fish-breeding.png",
}) do
for key, value in wherehas(set, "achievement", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.achievement, "with", "__lamia-lost-lullaby__/graphics/achievement/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/achievement/" .. new
for key, value in wherehas(set, "icon", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.icon, "with", "__lamia-lost-lullaby__/graphics/icons/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/icons/" .. new
for key, value in wherehas(set, "technology", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.technology, "with", "__lamia-lost-lullaby__/graphics/technology/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/technology/" .. new
end
end
end
end
end

Re: I want to replace some images

Posted: Tue Mar 25, 2025 11:11 am
by Natha
I don't see where you are writing the modified values into the data.raw table