[solved] Homing projectiles problem

Place to get help with not working mods / modding interface.
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

[solved] Homing projectiles problem

Post by apriori »

How to avoid projectiles from spitters and worms? If I teleport an entity away from enemy's attack range, their "bullets" still persecute entity. How to make them miss an entity?
Last edited by apriori on Thu Aug 25, 2016 9:15 am, edited 1 time in total.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: Homing projectiles problem

Post by Supercheese »

Hmm... temporarily set the entity to destructible = false?
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Homing projectiles problem

Post by Nexela »

Total assumption here but if projectiles are entities destroy the projectile entity if it gets too close to the target entity?
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: Homing projectiles problem

Post by apriori »

Do you guys answer my question or you ask your own ones? :lol: Each "answer" ends with question mark.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Homing projectiles problem

Post by Nexela »

apriori wrote:Do you guys answer my question or you ask your own ones? :lol: Each "answer" ends with question mark.
both.. Maybe?

:)
BlakeMW
Filter Inserter
Filter Inserter
Posts: 992
Joined: Thu Jan 21, 2016 9:29 am
Contact:

Re: Homing projectiles problem

Post by BlakeMW »

There's a bulldozer mod which has a bulldozer blade which "eats" projectiles, might be useful.
apriori
Filter Inserter
Filter Inserter
Posts: 282
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: Homing projectiles problem

Post by apriori »

BlakeMW wrote:There's a bulldozer mod which has a bulldozer blade which "eats" projectiles, might be useful.
Nexela wrote:Total assumption here but if projectiles are entities destroy the projectile entity if it gets too close to the target entity?
Yes, it's entities.

Code: Select all

blockprojectiles = function(self,pos, area)
    for _, entity in ipairs(game.surfaces[1].find_entities_filtered{area = area, name="acid-projectile-purple"}) do
      entity.destroy()
    end
  end
Thanks.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.
Post Reply

Return to “Modding help”