[Plugin] RandomArray

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Hi,

    I modified the Plugin "Array" a little so that you get an array of unique random numbers. You can also set a startvalue for the randomnumbers via the Properties panel.

    _________________

    [Update 2] v 1.<font color="red">1</font>

    [Add] Action "set size" Number

    Plugin Random Array (1.1) - demo,capx,plugin

    _________________

    [Update1]

    HowtTo - Plugin Random Array

    Plugin

    Scramble Cards Example

    _________________

    <font size="1">Plugin randomArray - old version </font>

    All suggestions are welcome. <img src="smileys/smiley1.gif" border="0" align="middle">

  • Thanks ! Exactly what I needed for one of my project.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're welcome.

    I've updated the plugin and made two examples.

    Have fun. Joe7

  • Just to point a quick problem : you seems to have changed the namespace or something between the two iterations. I made a project with the first version you posted, and we trying to reopen it with the new version, I have a text box saying that there's a name problem with the plugin.

    I opened the project XML file, and saw that the first version was declared as something like :

            <object-type name="RandomArray">

                <plugin id="rL" name="Random Array" />

            </object-type>

    and the new version declares something like :

            <object-type name="RandomArray">

                <plugin id="rA" name="Random Array" />

            </object-type>

    Just editing the change inside the XML doesn't allows Construct to load the project. I reverted back to the old version for the moment, and when I have the time, I'm going to copy/paste in a new project, with the new version, but it's a little problem for the moment...

  • Hello Pode,

    yes, i've changed nearly all in the new version and the versions are incompatible - they have a different datastructure for saving values. <img src="smileys/smiley2.gif" border="0" align="middle" />

    1) The new version uses an array with only one dimension - width.

    2) The old version is based on the Array-Plugin (you have a 3d-array but random array-Plugin uses only the first dimension).

    => But you can use both versions together, when you need it - ie to port your project to use the new plugin version or to stick with one project at the old version. <img src="smileys/smiley1.gif" border="0" align="middle" />

    <img src="http://dl.dropbox.com/u/31151399/Construct2/Plugins/pluginRandomArrayHowTo/rA_OldNew.png" border="0" />

    <img src="http://dl.dropbox.com/u/31151399/Construct2/Plugins/pluginRandomArrayHowTo/rA_OldNew2.png" border="0" />

    Joe7

  • Okay ! I didin't think of that solution. It's a bit dirty, but quick. Thanks ;)

  • very powerful...tnx Joe

  • Joe - yet another plugin of yours that I've found extremely useful! I was just wondering if there was a way to dynamically set the size of the array.

    Thanks a ton

    TNewhook

  • tnewhook: Nope. Isn't implemented, it's a very simple plugin. Possible with "normal" arrays?

    [Edit]

    tnewhook: Random array has a "New size" action. <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Wow, Joe! Thanks a ton! I did figure out how to do it with normal arrays, though.

  • Hi Joe7,

    Do you know of any issues with RandomArray and the browser object. I use your plugin in two of my games, and when I add the browser object, the game does function properly. Have you heard of any issues?

    Thanks,

    Dave

  • Hi,

    it seems like the PlugIn is working not correct in my case.

    I generate an array from 1 to 60.

    So I have 60 levels I want to be in a random order.

    I use a counter (it starts from 1) and call the RandomArray.At(Counter-1) entry to access the first number in the list.

    After a level is completed I add 1 to the counter and the game takes again RandomArray.At(Counter-1). This is the next random placed number on the list from RandomArray and the next level.

    I do generate a logfile and it works besides one problem.

    RandomArray seems to skip one number and generates it twice at the end.

    So for example from 1 to 5 it generates: 3,5,2,4,4

    One is skipped and 4 is twice at the end of the array.

    I could not find any reason for this and would like to ask whether someone had similar issues?

    Thanks

  • Joe7, would like to incorporate this for randomly moving some sprites around the screen to generate random levels, thanks.

  • Joe

    I have 3 Randoms Arrays. I would like to multiply the a RandomArray1 x RandomArray2. And put the startValue on the RandomArray3.

    I would like to set the StartValue to this:

    RandomArray2.At(loopindex)*RandomArray3.At(loopindex)

    How can I do that?????

  • I know this is old, but what would be nice for me is to have it have a function called scramble, but with parameters.

    So set a min, max, points of precision and an offset. So lets say I wanted unique multiples of 30, between 1 and 4390. The array would be nothing but unique multiples of 30. 30, 60, 90, 120, etc.

    If I leave points of precision 0, it will be whole numbers.

    If I pick an offset, it will automatically ignore PoP for easier use.

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