playMaker

Author Topic: SORT ARRAY (WITH PICTURES AND MORE EXPLICIT) [SOLVED]  (Read 2144 times)

LeDisciple

  • Playmaker Newbie
  • *
  • Posts: 35
SORT ARRAY (WITH PICTURES AND MORE EXPLICIT) [SOLVED]
« on: March 16, 2019, 10:17:12 PM »
hi,

first of all I try to help myself with that package from DjayDino:
http://hutonggames.com/playmakerforum/index.php?topic=10906.0

here the pics from the setup:






I want an array list to be sorted by INT (already inside a GO )....and put the associated GO in a separated list than the random one
before sorting I extract and put INT and GO (game object)in separated arraylists...

so before sorted : INT array was like 0,1,2,2,0,1,1,0,0,2 for each GO. And that GO array was like:SO,MT,HT,MT,CT,MO,CT,MT,MO,MT


and then I sorted INT... Sorting was OK for INT:0000111222



But the "ArrayList Get" GO isn't:  its SO,SO,SO,SO,CT,CT,CT,MT,MT,MT



I'ts like it take just the first 3 zeros from the unsorted int: Those associated with SO CT and MT...
 
HOW TO GET THE GO SORTED WITH HIS PROPER INT?

Thanks a lot ☺
« Last Edit: March 20, 2019, 09:35:29 PM by LeDisciple »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: SORT ARRAY
« Reply #1 on: March 17, 2019, 08:03:13 PM »
Hi.
Yeah that's an old sample that has issues when same score.

This tutorial has a different approach, its using standard array but principal is the same for array list :


I will update that post of other people.

You can find the sample in my asset
« Last Edit: March 17, 2019, 08:06:30 PM by djaydino »

LeDisciple

  • Playmaker Newbie
  • *
  • Posts: 35
Re: SORT ARRAY (WITH PICTURES AND MORE EXPLICIT) [SOLVED]
« Reply #2 on: March 20, 2019, 09:34:43 PM »
Hi,

I resolved it by myself.... I loved Arraymaker because there is a lot of actions available.... so here what i've done: (I put here only updated screenshots from previous ones)

1- I set the name of the game object by its own INT... Inject the index to a variable inside the game object ...



2- Increment Index variable...



3- Now with GO named by their own extracted INT variable, I can sort them...



4- With injected Index, I got them and look for INDEX inside my array where AI & Player Characters aren't sorted to see wich one will start the battle...



5- And that's it!! Here on the left we see (under ENNEMY HASH ARRAY) the process of renaming random created GO by their own random INT variable...



And here the turn-based waiting list done...



I know it's not perfect for now but it works to achieve what I needed.  ;D