array gets

0 favourites
  • 7 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Ok so i create this Array and It will evolve to a large array. The Array Width is 6 and Height is 2 and Depth 1.

    I have it set up for all in the Width value in order starting from 0-5 Blank, Hp, Power, Speed , Type

    And for the height in order from 0-1: Blank, Name

    Now I want to create a system where instead of using X,Y value I want to do something like Get value at "Name","speed" because like I said this will be come a large array and If i can get away with doing Name, speed it would drastically reduce the time of finding the code and have a function to check value of name and then power and have it running on checking the value = value instead of IF 1,0 or 1, 8 you can imagine how bulky the code would be.

    I just cannot figure out how to access a function to would allow me to use the name as a trigger finder and the stat for easy picking

    Because I want to load itself into various variable holder for use in battle to pull from or to view it.

    Or am I doing this wrong.

  • For large arrays like unit lists and such I use instance variables for stat positions on an axis so I don't need to remember stuff like if I had health as 12th or 13th item and can just use array.hp in place of it.

    But for using the name maybe IndexOf(name) could work if names are unique.

  • Well since the names are going to be Unique and I realized that using variable in your sense would work alot better.

    So If i use like say Selected = indexof (name) and use a variable like array.speed

    How would I get the program to check for the index(name) is equal to a Y and then add that with array.speed in a X,Y coor so that its comes up to Finding coor value of 3,1 ?

    How would i code that ? because later in the code I am going to use Level to multiply or Add value to this base value

    such as once value is found this is base value of level one and then once you level to two I will have it increase by 2 or so on and I would like to keep this array that i am working on to be only for Base value of level one And I will use this to determine the stat of enemy and your own player. and Yes I will have another Array for player and enemy value.

  • Hmm I'm not sure I understand what you are asking.

    [quote:1q0lh9on]and then add that with array.speed in a X,Y coor

    based on that are you are asking how to add the array value in a another expression? If so,array.speed) might be what you want.

    Also I'm not sure but as far as I can tell it might be better to use X for names and Y for stats because some stuff seems to be either for just X or X and Y but not for just Y.

  • ummm ok how about is there a way to get a value coor then like say if Name is in the array at 0,1 How would I extract the value coor Y number only which is number (1) to be use with the variable coor speed.

  • Hey Maukka I was using a test mini example and I came across some thing funny. So for this example i used array 2x2 and used 0,1 and 1,1. I set the 0,1 to Name and 1,1 99. and i added a button with a text variable = "Name".

    apparently even if you use Button.variable in the Contain value array condition. The Array doesnt see the Button.variable="Name" but rather see the value as plain Button.variable.

    So then I tested a another theory that if the array at 0,1 has value Button.variable it now reads it. Can anyone explain why this is happening. I mean the Button text variable is the same value as the array but the engine doesnt reads it as that way ?

    NVM the " " on teh name for button.variable is what prevented it...silly me bad habits

    Ok i found it It was in the loops.

    for each x,y + currentvalue=variable -> set variable to CurY This was it and thx you Maukka Ill use your techique as well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yes this was my question that how i can call those all players which are having team A in the array and those whor are having B in other list or table.

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