Point attack artillery

Place to get help with not working mods / modding interface.
Post Reply
sore68
Fast Inserter
Fast Inserter
Posts: 123
Joined: Mon May 02, 2016 8:39 am
Contact:

Point attack artillery

Post by sore68 »

Hi everyone~

I making mod Additional-turret and It was recently added to the 2 type artillery.
viewtopic.php?f=93&t=30865

I make near spawner scan code and I think I'll use it when appropriate.

Code: Select all

/c local p = game.player.surface.find_entities_filtered({area = {{x = game.player.position.x - 100, y = game.player.position.y - 100}, {x = game.player.position.x + 100, y = game.player.position.y + 100}}, type = "unit-spawner"}) game.player.print(p.position.x.." "..p.position.y)
but I don't know how the turret attack that position.

Can you help me?? or tell me a website that can help me??


and have a question
http://lua-api.factorio.com/latest/defi ... d.compound
how to use defines codes??

Sorry my English skill... thank you!

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Point attack artillery

Post by aubergine18 »

Using find_entities_filtered() is quite slow if it's done over large area and regularly, which I think will happen in your mod.

It might be better to use events instead, have a look at the Fire Extinguisher mod to see how that works - I think you'll be able to adapt that code to what you want: https://mods.factorio.com/mods/devilwar ... tinguisher
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Point attack artillery

Post by Adil »

You can't make turret just attack. You either make it ridiculously long-range, then it will aggro biters by shooting at them, or you use scripts to create projectiles and\or simulate the impact, then biters will just ignore the fact of being shot.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

sore68
Fast Inserter
Fast Inserter
Posts: 123
Joined: Mon May 02, 2016 8:39 am
Contact:

Re: Point attack artillery

Post by sore68 »

Have a some different question

I finally did it. make projectiles with surface.create_entity!
But This code is not support "type = stream" projectiles (it is used fluid-turret ammo entity and I using this entity in artillery shell)
And If I use stream projectile, It is recognized in "type = beam".. :|

What other way do not use surface.create_entity??

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Point attack artillery

Post by aubergine18 »

I've not tested, but maybe a stream will work similar to a beam? viewtopic.php?p=205338#p205338
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Post Reply

Return to “Modding help”