How do I pull new (non-repeated) items from an array?

0 favourites
  • 4 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I've been reading a lot about arrays and have learned a lot (newb) here. As you can see in this little demo (that I have set to only generate a virus for players on a football team for testing), I'm trying to pull five positions without any of them repeating.

    To get the demo to the spot I'm struggling with, Click "Virus Possible" and 50%, then click Simulate. Click it until you get it to run a virus (I have it set to ignore everything else for now).

    You'll see that it's pulling in five names, but while demos/literature have helped me get this going, I'm certain my copying/pasting/reshuffling is not setup right.

    All I'm trying to get at this point is to pull 5 random names from my array without repeating any of them.

    Thank you for taking a look! Screenshots below:

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You would just need the array value of the first 5 perm table values so

    array.at(AR.Permutation(0))

    array.at(AR.Permutation(1))

    array.at(AR.Permutation(2)) etc

    FYI remote preview only works as long as you have it open so we can't see anything of the game.

  • Also, do not use 'wait 4 seconds' before loading AJAX data, as the contents of AJAX.lastData may have changed by the time the wait ends. (if you make several AJAX calls)

  • Thank you so much! I have this working now how I want. :)

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