SPAWN WHEN IT IS DESTROYED?

EminemEminem Member Posts: 667
edited November -1 in Working with GS (Mac)
Hi!

I am trying to spawn an actor when destroyed so what i am doing is setting a timer after 2 sec spawn at 0,0 i want it to spawn at the exact place it is destroyed but im not sure what im doing wrong?

anyone know

Thanks in Advance

Comments

  • EminemEminem Member Posts: 667
    jonmulcahy said:
    well, what's not working?

    its not spawning
  • EminemEminem Member Posts: 667
    Cardinal said:
    If you want to spawn when the actor is destroyed do this:

    Create 1 attribute boolean:

    Rule:
    When All
    Attribute: game.actorkill is true
    Spawn actor:
    0,0

    Rule:
    When All
    Attribute: game.actorkill is true
    Change Attribute: game.actorkill to false

    With that every time the attribute actorkill is true will spawn the actor in position at 0,0 but you need to trigger the action with something like a button or score.

    I hope I helped you. Because that's what I understood from your question.

    Thanks cardinal but its still not working, wat it does is it spawns on top of another thing, because there are more then one of the same actors
  • dinorepairdinorepair Member Posts: 22
    at 0.0 set alpha color to 0 and spawn what you want
    at 0.1 destroy
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    so when you click on the actor, it destroys and then doesn't respawn?

    Try this, on the actor itself, do something like this:

    on touch
    timer - after 2 seconds spawn newActor (make sure run to completion is checked)
    timer - after .1 seconds destroy

    this will give the spawn actor enough time to kick off.
  • EminemEminem Member Posts: 667
    hi jonmulchay ok so i followed your instructions and still not working but when i do this

    timer - after 2 seconds spawn newActor (make sure run to completion is checked)
    timer - after 3 seconds destroy

    it works! but i want it to immediatly i think this is because it needs the actor active in order to spawn
  • ChaserChaser Member Posts: 1,453
    Your trying to make an actor that just got destroyed spawn itself? You will at times find it doesn't work
    Like others said create an attribute and a spawner actor so that secondary actor controls the spawn time and location of the destroyed actors current location xy
  • EminemEminem Member Posts: 667
    Hi everyone thanks for your support , ive decided it would be better to spawn randomly but i have a screen of 1024 X 820 do you know what the cordinates should be?
  • RHRH Member Posts: 1,079
    You're trying to use a rule on an actor that doesn't exist, thats why.

    Just set the alpha to 0 and disable all rules on it (other than the spawn and destory), after 2 seconds spawn actor 0,0 relative to actor and destroy.
  • EminemEminem Member Posts: 667
    Hi rh thanks for the response this is what I need but idk how to disable the rules, do I use an attribute?
  • RHRH Member Posts: 1,079
    Just create a self. attribute (i.e. self.destroyed) and where you have the normal destroy behaviour replace it with change self.destroyed to true (use a boolean) and change self.alpha to 0. In all the rules on the actor except the timer with spawn new actor and destroy put a rule around them that when self.destroyed is false do X.
  • EminemEminem Member Posts: 667
    OMG! THANK YOU SO MUCH! IT WORKED! DUDE YOU ROCK! YOU SAVED ME HOURS OF WORK ,

    THANK YOU EVERYONE FOR LETTING ME FIGURE THIS OUT!

    THANK YOU

    -RH
    -COWTECHMAN
    -CHASER
    -JONMULCHAY
    -PSARTORIO
    -CHARDINAL

    THANK U ALL!
  • RHRH Member Posts: 1,079
    Heh, you're welcome.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
  • design219design219 Member Posts: 2,273
    Can't you also just check "run to completion" on the spawn timer? Wouldn't that finish the rule even if the actor is destroyed?
Sign In or Register to comment.