shooting events

Place to get help with not working mods / modding interface.
Post Reply
lux
Inserter
Inserter
Posts: 25
Joined: Fri Nov 07, 2014 7:40 pm
Contact:

shooting events

Post by lux »

Does anyone know if there are any lua events related to shooting? or being shot?

I am trying to modify friendly-fire damage values. The initial word on IRC was this was not possible, but wanted to confirm.

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

Re: shooting events

Post by aubergine18 »

You'd have to check specific entities during on_tick handler which would be very show.

However, there's perhaps another way to do it - when things are shot, does it create remnants? If so, does their creation trigger the entity creation events?

You could look at the Fire Extinguisher mod in mod portal - that works in similar way.
Last edited by aubergine18 on Sat Sep 17, 2016 6:13 pm, edited 1 time in total.
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
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: shooting events

Post by aubergine18 »

from extinguisher mod:

Code: Select all

local function extinguish_fire(event)
  if event.entity.name == 'extinguisher-remnants' then
     -- you at least know where shots landed
  end
end

script.on_event(defines.events.on_trigger_created_entity, extinguish_fire)
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”