User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16

Thread: Saving / Loading to an array using the Fixed Value of the Group.Neutral not working

  1. #1
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Saving / Loading to an array using the Fixed Value of the Group.Neutral not working

    Oh man, and I was SO SURE this would work too

    What I'm doing, and have been trying to do for a while now, is to have it so that my game saves which dirt blocks on the frame have been destroyed or not so when you reload the game those blocks will be gone. After many unsuccessful attempts at this I had an idea this morning that I was sure was going to work.

    I wanted to use an array where the X part of it was the dirt block's fixed value. The dirt block also has the neutral qualifier (because I intend to have it save other things like destroyed barrels and etc this way if it works). What I'm doing is when the group.neutral's animation disappearing is playing, it writes the value 1 to the array like so:

    Animation Disappearing "Group.Neutral" is playing
    -> Write Value 1 to Fixed( "Group.Neutral" ) to the X slot of the array


    Then when you quit the game it saves the array file to the game's folder. This part works.

    When I go to load it all back though I load the array up and do this:

    Start of Frame
    -> Start Loop "dirt" 2000 times


    On Loop "dirt"
    +ValueAtX("array",LoopIndex("dirt")) = 1
    +Fixed("Group.Neutral") = LoopIndex("dirt")
    -> Destroy Group.Neutral


    But it just doesn't work. I've tried re-ordering these conditions in case it made a difference but the dirt blocks never get destroyed upon load.
    I mean this idea is pretty sound, isn't it? It'd be an excellent way to keep track of many destructibles in a big frame if I could get it to work.

    Any ideas?

  2. #2
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Welp, I was able to figure out WHY this isn't working and that's because the Fixed value of an object is some huge-ass number and NOT the 2nd number shown when you select an object at design time.

    Ex. Click on an active object and it'll say 1:16, meaning it's on the 1st layer and the 16th object created.

    So technically my idea could have worked if it was using the number (16) here instead of (459932) or whatever number it gives each object

    --

    SOOooooooooooooooooooooo

    I don't suppose anybody here knows if there's a way to pull the "object created order" number, is there?

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Always spread value 1 in an alterable value on the object, or set an alterable value to the object count when it's created.

  4. #4
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hey RhysD!

    So these Group.Neutral objects I already spread value 0 to Alt val A at the start of the frame, does 0 or 1 make a difference?
    And also that means I'd be able to do something like this, right?

    Start of Frame -> Spread value 0 (or 1) to alt value A of Group.Neutral

    Animation of Group.Neutral disappearing is playing -> Write value 1 to Array X index (Alt value A of Group.Neutral)


    --

    And then upon load I could do something like this:

    Start of Frame -> Start Loop DUH # of Group.Neutral objects
    On Loop "DUH"
    +Value X of Array(LoopIndex "DUH") = 1
    +alt value A of Group.Neutral = LoopIndex "DUH" -> Destroy Group.Neutral object


    --

    So that it would save the value of 1 to the save file array (meaning the object was destroyed prior) and then when it loads back up it would cycle through all the neutral objects (these are all created on the frame at the start) and loop through them and compare if they were previously destroyed and if so (the value is = 1) this would destroy them?

    That's what I want to do for this, I'm just not 100% sure if I'm wording this right.

  5. #5
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Oh sorry also if I'm playing the game and let's say blocks 0-30 have the alt value A of 0-30 and I break the one that was value 16:

    Do the remaining blocks keep their values? Ex. blocks 0-15 and then block 17-30

    Or do they all change to 0-29? If it behaves like this I don't think I can use my array saving idea which is why I ask.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Hey Del Duio,
    assuming the only "fixed" reference you can take of your blocks in the frame is their position,
    why don't you just store the X and Y position of destructed blocks in your array?
    I think this could be the most "solid" solution to locate blocks
    (unless you have multiple overlapping blocks in the same X,Y position
    or you can "push/move" blocks, which could break the system, depending on your features/requirements)

    You can store the X and Y values of destroyed blocks in two array columns
    add them incrementally in your "list of destroyed blocks" array (insert into array DimX+1) when you destroy them
    and upon loading the stage fire a loop through the whole X dimension of the array
    destroying blocks who meet the condition:

    block X=valueat(loopindex(loop),0)
    + block Y=valueat(loopindex(loop),1)


    (or use a list object and a tokenizer if you prefer:
    i.e. when destroying blocks:
    add line str$(X(block))+"|"+str$(Y(block)) )

  7. #7
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks, schrodinger but I believe I am 99% on the way there by using the following which I just whipped up a few minutes ago. Minus the blocks being destroyed via fastloop upon load but I'll get to that shortly lol.

    --

    Start of Frame -> Spread value 0 to alt value A of Group.Neutral

    Animation of Group.Neutral disappearing is playing -> Write value 1 to Array X index (Alt value A of Group.Neutral)


    --

    I've tested this and it works. It saves the value of 1 to the X spot on the array using the Group.Neutral's Alt value A "ID #" passed to it via the spread value event.

    But this part below- and it's Fastloops and every way I try to word these conditions it still won't work:

    --



    Start of Frame -> Loads the saved array

    Start of Frame -> Start Loop "DUH" for # of Group.Neutral objects

    On Loop "DUH"
    +LoopIndex("DUH") = Alt Val A of Group.Neutral Object
    +ValueAtX(Array, LoopIndex "DUH") = 1

    -> Destroy Group.Neutral Object


    --

    So I'm positive it's the way I'm doing (or rather not doing) the Fastloops part to read through the array and destroy any blocks that were previously broken the last time the player played the game.

    I mean, shouldn't this work?

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    mmmm
    have you tried inverting:

    On Loop "DUH"
    +LoopIndex("DUH") = Alt Val A of Group.Neutral Object

    >>>On Loop "DUH"
    +Alt Val A of Group.Neutral Object = LoopIndex("DUH")

    and be sure you are spreading values before you fire the fastloop
    (and not on the very same event you fire the fastloop, as it proved to be a faulty practice in the past)

    beside this,
    I would be a bit picky with this method if you create additional neutral blocks in runtime,
    you could never be sure newly added blocks spreaded value will always be the same if you create them in a different sequence from a saved game to another

    if not (if all your blocks of the level are predetermined at start and no additional blocks are added in runtime) I think this should work!

  9. #9
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The blocks are all where they're supposed to be on the frame and you can't add more while playing so that won't be a problem.

    Yep, I for sure have it spreading the values before the fast loops (it's about 50 lines down from the spread value line). Also tried inverting the conditions and it still didn't work. I then changed it from Group.Neutral to the active object "block" itself to see if maybe that was causing the issue but that didn't work either.

    I appreciate you trying to help but man, this sucks.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Once I remember having an issue with "loading speed" of the array,
    the array didn't load fast enough from the file to perform another start of frame action right after
    so I solved by waiting some frame before firing the loop cycling through the array
    it was a pretty big array so it's likely not the cause now
    but maybe try to fire the load loop after a second or so just to test... (crossing fingers )

    If this doesn't do, you could try debugging in depth by adding a list object and displaying operations step by step,
    i.e. what the loop reads from the array?

    on loop "duh"
    >>> add line str$(loopindex("duh")) + " val=" + str$(valueatX(array,loopindex("duh")))

    to see if this is an issue when reading values,
    or when scoping objects:

    on loop "duh"
    +group neutral = loopindex(duh)
    >> add line "neutral ID found: " + str$(loopindex("duh"))

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Array Paths Saving/loading issues
    By Mikegames in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 15th August 2014, 05:37 PM
  2. [RC5] Saving and/or loading array files
    By colej_uk in forum Android Export Module Version 2.0
    Replies: 9
    Last Post: 11th March 2013, 12:49 AM
  3. Problem with array loading/saving with INI++
    By timcclayton in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 21st November 2010, 06:21 PM
  4. saving/loading objects and fixed values
    By uprize in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 29th September 2009, 06:43 AM
  5. array object : saving loading
    By jpcr in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 15th February 2008, 02:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •