- Joined
- Feb 1, 2014
- Messages
- 39
- Reaction score
- 15
- First Language
- Portuguese
So this is the issue I have currently presented to myself.
The Already Done
Since I decided to learn RGSS3 I started out trying to make a simple script, that turned out to not be so simple after all.
The Side Problem
I can change the name of the class simply by using the code:
However. There is the slight problem that this change is not recorded. Because "$data_classes" ( or any of the "$data_..." variables as far as I can tell) saved in the savefile so, when I close the game and load the game after I have ran that code, the change never took place.
After some looking arround in the code I realize that all the saved values go in "$game_..." variables that are then put into a "contents" array that is then saved.
My thought is that I need to create a new variable lets say "$game_class_upgrad" and save my changes on that variable. (Which I have a slight idea how to do... not sure I must say) I belive I must so something like this code that was very much based on a script that is (linked on the end of this post)
(I'm preaty sure I can work out how to use that variable correctly but any help would be nice)
The Point
The biguest issue would be that, as far as I can figure out, the only way I would be able to change the name of the class would change the class name permanently for as long as the game was open.
So lets say you open the game and upgrade your class, the class name will change. Then you quit to title start the game again and open the menu, your class will still have the altered name.
So even if I manage to save and load the values correctly, since it doesn't seam like the game saves the Classes at all, I still have the problem that it would alter the default game Database, I would have then to save this data somewhere, somehow and then display it instead of the default text.
What would be the best way to do this?
I thank everyone that helps me out already in advance and sorry if I rambled a bit in this post but at least the last few things came to my mind while writing it.
Note: The "add_feature" function as well as the base for the content saving, loading code, are from the script Dynamic Features: http://forums.rpgmakerweb.com/index.php?/topic/19645-dynamic-features/ by Shaz I removed some code that would be in there for I didn't feel it would be right to have it apear. I do however belive that looking deeper into the code of this script might help me figure out what to do.
Note 2: There might be something very wrong that I am doing on the line "gi = Game_Interpreter.new" this isn't a very big issue I believe but still if someone could point me out if this is what I should be doing or if I am making a mistake I would apreciate it.
The Already Done
Since I decided to learn RGSS3 I started out trying to make a simple script, that turned out to not be so simple after all.
class Class_Upgrade def upgradeAllActors actor_index = 1 while(actor_index < $data_actors.length) upgradeActor(actor_index) actor_index = actor_index + 1 end end def upgradeActor(actor_id) changeName(actor_id) changeSkillTypes(actor_id) changeWeaponTypes(actor_id) changeArmorTypes(actor_id) end def changeName(actor_id) $data_classes[$data_actors[actor_id].class_id].note[/.*<upgrade name:\s*([a-zA-Z\s]*)>.*/im] if $1 != nil && $1 != "" $data_classes[$data_actors[actor_id].class_id].name = $1 end end def changeSkillTypes(actor_id) $data_classes[$data_actors[actor_id].class_id].note[/.*<upgrade skill type:\s*([0-9,\s]*)>.*/im] if $1 != nil && $1 != "" vector = $1.split(',') gi = Game_Interpreter.new for id in vector gi.add_feature
class, actor_id, :stype_add,id.to_i) end end end def changeWeaponTypes(actor_id) $data_classes[$data_actors[actor_id].class_id].note[/.*<upgrade weapon type:\s*([0-9,\s]*)>.*/im] if $1 != nil && $1 != "" vector = $1.split(',') gi = Game_Interpreter.new for id in vector gi.add_feature
class, actor_id, :equip_wtype,id.to_i) end end end def changeArmorTypes(actor_id) $data_classes[$data_actors[actor_id].class_id].note[/.*<upgrade armor type:\s*([0-9,\s]*)>.*/im] if $1 != nil && $1 != "" vector = $1.split(',') gi = Game_Interpreter.new for id in vector gi.add_feature
class, actor_id, :equip_atype,id.to_i) end end endend
I can change the name of the class simply by using the code:
def changeName(actor_id) $data_classes[$data_actors[actor_id].class_id].note[/.*<upgrade name:\s*([a-zA-Z\s]*)>.*/im] if $1 != nil && $1 != "" $data_classes[$data_actors[actor_id].class_id].name = $1 endend
After some looking arround in the code I realize that all the saved values go in "$game_..." variables that are then put into a "contents" array that is then saved.
My thought is that I need to create a new variable lets say "$game_class_upgrad" and save my changes on that variable. (Which I have a slight idea how to do... not sure I must say) I belive I must so something like this code that was very much based on a script that is (linked on the end of this post)
#-------------------------------------------------------------------------- # * Create Game Objects #-------------------------------------------------------------------------- def self.create_game_objects x_dynamic_features_create_game_objects $game_class_upgrade = {} end #-------------------------------------------------------------------------- # * Create Save Contents #-------------------------------------------------------------------------- def self.make_save_contents contents = x_dynamic_features_make_save_contents contents[:cunames] = $game_class_upgrade ? $game_class_upgrade : {} contents end #-------------------------------------------------------------------------- # * Extract Save Contents #-------------------------------------------------------------------------- def self.extract_save_contents(contents) x_dynamic_features_extract_save_contents(contents) $game_class_upgrade = contents[:cunames] ? contents[:cunames] : {} end
The Point
The biguest issue would be that, as far as I can figure out, the only way I would be able to change the name of the class would change the class name permanently for as long as the game was open.
So lets say you open the game and upgrade your class, the class name will change. Then you quit to title start the game again and open the menu, your class will still have the altered name.
So even if I manage to save and load the values correctly, since it doesn't seam like the game saves the Classes at all, I still have the problem that it would alter the default game Database, I would have then to save this data somewhere, somehow and then display it instead of the default text.
What would be the best way to do this?
I thank everyone that helps me out already in advance and sorry if I rambled a bit in this post but at least the last few things came to my mind while writing it.
Note: The "add_feature" function as well as the base for the content saving, loading code, are from the script Dynamic Features: http://forums.rpgmakerweb.com/index.php?/topic/19645-dynamic-features/ by Shaz I removed some code that would be in there for I didn't feel it would be right to have it apear. I do however belive that looking deeper into the code of this script might help me figure out what to do.
Note 2: There might be something very wrong that I am doing on the line "gi = Game_Interpreter.new" this isn't a very big issue I believe but still if someone could point me out if this is what I should be doing or if I am making a mistake I would apreciate it.
Last edited by a moderator:
