Sel Feena

All your VX Ace are belong to us
Veteran
Joined
Aug 10, 2013
Messages
35
Reaction score
0
First Language
English
Primarily Uses
How much hassle would this be to do? Really, all I'm looking to do, or would be interested to learn how to do, is add information to the Event class (just some strings and integers) in such a way that it is preserved properly with Saves / Loads. I'm fine with adding to the class definition to add custom member data, accessors and functions, but it's how this info can be saved and loaded back that interests me.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,383
Reaction score
8,099
First Language
German
Primarily Uses
RMMV
Look for PK8's Self data suite, it's on the master script list.


Those scripts should do what you want - they add self switches, self variables and meta data to everything from actor to maps.
 

Zechnophobe

Veteran
Veteran
Joined
Jul 17, 2013
Messages
93
Reaction score
2
First Language
English
Primarily Uses
How much hassle would this be to do? Really, all I'm looking to do, or would be interested to learn how to do, is add information to the Event class (just some strings and integers) in such a way that it is preserved properly with Saves / Loads. I'm fine with adding to the class definition to add custom member data, accessors and functions, but it's how this info can be saved and loaded back that interests me.
You could also just make a parallel list of data objects that your events have new functions for accessing them. I warn you though, that the event data system is fairly complex, so this may be more complex than you would otherwise think.

I did use a system like this in my current game that ties a person object to an event that represents them.
 

Sel Feena

All your VX Ace are belong to us
Veteran
Joined
Aug 10, 2013
Messages
35
Reaction score
0
First Language
English
Primarily Uses
Look for PK8's Self data suite, it's on the master script list.

Those scripts should do what you want - they add self switches, self variables and meta data to everything from actor to maps.
Those scripts look great, but they're not really the best to learn from! How about if I go with a simpler goal? Let's say I wanted to understand how to add another piece of data to the game, a Hash for example. There are several considerations from what I can see:

  1. On starting a new game, I'd like this Hash to be initialized, using a Hash I'd setup in a Module somewhere.
  2. On saving, I'd need this Hash to be saved alongside all other data.
  3. On loading a saved game, I'd need to make sure that game's Hash is loaded properly
From what I can gather, it would seem 2 and 3 involve aliasing some method(s) within DataManager. For 1, I guess it's just attaching initialization code to whatever handles setting up a new game. Any pointers for achieving this would be great, so I can understand how this is done for myself, and add that knowledge to my own attempts at scripting.  :)

EDIT: I should probably then also change the thread title to reflect this?
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,872
First Language
English
Here is a simple example

http://himeworks.wordpress.com/2013/08/19/party-manager/

module DataManager class << self alias :th_party_manager_create_game_objects :create_game_objects alias :th_party_manager_make_save_contents :make_save_contents alias :th_party_manager_extract_save_contents :extract_save_contents end def self.create_game_objects th_party_manager_create_game_objects $game_parties = Game_Parties.new end def self.make_save_contents contents = th_party_manager_make_save_contents contents[:parties] = $game_parties contents end def self.extract_save_contents(contents) th_party_manager_extract_save_contents(contents) $game_parties = contents[:parties] || Game_Parties.new endendNote the initialization in the load method.Best practice for savefile compatibility: anything you write in `create_game_objects` or `setup_new_game`, which are called when starting a new game, should also be done in `extract_save_contents`
 
Last edited by a moderator:

Sel Feena

All your VX Ace are belong to us
Veteran
Joined
Aug 10, 2013
Messages
35
Reaction score
0
First Language
English
Primarily Uses
Thank you very much! So the game contents are essentially a Hash, and handling new 'global data' means adding a new key? Also...

class << self alias :th_party_manager_create_game_objects :create_game_objects alias :th_party_manager_make_save_contents :make_save_contents alias :th_party_manager_extract_save_contents :extract_save_contentsendThis is just for neatness' sake, organising alieses, or is something else going on here?

Again, thanks for the example, I'll have a play.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,872
First Language
English
Those are class methods so you need to alias the class methods, not instance methods.

Code:
module DataManager  alias :my_test_method :test_method  def self.test_method    my_test_method    p 'new stuff'  endend
Would not do what you want.
 
Last edited by a moderator:

Sel Feena

All your VX Ace are belong to us
Veteran
Joined
Aug 10, 2013
Messages
35
Reaction score
0
First Language
English
Primarily Uses
Ta mucho, I guess this thread can be considered closed!  :D
 

Latest Threads

Latest Posts

Latest Profile Posts

I don't know about you, but today the covid frustration is seriously getting to me. Haven't really seen many of my friends for two years, since i moved towns the year before this all started, and well, i miss them :(
so, here's a cute alpacaraptor sketch to heighten the mood:
W7Fhp9n.png
Whenever I start on a new chapter, it doesn't feel like the next episodes, but more like sequels :)
It can be frustrating that so many commercial games have used up titles that might otherwise be great for a project.
Light up explosions with QABS and Community Lighting.
qcPQHt9.gif

Forum statistics

Threads
110,656
Messages
1,054,994
Members
143,781
Latest member
Cararingo
Top