Page 1 of 1

Createntity/mine issue

Posted: Thu Apr 18, 2013 5:11 am
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: )

Re: Createntity/mine issue

Posted: Thu Apr 18, 2013 5:33 am
by rk84
Is player refering to "game.player"? If so add "player.force" to it.

Re: Createntity/mine issue

Posted: Thu Apr 18, 2013 5:54 am
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?

Re: Createntity/mine issue

Posted: Thu Apr 18, 2013 6:23 am
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.

Re: Createntity/mine issue

Posted: Thu Apr 18, 2013 6:53 am
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