How do I save object information between layouts?

0 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi, I am doing a room generator with all its connections. I want to do it in 3D space, so I can have X rooms width, Y rooms height and Z depth, and each room can have 6 possible connections with its neighbour rooms. I made a object called "room" that can store connections information with instance variables. I create X x Y x Z rooms and I save their UIDs in an array, then I run my algorythm and it works fine. Ok, but when I want to start playing, each room is a different layout, so when I load the first layout or whatever, all my "room" instances with its information are lost. Is there anyway to make an array to save object instances instead of only numbers an text? I dont want to use infinite arrays to store all the information and I can't change the layout per room system.

    So, Can I save my object instances between layouts? I know there is the persistent behaviour, but I think it wont work like I want, because it saves it for a specific layout. I want to have my X x Y x Z array with my objects UIDs and access that objects in all layouts.

    Thanks in advance ^^

  • You can't do it like this, probably use instance variables on the actual object. I'm not 100% sure how you are using the UIDs but when the objects are created in the layout the UID is set unique for that one specific object, when you create them in the next layout they will always have different UIDs. And to also answer the question in the title, the UIDs are saved between layouts but you are creating new objects with new UIDs.

  • Yes, that is the main problem, I store the UIDs but in the next layout they are useless. So how can I save the information of that objects between layouts? If I generate a 2 dimension array of rooms, I can store the information in the 3rd dimension of the array for each room, but if I have a 3 dimension array of rooms, I dont know how to store its information. I can use a lot of arrays for each variable but is kinda messy. So I need a workaround to solve this: store the information (intance variables) for X x Y x Z rooms. D:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can turn your Rooms into global objects, you do this in the properties panel, top left corner. Then they will be available in all your layouts.

  • You can turn your Rooms into global objects, you do this in the properties panel, top left corner. Then they will be available in all your layouts.

    Oh! I have to try that. I guess the UIDs are saved between the layouts, so I can access every object with the same UID through the rooms. Thank you, I will reply when I try it. Thanks in advance ^^

  • > You can turn your Rooms into global objects, you do this in the properties panel, top left corner. Then they will be available in all your layouts.

    >

    Oh! I have to try that. I guess the UIDs are saved between the layouts, so I can access every object with the same UID through the rooms. Thank you, I will reply when I try it. Thanks in advance ^^

    Yeah its the same object from once its created with all settings etc.

  • >

    > > You can turn your Rooms into global objects, you do this in the properties panel, top left corner. Then they will be available in all your layouts.

    > >

    >

    > Oh! I have to try that. I guess the UIDs are saved between the layouts, so I can access every object with the same UID through the rooms. Thank you, I will reply when I try it. Thanks in advance ^^

    >

    Yeah its the same object from once its created with all settings etc.

    Mate, it worked perfectly! thanks a lot

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