Spawn units W array [Solved]

0 favourites
  • 3 posts
From the Asset Store
SCI-FI Units SFX contains 456 sounds With this pack, you can voice almost all the units in your sci-fi strategy game
  • Hello.

    I got the follow informations:

    There are 8 buildings in this world.

    1 Array

    • sets each buildings UID at 0.0
    • sets how many men lives in building 0.1
    • sets how many women lives in building 0.2
    • sets how many girls lives in building 0.3
    • sets how many boys lives in building 0.4
    • sets how many money they have 0.5

    Now comes the question:

    I want the SYSTEM, to CREATE the humans at their specific building UID (array 0,0)

    how would you do that?

    CAPX link - https://www.dropbox.com/s/v8uq9o10sbtu4ap/ForQuestions.capx?dl=0

  • so in other word you want to have an entire array that would list all of the building ID number and their own populated civilian. To generate a community with people.

    Best way to do it is to create the array object with its own variable instance and then just number what location they are at such as this Building A is 0 building B is 1 building C is 3

    And then for the rest is Men is 0 women is 1 girl is 2 boy is 3 and money is 4

    Now for the array if you want Building B and to know what money it has you can refer the reference in where the coor are which is 1,4

    Now that we have coor finder down if you need to modify it.

    Next you will need to create a function with several parameters

    Basically use the parameter to retrieve a value from the array that you want to use now

    Do a repeat (parameter data value)

    Spawn the created object

    So in other word define on how to find the value of the array and then use that value to spawn the object. If this wasnt what you were looking for you might have to explain what you want a little better.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • so in other word you want to have an entire array that would list all of the building ID number and their own populated civilian. To generate a community with people.

    Best way to do it is to create the array object with its own variable instance and then just number what location they are at such as this Building A is 0 building B is 1 building C is 3

    And then for the rest is Men is 0 women is 1 girl is 2 boy is 3 and money is 4

    Now for the array if you want Building B and to know what money it has you can refer the reference in where the coor are which is 1,4

    Now that we have coor finder down if you need to modify it.

    Next you will need to create a function with several parameters

    Basically use the parameter to retrieve a value from the array that you want to use now

    Do a repeat (parameter data value)

    Spawn the created object

    So in other word define on how to find the value of the array and then use that value to spawn the object. If this wasnt what you were looking for you might have to explain what you want a little better.

    Thank you for the reply - i did how ever just got it to work. (I wanted it to create the people belonging to each house)

    -On start of layout

    (local value "Spawn_X")

    (local value "Spawn_Y")

    -For each (building)

    -Compare in the array (loopindex,1)=1

    *System set "Spawn_X" to building

    *System set "Spawn_Y" to building

    *System create "Man" at "Spawn_X"/"Spawn_Y"

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