Page 1 of 1

unit creating entities raising on_trigger_created_entity

Posted: Mon Apr 11, 2016 1:48 pm
by StanFear
it is possible to create entities when a unit is atacking using something like that :

Code: Select all

attack_parameters =
    {
      type = "beam",
      ammo_category = "laying-explosives",
      cooldown = 100,
      range = 0,
      ammo_type =
      {
        category = "laying-explosives",
        action =
        {
          type = "direct",
          action_delivery =
          {
            type = "instant",
            target_effects =
            {
              type = "create-entity",
              entity_name = "layed-explosives",
              offsets = {{0, 0}},
              trigger_createdentity="true",
            }
          }
        }
      },
      animation = biterattackanimation(mediumbiterscale, medium_biter_tint1, medium_biter_tint2)
    },
the thing is, it doesn't seem to raise the on_trigger_created_entity event ...

linked, a small mod that shows the event is never triggered. (just create a new game, place a building, the bitter will attack it)

Re: unit creating entities raising on_trigger_created_entity

Posted: Tue Apr 12, 2016 8:43 pm
by Adil
Disregard this post.

Re: unit creating entities raising on_trigger_created_entity

Posted: Tue Apr 12, 2016 8:52 pm
by Adil
Your example code actually is missing trigger_created entity, it should be placed here:

Code: Select all

              type = "create-entity",
              entity_name = "roboport",
              offsets = {{0, 0}},
              trigger_created_entity=true,

Re: unit creating entities raising on_trigger_created_entity

Posted: Wed Apr 13, 2016 6:33 am
by StanFear
well, then, the problem lies in the documentation, where the param is sais to be trigger_createdentity and not trigger_created_entity

http://lua-api.factorio.com/0.12.30/eve ... ted_entity


and yes, I just realised I didn't put it in the exemple mod, don't know why ...
in my test, I had trigger_createdentity="true" after the position...

Re: unit creating entities raising on_trigger_created_entity

Posted: Wed Apr 13, 2016 6:58 am
by Supercheese
StanFear wrote:well, then, the problem lies in the documentation, where the param is sais to be trigger_createdentity and not trigger_created_entity

http://lua-api.factorio.com/0.12.30/eve ... ted_entity


and yes, I just realised I didn't put it in the exemple mod, don't know why ...
in my test, I had trigger_createdentity="true" after the position...
That's a bug in the documentation, make a bug report.