Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: HeathClose on November 20, 2016, 09:35:20 AM

Title: Random Scenery Generator[SOLVED]
Post by: HeathClose on November 20, 2016, 09:35:20 AM
I'm trying to place a prefab game object (scenery picker) in the scene that chooses a random prefab from a list (scenery), then spawns that scenery at the pickers location... I'm almost certain I have this set up correctly, but the scenery doesn't spawn at the pickers location... it ALWAYS spawn at 0,0,0

I have tried using both spawn at (picker) and spawn at position (get parent, get position, store v3) and both


Title: Re: Random Scenery Generator
Post by: mdotstrange on November 20, 2016, 09:38:34 AM
It might be because the "get position" is running before the "get parent" which would get the position of a null which would be 0,0,0-

Try making that state an "action sequence" by right clicking in the state window then selecting it- that will make the actions run in order from top down
Title: Re: Random Scenery Generator
Post by: Xenocalypse on November 20, 2016, 10:40:28 AM
Hello, i had the same Problem...in my last solution i used a Custom Action from the Eco System. Create Object Advanced. This is the all in One Solution where you create an Object, Parent it and create at specific place. Maybe this one helps you, too.

regards Xeno
Title: Re: Random Scenery Generator
Post by: HeathClose on November 20, 2016, 12:13:58 PM
thank you for the replies...

mdot, i tried making it a sequence... no good... until i changed one thing...

xeno, i tried the advanced object and it worked after I changed one thing...

my bad guys... i was using get parent...  I should have been using get owner...

that's the one thing I changed and now it works as designed... scenery is spawned at the owner's position


however, this does raise a learning question... because I was using this on the parent object it can't return itself as the parent?  I guess that's why get owner exists?
Title: Re: Random Scenery Generator
Post by: terri on November 20, 2016, 05:23:56 PM
however, this does raise a learning question... because I was using this on the parent object it can't return itself as the parent?  I guess that's why get owner exists?

yeah I believe it won't return itself as a parent, which makes sense since its not its own parent

I mostly use get owner in templates, where you can't reference the fsm's owner as a variable

you can also try get root in some cases, it will give you the topmost parent and in this case it will return itself if needed