Add multiple sounds for artillery depending on distance (based on vanilla).
Mods introducing new content into the game.
Hello, I got this error after updating to the latest true nukes mod
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.
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
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
Is my guess, although I can't say precisely
thank you btw for helping out!
So I tried that and am getting this error now
https://imgur.com/NTdFXZO
Yes, of course - I didn't actually check whether this was working. Try 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 ==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
The only difference being:
projectile_value.action = {type = "direct", action_delivery = {type = "instant", target_effects = {}}}
That seems to be working now thank you a lot
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.
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
With:
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
To get to the file in question, unzip the mod and edit the file called "data-final-fixes.lua"
it looks like this now https://imgur.com/a/DBnvCIF is it right like this?
Yeah, should be. Try running it now.
it works now thank you <3
No problem!
Any chance to have this actually updated in the mod?