playMaker

Author Topic: [SOLVED] Pick item randomly from group of prefabs to spawn in scene  (Read 2322 times)

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Hello everyone!

I'm making a little game that requires a random object to spawn on click. I already have a good sized library of items to pick from to randomly spawn. My problem is that I am having trouble determining a way to use Playmaker to pick a random item from the library to spawn.

This is what I'm hoping to accomplish and what I've completed:
1.Click box to open (Completed)
2.Play opening animation and particle effect on open (Completed)
3.Pick item randomly from group of prefabs and spawn (what I'm hoping to accomplish)
4.Destroy item after a certain amount of time (Pretty sure I know how to do this)
5.Close box on click (Completed)

Thanks for your time!
« Last Edit: December 17, 2014, 07:01:30 AM by Lane »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pick item randomly from group of prefabs to spawn in scene
« Reply #1 on: December 10, 2014, 02:43:28 PM »
Use Select Random Game Object action and list your objects, then use Create Object to spawn the chose random object, then use the Wait action to wait for x seconds, then use Destroy Self to destroy itself.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Pick item randomly from group of prefabs to spawn in scene
« Reply #2 on: December 10, 2014, 02:48:50 PM »
Wow thank you for the quick reply! I'll try this out as soon as I get home from work and let you know how it goes.

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Pick item randomly from group of prefabs to spawn in scene
« Reply #3 on: December 16, 2014, 05:57:27 PM »
I forgot to reply back. It worked like a charm. Thank you very much!