variables in RTS game

  • CASE: In a game (rts type) where I am designing building/resources: mine (ore), mine (iron), etc... I can work with global variables for: mine or building level, resources quantity, etc...

    But the problem is for each new building or resource as we have to introduce the value of variables one to one. This is a waste of time...

    I want do it with arrays, but as you know, the dialog of variables doesn't allow it. With arrays you can modify once instead of multiple times for each new building...

    What do you thinks about this? Any suggestion or other way to do this?

  • I can't help you but I am very interested, I hope experimented users will be able to help you...

  • revived the post. I need to get to a solution.

  • GeometriX I'm sorry to bother you, but I could help.

  • I don't really get what you are trying to do, but if you just want to link a resource to a value like

    metal: XXX

    wood: XXX

    cristal: XXX

    why don't you use a dictionary? Try explaining again what you want to achieve, I might be able to help.

    (please tag me in the response)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • caiorosisca Thanks for wanting to help. Forgive me for my English.

    I have to give a value to a variable, but this variable is selected from an Array

    Now I have only 2 buildings. Glass and metal. So could do this

    but imagine you have 10, 20 or 60 different buildings.

    I just want to assign a value to a variable without selecting literally

    have an alternative option to assign values ??to variables.

  • Have a look at this plugin:

    You can use it like an associative array!

  • Hmm, I don't think there's much you can do about it. If you need a variable for each resource you will need to do what you are currently doing.

    I don't think I can help you, but I see no reason for not using a dictionary for it, it's organised and not a bad practice to do it like that.

    Just pointing, even when you select the variable from the array you aren't referencing to it, just to the value.

    var1 = 1;

    Array> Set at XY> (0,0) var1; // here the value at array(0,0) is 1

    var1 > set value> 2

    //here var1 = 2, but array(0,0) is still 1

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