can I make a technology for the AOE of Shell?

Place to get help with not working mods / modding interface.
seolisky
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Nov 06, 2020 6:15 pm
Contact:

can I make a technology for the AOE of Shell?

Post by seolisky »

I try to make a Mod for Artillery shell, And i did it for damage, thanks to ammo-damage modifier. but I couldn't find Area of effect modifier or even solution of increasing things... can't I get solution for it?

now I can modify the A.O.E. for startup option, but I still don't know how to increase it by technology.. please help me :)
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: can I make a technology for the AOE of Shell?

Post by NotRexButCaesar »

you could spawn multiple small shells and move them outward/add more for a larger radius.
Last edited by NotRexButCaesar on Sat Nov 07, 2020 3:16 am, edited 1 time in total.
—Crevez, chiens, si vous n'étes pas contents!
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: can I make a technology for the AOE of Shell?

Post by Deadlock989 »

seolisky wrote: Fri Nov 06, 2020 6:27 pm I try to make a Mod for Artillery shell, And i did it for damage, thanks to ammo-damage modifier. but I couldn't find Area of effect modifier or even solution of increasing things... can't I get solution for it?

now I can modify the A.O.E. for startup option, but I still don't know how to increase it by technology.. please help me :)
If you are asking if there is a technology effect that increases the size of projectile AOE effects, the answer is no, there isn't. The full list of built-in effects is here. Projectile parameters aren't accessible at runtime so there is no way to change them in the control stage.

The only thing I can think of is giving the projectile a large AOE and then process the things struck by it in a scripted ScriptTriggerEffectItem and handling it in on_script_trigger_effect - e.g. ignoring things that are too far away from the source_position. You could then have techs which, if researched, effectively increase the radius in which something actually happens to the targets. But that might get expensive and to be honest I wouldn't touch it with a bargepole.
seolisky
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Nov 06, 2020 6:15 pm
Contact:

Re: can I make a technology for the AOE of Shell?

Post by seolisky »

Deadlock989 wrote: Sat Nov 07, 2020 12:23 am
If you are asking if there is a technology effect that increases the size of projectile AOE effects, the answer is no, there isn't. The full list of built-in effects is here. Projectile parameters aren't accessible at runtime so there is no way to change them in the control stage.

The only thing I can think of is giving the projectile a large AOE and then process the things struck by it in a scripted ScriptTriggerEffectItem and handling it in on_script_trigger_effect - e.g. ignoring things that are too far away from the source_position. You could then have techs which, if researched, effectively increase the radius in which something actually happens to the targets. But that might get expensive and to be honest I wouldn't touch it with a bargepole.
Thanks to your reply, and It sounds very sad...
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: can I make a technology for the AOE of Shell?

Post by Deadlock989 »

Actually I just ran a couple of tests and it's not too painful.

scriptedeffect.jpg
scriptedeffect.jpg (748.28 KiB) Viewed 1112 times

This replaces the entire artillery shell effect with this action:

Code: Select all

data.raw["artillery-projectile"]["artillery-projectile"].action= {
	action_delivery = {
		target_effects = {
			{
				type = "script",
				effect_id = "artillery-test",
			},
		},
		type = "instant"
	},
	type = "direct",
}
And then for your event:

Code: Select all

script.on_event(defines.events.on_script_trigger_effect, function(event)
	if event.effect_id == "artillery-test" then
		local surface = game.surfaces[event.surface_index]
		for _,entity in pairs(surface.find_entities_filtered{force="enemy", radius = 10, position = event.target_position}) do
                        -- whatever
		end
	end
end)
So it's not an AOE effect at all but just strikes a location. This shows up in the on_script_trigger_effect as a target position. (If instead you ran the script on every entity in an area effect, you don't necessarily know where the shell landed.) Searching an area radius 10 (you would modify this depending on the technology level esearched) around where the shell lands and filtering only for enemy force, with shells being fired about once every 2 seconds, I was seeing something like an additional 0.003s load on UPS. You could maybe reduce that with better filtering and of course it depends on what you're doing with all the entities, I had a nasty full distance function with math.sqrt which you could easily avoid (just compare squared distances).

I don't know how this would all stack up in a big endgame base with multiple artilleries firing constantly.
seolisky
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Nov 06, 2020 6:15 pm
Contact:

Re: can I make a technology for the AOE of Shell?

Post by seolisky »

Deadlock989 wrote: Sat Nov 07, 2020 2:25 am
So it's not an AOE effect at all but just strikes a location ...
...
I don't know how this would all stack up in a big endgame base with multiple artilleries firing constantly.
Oh! I'm soooooooooo thanks for your code! I'll try it base on your code, and if i find something great to apply then I'll feed back that code! thank you bery much!
Post Reply

Return to “Modding help”