Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Adding variables to a RPG class

Hello.

I'm trying to add variables to the RPG::Skill class but it's not working at all.

Here's the code I wrote.
Code:
class RPG::Skill
  attr_accessor  :completion
  alias dargor_rpg_skill_initialize initialize
  def initialize
    dargor_rpg_skill_initialize
    @completion = []
  end
end

What's the problem?
Any help would be appreciated.

Thanks in advance!
-Dargor
 
The reason why it does not work is because all of those RPG::Whatever objects are already created (not at Game.exe runtime), when you do stuff in the database it automatically creates those objects you see and saves it to the data folder under the name Whatever.rxdata and then when the game is run the files are loaded using load_data (which is really just Marshal.load except that it can read encrypted files)

so you will have to give those new variables you add a value before you do anything with them, how you do this is up to you
 
Yes, though do not change the variables that are already there that can be edited using the database to a value that isn't accepted. You can but if you try to edit the data it will ask for an acceptable value :p
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top