S Plugin...Reliable???

This forum is currently in read-only mode.
From the Asset Store
Antisuspend Plugin
$7.20 USD
20% off
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • Ok, here's one for you.

    For this project, I've decided to stick with a normal array object rather than using S, mainly because of the amount of work I'd already put into the editor.

    But I would still like to utilise S to pack up my level data.

    So here's the question;

    If I have several array objects with the level data in them, is it possible to use S to save them into an encrypted file, so that when the level pack is loaded using S, the arrays are filled with the data that they were when saved?

    My initial tests seem to suggest that the array data is not saved with the object.

    If this is the case, is there a chance of an update that could allow this.

    Krush.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hey, krush

    this is correct. The object arrays only have pointers to the objects, it doesn't save an actual object. If you were to take a text object and rename it "Sprite", and a "Sprite" was in an array you loaded, it would load that. So, although there are some handy tricks like the Spacial Info Array actions to put all your objects exactly as you left them. Object specific things can't be saved. As far as an update that can change this. I'm not sure it's even possible, but definitely outside the scope of my programming ability. The only thing I can foresee adding to the save ability is private variables, but I don't plan on working in depth on 's' to add new features until after I'm done with my current long term project. Though I will fix bugs.

    That being said, what you're trying to do is actually very simple to pull off. In this example it'll be like you renamed your regular Construct array to ArrayObject, to avoid confusion as you read this

    When you go to save: Say you press F1 to save:

    [quote:15wihy99]

    Mouse Keyboard : On key F1 pressed

    ----S: Create Number Array (or string array if necessary) "MyArraySave"

    ----ArrayObject : For Each Element:

    ----------S.Insert Number : ArrayObject.CurrentValue at "end" of "MyArraySave"

    ----Always:

    ----------S.Save Super {""} : Encrypted

    ----------S.Delete Array "MyArraySave"

    And just do the reverse to load it. Load the s super

    for each number in "MyArraySave", add that data to the standard construct array

    and then delete the s array

  • lucid did beat me to it, but I made such a nice example (although a little more complex), well commented and such, so I will post the link anyway

    using_s_to_save.cap

  • Once again, I salute you guys.

    My array has now become a 3D array with the development of the game, but that's easy enough to sort.

    This technique will allow me to package up everything I need for packs of 25 levels, complete with pack-specific custom spritesheets, etc.

    Nice!

    Thanks guys.

    Krush.

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