I want to replace some images

Place to get help with not working mods / modding interface.
HACHAPURY
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Mar 22, 2025 4:44 pm
Contact:

I want to replace some images

Post 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
Natha
Filter Inserter
Filter Inserter
Posts: 259
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: I want to replace some images

Post by Natha »

I don't see where you are writing the modified values into the data.raw table
Post Reply

Return to “Modding help”