unit creating entities raising on_trigger_created_entity

Things that already exist in the current mod API
Post Reply
User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

unit creating entities raising on_trigger_created_entity

Post 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)
Attachments
unit_trigger_0.0.1.zip
(2.25 KiB) Downloaded 73 times

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

Re: unit creating entities raising on_trigger_created_entity

Post by Adil »

Disregard this post.
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.

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

Re: unit creating entities raising on_trigger_created_entity

Post 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,
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.

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: unit creating entities raising on_trigger_created_entity

Post 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...

Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: unit creating entities raising on_trigger_created_entity

Post 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.

Post Reply

Return to “Already exists”