Creating object by name from INI and setting VARs

This forum is currently in read-only mode.
  • Hi!

    I'm currently building a map editor and playing along with the INI object.

    I would like to specify all the tile data in an INI file rather then cluttering the eventsheet with statments.

    So far I have been able to "create object by name" from the INI file like so:

    For each group

       Create object INI.ItemString(INI.CurrentGroup, "Name")

    I have more item names(set of data in the INI) that I would like to set for every created object, put how would I pick them since they are created from name?

    As it stands now, the map editor creates the tiles (grass, dirt they are in a family called tiles) but let's say that I would like to set, on creation, their ID, Speedmodifier, Walksound, etc...

    How would one do that in one function?

    The INI looks like this:

    [Grass]

    ID=1000

    Name=terrain_grass01 <font color=red><-- THIS IS THE NAME I USE IN THE EVENTSHEET</font>

    Description=Medium long green grass. It's like fur but smellier.

    Speed multiplier=0.95

    Walksound=walk_grass.wav

    [Dirt]

    ID=1001

    Name=terrain_dirt01

    Description=Brownish compound with small pebbles in it. Makes mothers cry.

    Speed multiplier=0.90

    Walksound=walk_dirt.wav

    Any help would be greatful!

  • While you can create by name, you can't pick by name. A workaround is to have a private variable "init" which is by default 0. It indicates if the object was loaded completely.

    http://dl.dropbox.com/u/5426011/examples13/ini_load.zip

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks alot R0J0hound, I will try it out!

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