User Tag List

Results 1 to 5 of 5

Thread: How to delete/reset global objects

  1. #1
    Clicker 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
    May 2016
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to delete/reset global objects

    Basically I am using global variables from alterable values in global objects and I found out that the changed variables in a global object will be saved even if the frame you are on doesn't have that object and then you go to one that does, all it's changed variables will be there still. So I wanted to know if there was any way I can restart them all back to 0 and all it's flags reset and strings. Because when I go back to the menu screen and start a new game, I want it to be as if I never touched it before.

    The reason i'm doing it like this is because my game works off of multiple frames not just on 1. And there are things I would like to be saved like if the character is holding something, I made a global object called hand and it has a string that says what the character is holding. When I go to another frame that doesn't have the character in it and then come back he is still holding that item. (That's what I want) But if I go to the menu screen and start a new game he is still holding that item.

    Any way I can reset all of the objects I want? Would I have to make a frame with every object I use and reset it that way? Help would be greatly appreciated. or some knowledge on global objects. (The editor Synchronization is set to same name same objects if that helps)

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    480
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    I load / save my global values to an ini file at the end / start of every frame. That way if someone stops playing the game at end of Level 3 - they can start at Level 4 next time and pick up where they've left off because their data is preserved. Also I only save the new values if they complete the level - so if they stop playing halfway through the level it will preserve the save state as it was at the start of the level.

    If they then start a new game I delete the saved data in the ini file which resets everything back to zero when Fusion reads from it at the start of the next Level (frame). I save it in groups - so resetting something is as simple as just deleting that group.

    The global variables that I need to act like local variables I reset as a Start of Frame event - you could do the same with alterable values.

    If you want to reset your objects you can also destroy them and create them again, by code, in other words you must create the character in an event, not tick the block - create a start - in the object's properties.

    Another option would be to set a global value - if new game = 1 - then in a start of frame event - reset everything, the flags and values etc
    (and set new game = 0 so it doesn't trigger again.)

  3. #3
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,076
    Mentioned
    119 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by josm View Post
    I found out that the changed variables in a global object will be saved even if the frame you are on doesn't have that object and then you go to one that does, all it's changed variables will be there still.
    Yes, variables from global objects are preserved for all the application.

    Because when I go back to the menu screen and start a new game, I want it to be as if I never touched it before.
    You have to reset those variables and flags at the start of this menu frame.

  4. #4
    Clicker 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
    May 2016
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the response

    So if I add a new variable I would have to make sure it's something I don't forget to add to the list of things that need resetting right?

  5. #5
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,076
    Mentioned
    119 Post(s)
    Tagged
    2 Thread(s)
    Yes, if you add new variables to global objects don't forget to reset them manually if and/or when this is required.

Similar Threads

  1. Is There An Easier Way To Delete Global Variables?
    By DokieMaster in forum Fusion 2.5
    Replies: 1
    Last Post: 21st February 2017, 09:45 PM
  2. Global Value won't reset back to zero
    By The_Kirby_Genius in forum Fusion 2.5
    Replies: 6
    Last Post: 26th September 2016, 12:28 AM
  3. Replies: 9
    Last Post: 25th January 2016, 09:11 AM
  4. How to delete a global variable?
    By Khalid in forum Fusion 2.5
    Replies: 5
    Last Post: 12th October 2015, 05:39 PM
  5. [Request] Active Objects: Reset Alterable Values
    By Dines in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th January 2008, 08:06 AM

Posting Permissions

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