Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: vonpixel on December 28, 2012, 02:53:20 PM

Title: A little help with a spawning system[SOLVED]
Post by: vonpixel on December 28, 2012, 02:53:20 PM
Hello!

I'm pretty much a rookie at this. Using playmaker and 2dtk.

In my game I need a waves of customers to appear over time. I have a customer prefab that works well. If I just put 1 in the scene, he will roll a % and decide to buy or not. Which is all i need at the moment. I have a simple fsm set up to have them wander away if they dont buy.

So now I want to set up a spawning system that will look for the appropriate bg to spawn on and spawn a customer. I have a manager set up that basically just waits X time then sends a finished event to the next state and creates a customer prefab game object. Then a send event back to the waiting event. Everything works well the first time, but as soon as the customer starts spawning, it spawns hordes of them.

The event still travels back to my wait X mechanic. But customers keep spawning.

Am I going about this in the right way?

Should the spawning mechanic be something that exists and then destroys its self over and over?

Any insight would be appreciated!

Title: Re: A little help with a spawning system
Post by: vonpixel on December 28, 2012, 03:00:46 PM
You know. Sometimes its the simplest thing.

I didn't realize, but I had added a create object to my customer prefab... so.. oops. Mistakes happen.

Either way, I still have questions about engineering a spawn system. Is there a way to get my objects to create at a random spot on a defined object?
Title: Re: A little help with a spawning system
Post by: kiriri on December 28, 2012, 04:05:52 PM
random point on a gameObject can be done just by using GetVertexCount, RandomInt and GetVertexPosition.
I don't quite remember if those actions are default actions, if they aren't they should be somewhere on the forum.