playMaker

Author Topic: Random Scenery Generator[SOLVED]  (Read 1462 times)

HeathClose

  • Full Member
  • ***
  • Posts: 226
    • View Profile
Random Scenery Generator[SOLVED]
« on: November 20, 2016, 07: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


« Last Edit: November 21, 2016, 12:38:29 AM by jeanfabre »

mdotstrange

  • Hero Member
  • *****
  • Posts: 549
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: Random Scenery Generator
« Reply #1 on: November 20, 2016, 07: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
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Xenocalypse

  • Playmaker Newbie
  • *
  • Posts: 13
    • View Profile
Re: Random Scenery Generator
« Reply #2 on: November 20, 2016, 08: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

HeathClose

  • Full Member
  • ***
  • Posts: 226
    • View Profile
Re: Random Scenery Generator
« Reply #3 on: November 20, 2016, 10:13:58 AM »
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?

terri

  • Sr. Member
  • ****
  • Posts: 373
    • View Profile
    • terrivellmann.tumblr.com
Re: Random Scenery Generator
« Reply #4 on: November 20, 2016, 03: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