Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: LuukArts on November 22, 2017, 11:06:44 AM

Title: All objects collected > Next event - Noobish question [SOLVED]
Post by: LuukArts on November 22, 2017, 11:06:44 AM
Hello all,

I'm new to Playmaker and Unity in general and I'm stuck with a project that needs the following to be done:

Let's say we have a cube, a cillinder and a sphere in a world, if you succeed to collect all of these objects you will go to the next phase.


I've searched for tutorials etc. for this, but not with succes.

My question: How do I make a player go to the next phase only when he collected all objects?

I've found something about arrays, but it's still a bit confusing.

If anyone could help me or point to a tutorial, thanks in advance

Luuk

Title: Re: All objects collected > Next event - Noobish question
Post by: Doh on November 22, 2017, 11:31:43 AM
I'd do this with two arrays, the first would be the required game objects, the second would be an array of the same length, though this time made up of bools. Have them all set to false to begin with, then have an FSM set the correct bool to true upon collection.

When you set the collection bool to true, make sure you first get the index number of the object on the game object array and tick the bool at the same index number of the bool array.

Hope that helps!
Title: Re: All objects collected > Next event - Noobish question
Post by: Doh on November 22, 2017, 11:44:47 AM
Forgot to add, each time one of the object from the array is picked up and the bool is set to true, I'd do a "Bool All True" check, if it passes then you can do whatever you want to alert other aspects of your game that the task is complete.
Title: Re: All objects collected > Next event - Noobish question
Post by: LuukArts on November 22, 2017, 02:42:27 PM
Nice!

I'll try this, thanks a lot!
Will keep this up to date if it worked :)

Title: Re: All objects collected > Next event - Noobish question
Post by: LuukArts on November 23, 2017, 01:48:06 AM
Worked like a charm!
Title: Re: All objects collected > Next event - Noobish question [SOLVED]
Post by: Doh on November 23, 2017, 08:48:01 AM
Awesome!  :)