How to spawn actor an actor in a specific location with Spawn Actor Behavior?

Like, what is the formula, what do I do to make it spawn.
I did this:

self.position.x+237.5 (And the same thing for Y but instead of an X and different number!)

But, it wont spawn my actor ):

How do I fix this ): ?????

Best Answer

  • gyroscopegyroscope I am here.Posts: 6,598
    Accepted Answer

    So thinking about it, all that's left: if it works without the attribute condition, in other words, if it spawns as you want, as expected, without game.dead is true, then there's a problem with your attribute changing to true being picked up, somewhere along the line.

    It's still "shooting in the dark" without seeing your other rules, as to why your attribute game.dead isn't changing to true when you want it to, or if it does, why the spawn behaviour isn't triggered by it... unless you're changing game.dead to false immediately after it changes to true...

    OK, that's as far as I can go trying to solve this.... I hope it gets sorted as you want, cheers.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Answers

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @Pyrite First, double-check that an actor spawned in position of the one spawning plus 237.5 both directions actually is within the visible screen area!

    I'm sure that's OK, then make sure that, in the Spawn behaviour, "Relative to:" next to "Position" is set to "scene".

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PyritePyrite Member Posts: 47
    I did this (But it doesn't work) (And thanks!):

    http://gyazo.com/ac87a284e2f49a5c4036cec66dfa785f
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2014

    You're welcome, Pyrite :-) ; though sorry I couldn't solve it... OK, let's try again...

    I see that the spawning is on the condition a certain attribute is true... are you certain that game.dead is being set to true for the spawning to fire?

    But first, I'd take out the Spawn behaviour out of the Rule with the attribute condition - temporarily - and just let it spawn to see if you've got the result you're after...

    -------

    Edit: added..... is the actor where this spawn behaviour is in, moving, or still?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PyritePyrite Member Posts: 47
    It works without game.dead, but game.dead triggers the finally score with display text :/ So, game.dead works for the Final Score to display though
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hang on, let me get this: so it spawns OK as you want without the attribute condition, but not with it (when it's true), yet when it's true it affects, in the way you want, another rule connected with your final score? Sounds very odd...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PyritePyrite Member Posts: 47
    Nvm doesn't work anymore, when i do : if game.playing is true then delete actor (I delete the actor before I spawn it!)
  • PyritePyrite Member Posts: 47
    Ikr,
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2014

    Think I get what you mean: so now you're using the Spawn behaviour then destroying the original actor AFTER... sounds like you've solved your own problem and it's all OK now. :-) Glad it's sorted. B-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PyritePyrite Member Posts: 47
    No, I destroy the actor when the game starts, but when the BEE (in-my-game) dies, I spawn the actor. But, it wont work sadly ): But, thanks
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Oh, OK, then take out that Rule from the actor that's destroyed, and put it into a blank actor at the side of the screen...

    Rule : When attribute game.dead is true
    Spawn actor pos x: your actor.Position.x +237.5 pos y: your actor.Position.y +237.5 relative to scene

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PyritePyrite Member Posts: 47
    It still doesn't spawn the actor
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2014

    Then that leaves at least 3 possibilities of why it's not working as you expect:

    • the attribute game.dead is not being set to true, so its not triggering the spawn,

    • or it is, but the spawned actor is appearing off-screen;

    • or the third possibility is, you've got a change attribute behaviour in the actor to be spawned that changes the alpha to 0 (or you've left a destroy behaviour in the actor to be spawned)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PyritePyrite Member Posts: 47
    Yea, theres a destroy behaviour, shoot
  • PyritePyrite Member Posts: 47
    But, still it doesn't work
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2014

    There's a destroy behaviour in the actor that's spawned? If that's the case, and it fires straight away, without any attribute conditions, it'll destroy itself the moment it's spawned.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PyritePyrite Member Posts: 47
    I made it to only destroy itself when game.dead is false or game.playing is true thought
  • PyritePyrite Member Posts: 47
    Even without any destroy behaviors, it still wont work, and I have no idea why.
Sign In or Register to comment.