Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Permanent global variables [SOLVED], Any way to do them besides putting them in game_system?
Titanhex
post Sep 14 2011, 05:11 AM
Post #1


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




I would benefit from making some variables I create stored on save. Unfortunately the only way I know how to do that is add them to game_system. It makes the line rather large though when I'm calling $game_system.somevariable Is there another way to make variables permanent?

This post has been edited by Titanhex: Sep 15 2011, 08:48 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Night5h4d3
post Sep 14 2011, 05:16 AM
Post #2


The past tense
Group Icon

Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed




If you're just storing numbers, you should use $game_variables. Other than that and game_system, the only way to create a variable that will last through gameplay and into reload would be to create a new game class and to write the marshall functions in Scene_File.

Moving to RGSS2 script support
~ Night5h4d3


__________________________
Got 30 minutes? Then you've enough time to play this awesome game:

- potentially promising project page
- thanks holder
My growing space of user-bars:

about me:







I made the following!





Go to the top of the page
 
+Quote Post
   
Ty
post Sep 14 2011, 05:35 AM
Post #3


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Continuing on with Nightshades response:

Scene_Save, find this:
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)

Add
Marshal.dump($yourglobalvariable, file)

and do the same for Scene_Load:
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)

Add
$yourglobalvariable = Marshal.load(file)


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 05:41 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker