How to spawn actor an actor in a specific location with Spawn Actor Behavior?
Pyrite
Member Posts: 47
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 ): ?????
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
-
gyroscope I am here.Posts: 6,598
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
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
http://gyazo.com/ac87a284e2f49a5c4036cec66dfa785f
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
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
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
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
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
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