Rex Rainbown inst_group sort by variable

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi there, just a quick question for someone out there that might be in the know...

    I'm using the master Rex Rainbows plugins to put multiple chess on a board. No issues there. I have an extra instgroup object taking each chess UID as created and storing it in order as created. I have the chess moving around the board now in this order group called "turnorder". I now want to take it a step further and sort the UID list in the instgroup object according to a variable called "initiative" to alter the turn order.

    My question is as follows... Is there an easy way to sort the instgroup object uid group by each objects "initiative" variable? ? If so how??? Not all of the object uid's in the group are an instance of a single object. Or am I going about this wrong, should I be putting them into an array instead and sorting that way? It was so easy to pop the uid's into the instance group I was hoping I could go that way. I had a look at Rex's UID2PROPERTIES, I'm not sure if this would be useful to find the initiative variable to sort the instance group or whether it is strictly used for something else.

    I have been thinking about this for a while and researching, I don't ask a question unless I'm stumped so I would really appreciate any hints or tips you experts have. Thanks so much for your time.

    Dave

  • You will need to loop through your array (like for loopindex=0:array.Width ) and put the element into a new array called "sortedArray" then check the current loop initiative vs 0 and (sortedArray.Width-1) indices in the sortedArray then use Push (back or front; based on the initiative) to build the new sorted array.

    Reference:

  • Alrighty then, array it is, I've got it set up now ... Eventually I'm probably going to have to sort other information in the array anyways. That was the next logical step I was just curious if there was another method or shortcut using Rex's addons.. I don't like finding out there was an easier way after a lot of work... Thanks so much for taking the time out to respond to me, I really appreciate it. Love your game idea too, have checked it out.. Reminds me a bit of a couple games I own, SW rebellion and galactic civilizations from the screenshots so exciting.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, we are patterning it off of a combination of Master of Orion II/GalCiv and Lord of Ultima, with a number of new mechanics (like fully fiat currencies and sovereign debt markets).

    I am actually going to be using the Array.Pop soon to make non-repeating random star name generation. Except that I am doing it in Java, but the same idea applies.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)