Artillery sound enhancer

by yohannc

Add multiple sounds for artillery depending on distance (based on vanilla).

Content
2 years ago
1.1
4.68K
Combat

b Error together with True Nukes mod

2 years ago

Hello, I got this error after updating to the latest true nukes mod

https://imgur.com/a/67QOFdy

2 years ago
(updated 2 years ago)

The issue is because I'm using final_action instead of action to put my effects into.
To fix this, I'd guess the replacement code for those lines would be:

    if(projectile_value.action ==nil) then
        projectile_value.action = {action_delivery = {target_effects = {}}}
        local target_effects = projectile_value.action.action_delivery.target_effects

        if projectile_index:find("atomic") then
            table.insert(target_effects, effect_trigger_nuke_mod)
        else
            table.insert(target_effects, effect_trigger_explosion_mod)
        end
    elseif projectile_value.action.action_delivery ~= nil then --if one delivery, add an effect

Although I haven't tested that.

2 years ago

where exactly do I put that code?

the whole section looks like this

for projectile_index,projectile_value in pairs(data.raw["artillery-projectile"]) do
if projectile_index == "artillery-projectile" then
local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
table.insert(target_effects, effect_trigger_explosion)
else
if projectile_value.action.action_delivery ~= nil then --if one delivery, add an effect
local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
else --if multiple delivery, add an effect on the first one
local act;
_,act = next(projectile_value.action)
local target_effects = act.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
end
end
end

2 years ago

for projectile_index,projectile_value in pairs(data.raw["artillery-projectile"]) do
if projectile_index == "artillery-projectile" then
local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
table.insert(target_effects, effect_trigger_explosion)
else
if(projectile_value.action ==nil) then
projectile_value.action = {action_delivery = {target_effects = {}}}
local target_effects = projectile_value.action.action_delivery.target_effects

    if projectile_index:find("atomic") then
        table.insert(target_effects, effect_trigger_nuke_mod)
    else
        table.insert(target_effects, effect_trigger_explosion_mod)
    end
elseif projectile_value.action.action_delivery ~= nil then --if one delivery, add an effect

local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
else --if multiple delivery, add an effect on the first one
local act;
_,act = next(projectile_value.action)
local target_effects = act.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
end
end
end

2 years ago

Is my guess, although I can't say precisely

2 years ago

thank you btw for helping out!

So I tried that and am getting this error now
https://imgur.com/NTdFXZO

2 years ago

Yes, of course - I didn't actually check whether this was working. Try this:

2 years ago

for projectile_index,projectile_value in pairs(data.raw["artillery-projectile"]) do
if projectile_index == "artillery-projectile" then
local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
table.insert(target_effects, effect_trigger_explosion)
else
if(projectile_value.action ==nil) then
projectile_value.action = {type = "direct", action_delivery = {type = "instant", target_effects = {}}}
local target_effects = projectile_value.action.action_delivery.target_effects

if projectile_index:find("atomic") then
    table.insert(target_effects, effect_trigger_nuke_mod)
else
    table.insert(target_effects, effect_trigger_explosion_mod)
end

elseif projectile_value.action.action_delivery ~= nil then --if one delivery, add an effect

local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
else --if multiple delivery, add an effect on the first one
local act;
_,act = next(projectile_value.action)
local target_effects = act.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
end
end
end

2 years ago

The only difference being:
projectile_value.action = {type = "direct", action_delivery = {type = "instant", target_effects = {}}}

2 years ago

That seems to be working now thank you a lot

1 year, 8 months ago

i dont get it

i did paste this: projectile_value.action = {type = "direct", action_delivery = {type = "instant", target_effects = {}}}

where this was: projectile_value.action.action_delivery ~= nil then
but then i get another error. i have no idea how to mod/code can you please help me or update your mod so it does not crash when using it with true nukes.

1 year, 8 months ago

Hi!
Unfortunately, I'm not the mod owner, and don't really want to clone the whole mod and such. The specific thing you want to do is replace the lines 52-78 with the comment I made before. That is replace:

for projectile_index,projectile_value in pairs(data.raw["artillery-projectile"]) do
if projectile_index == "artillery-projectile" then
local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
table.insert(target_effects, effect_trigger_explosion)
else
if projectile_value.action.action_delivery ~= nil then --if one delivery, add an effect
local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
else --if multiple delivery, add an effect on the first one
local act;
_,act = next(projectile_value.action)
local target_effects = act.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
end
end
end

1 year, 8 months ago

With:

1 year, 8 months ago

for projectile_index,projectile_value in pairs(data.raw["artillery-projectile"]) do
if projectile_index == "artillery-projectile" then
local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
table.insert(target_effects, effect_trigger_explosion)
else
if(projectile_value.action ==nil) then
projectile_value.action = {type = "direct", action_delivery = {type = "instant", target_effects = {}}}
local target_effects = projectile_value.action.action_delivery.target_effects

if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end

elseif projectile_value.action.action_delivery ~= nil then --if one delivery, add an effect

local target_effects = projectile_value.action.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
else --if multiple delivery, add an effect on the first one
local act;
_,act = next(projectile_value.action)
local target_effects = act.action_delivery.target_effects
ensure_table_is_list(target_effects)
if projectile_index:find("atomic") then
table.insert(target_effects, effect_trigger_nuke_mod)
else
table.insert(target_effects, effect_trigger_explosion_mod)
end
end
end
end

1 year, 8 months ago

To get to the file in question, unzip the mod and edit the file called "data-final-fixes.lua"

1 year, 8 months ago
(updated 1 year, 8 months ago)

it looks like this now https://imgur.com/a/DBnvCIF is it right like this?

1 year, 8 months ago

Yeah, should be. Try running it now.

1 year, 8 months ago

it works now thank you <3

1 year, 8 months ago

No problem!

9 months ago

Any chance to have this actually updated in the mod?

New response