Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: shamo on September 20, 2018, 06:39:49 PM

Title: Array Compare
Post by: shamo on September 20, 2018, 06:39:49 PM
Hi, need some help with the array setup. I have a pick and match game, using arrays to store and retrieve game objects. I had problems with (clone) added to instantiated objects but got around that using string instead.
Seems the 'Compare Array' gets befuddled with the names a bit too. Also, it will only recognize the exact sequence. Also, even though I have the 'Array get random' set to no repeat, it still throws out duplicates. There are some solutions on the Ecosystem, but most won't run on Unity 2018.
Long story short...any way to change the code on 'compare' to recognise all words/ gameobjects and not in sequence?
Thanks.
Title: Re: Array Compare
Post by: djaydino on September 21, 2018, 01:22:29 AM
Hi.
The 'No Repeat  will still repeat indexes but it will not repeat the same index 2x in a row.
Maybe you can use : "Select Random Int" (on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)) and use that as an index and then use array get (instead of random)

Select Random Int will select each number only once.
Title: Re: Array Compare
Post by: shamo on September 21, 2018, 07:15:10 AM
Thanks for the reply. That definitely helped, still getting some repeats. It might just be the way I'm implementing it. I'm using it to populate the scene with varying amounts of objects, cycling on itself according to how many objects are needed if that makes sense?  Or is there another way to pull a certain amount of objects from the array all at once?