Super Simple Game_Temp Questions (SOLVED)

Status
Not open for further replies.

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
Super Simple Questions:

1) Is Game_Temp just the same as any other class?

2) The only difference being... it reverts its values back to its default values (within its class) if you Save and Load?

3) And the way it does that reverting is through its Initialize method... right? (code included below)


Ruby:
class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :common_event_id          # Common Event ID
  attr_accessor :fade_type                # Fade Type at Player Transfer
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @common_event_id = 0
    @fade_type = 0
  end
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,496
First Language
Indonesian
Primarily Uses
RMVXA
1) Is Game_Temp just the same as any other class?
Depends on the context. But yes.

2) The only difference being... it reverts its values back to its default values (within its class) if you Save and Load?
To be more precise, the content in the Game_Temp will not be saved as save contents rather than reverting back. Although, you could put it that way.

3) And the way it does that reverting is through its Initialize method... right? (code included below)
Initialize is not for reset. It's for initializing the object.
 

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
To be more precise, the content in the Game_Temp will not be saved as save contents rather than reverting back. Although, you could put it that way.


Initialize is not for reset. It's for initializing the object.
Cool, glad I was mostly correct in my understanding of it then :D.
-------
I figured what made it essentially "not save" was that it reverted whenever it was called, due to it setting its public instance variables to 0 whenever it's initialized, but if I'm understanding you correctly that's not what actually causes it to have this special "will not be saved" trait.
-------
So, is what gives it that trait found elsewhere then (rather than in the class itself)?

I couldn't see anything suspect within the class when I looked, but if it's specifically save-related like you said then I guess it's safe to assume what gives it this trait is likely to do with the save related methods and classes themselves (which I haven't had a look at yet).
-------

Not asking you to go looking for what makes this the case if you're not sure yourself, but if you happen to know for a fact that what makes Game_Temp... well, temp, is found elsewhere, then a reply of confirmation would be nice and welcome :).

Thanks for the initial reply as well!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,930
Reaction score
13,567
First Language
English
Primarily Uses
RMMV
So if you look through the DataManager scripts, you'll see that $game_temp is initialized in the create_game_objects method, along with all the other global $game objects. Lower down, you can find make_save_contents and extract_save_contents, which includes all the other $game objects, but not $game_temp. So as said above, this is not saved or loaded from saves.
So the only thing that creates it (and at that time all the contents are cleared) is create_game_objects. This function is called when the game is first launched, and again when New Game is selected from the title screen.

Looking more closely, that could mean that you could start a new game, play a bit and save, start another new game, play a bit and save to a different slot, then go back to the title screen and reload your first game, and the $game_temp from your second game would still be in memory. However, Game_Temp only has info that's going to be set and then used within a very short time, so it's unlikely the remnants of one game would interfere with another. It might have some issues when people add scripts that throw other things into this class. I've used it for stuff that I don't want to create a new object/class for, but don't want to save in the save file because it doesn't need to hang around.
 

The_Sarah

Let's make great games together!
Veteran
Joined
Jul 18, 2020
Messages
100
Reaction score
79
First Language
English
Primarily Uses
RMVXA
[insert solidly written explanation here]
Wow, that's a lot more detail than I was expecting and basically answers all my thoughts on the subject.

Thanks for that!
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,471
Reaction score
5,300
First Language
english
Primarily Uses
RMMZ

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Profile Posts

Hello I buyed RPG Maker VX Ace a long ago and I want to use it again but in the meantime I changed my pc but I lost the paper with my product key on so I can't use RPG maker again... someone can help me please ? or there is no hopes ?:'( ( I have a bad english I'm sorry )
I was away this days here in the forum but it was for a good cause!
The trailer of the demo of Luke Inn is on youtube and I am so happy!
I need to see the bugs of the game but I am happy that I have new content to show!

The last part of the modern interior will be ready soon. This will be a B-tile. With interior items for the kitchen, bathroom, toilet and storage room.
This frantic shooting ARPG plugin for MZ looks really great. Here is the link to a post from the official Japanese RPG Maker forum.

Forum statistics

Threads
102,941
Messages
996,126
Members
134,397
Latest member
Harwin
Top