Createntity/mine issue

Place to get help with not working mods / modding interface.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Createntity/mine issue

Post by FreeER »

anyone care to explain why this does not work as expected :?:

Code: Select all

    game.onevent(defines.events.onentitydied, function(event)
        if event.entity.name == "trigger-mine" then
                game.createentity{name="land-mine",position={event.entity.position.x,event.entity.position.y-1},force=player}
                game.createentity{name="land-mine",position={event.entity.position.x,event.entity.position.y+1},force=player}
                game.createentity{name="land-mine",position={event.entity.position.x-1,event.entity.position.y},force=player}
                game.createentity{name="land-mine",position={event.entity.position.x+1,event.entity.position.y},force=player}
        end
     end
     )
Should be fairly obvious that I created a new mine that is suppose to deploy regular land-mines around it when it explodes...only issues are that it only works if the creepers hit it before 'setting' and then when it does work the newly spawned mines seem to be on the enemy's force (ie, they become invisible and if you walk over where they were they explode :lol: )
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Createntity/mine issue

Post by rk84 »

Is player refering to "game.player"? If so add "player.force" to it.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Createntity/mine issue

Post by FreeER »

ah ha, well that solves half of my issue :) thanks, however it still only works before the mine 'sets'. If you place the trigger mine and give it a few seconds it sinks into the ground, at which point it acts like a regular mine (ie, does not spawn land-mines when it explodes)...Does the entity name change to trigger-mine-set or something lol

edit: I noticed that there are two explosions, one for blow_off_explosion and one for dying_explosion, is it possible that the dying explosion is caused when the entity 'dies' (aka, explodes before the mine is 'set') and the blow_off_explosion is for after the mine is 'set' but does not create the onentitydied event?
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Createntity/mine issue

Post by rk84 »

yea onentitydied triggers when entity run out of health. Not by mine explosion.

you can spread them by shooting them. :lol:

I changed my cluster mine to work on build event.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Createntity/mine issue

Post by FreeER »

rk84 wrote:yea onentitydied triggers when entity run out of health. Not by mine explosion.
you can spread them by shooting them. :lol:
I changed my cluster mine to work on build event.
LOL I was hoping to do something a bit more original but...oh well
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
Post Reply

Return to “Modding help”