Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: shintashi on December 15, 2010, 11:53:03 pm

Title: Exp tables dont change When Switching Class?[XP]
Post by: shintashi on December 15, 2010, 11:53:03 pm
Here's the script I'm using for multiple experience tables in Game Actor:




#--------------------------------------------------------------------------
# * Calculate EXP
#--------------------------------------------------------------------------

 def make_exp_list
   actor = $data_actors[@actor_id]
   case actor.class_id
   when 1 #Artist, Normals
   @exp_list = {
     1 => 0,
     2 => 1250,
     3 => 2500
     }      
 
     when 7 #Psionicist
   @exp_list = {
     1 => 0,
     2 => 2200,
     3 => 4400
     }
   when 8 #Skeptic (they get anti-psi)
   @exp_list = {
     1 => 0,
     2 => 2500
     }    
    else #fighter, Etc.
         @exp_list = {
     1 => 0,
     2 => 2000,
     3 => 4000
     }
     end #end case
 end # end exp list
 


it's a rewrite of the standard exp code.


When I use an event to switch classes, everything changes except the Experience Table. I understand the original RMXP tables are all the same, so I don't really know where to begin in asking the computer to check if my actor's experience tables should be rechecked to fit a new class. I stupidly assumed it would just change them over, but I now realize these tables are loaded on initialization, I just don't know Ruby well enough to re-initialize the tables, or whatever it is I have to do.


edit: so far the only way I know to fix it is to create more characters with alternative classes. Once the class is fixed, it's like it's frozen in place for time and eternity. It's a hash inside the Super of setup for initialize, and for some reason "make_exp_list" can't have an attr accessor or be a global without crashing. i think this is what's happening - it reads "make_exp_list" once during setup, and since setup is never initialized again, it can't be triggered externally.
Title: Re: Exp tables dont change When Switching Class?[XP]
Post by: ForeverZer0 on December 17, 2010, 12:33:10 pm
How are you switching classes? I can't be sure off the top of my head, but I believe that if you change the class, it will not save (meaning $data_actors, $data_classes, etc, etc) will all remain the same. I don't have RMXP open in front of me at the moment (at work), but it may be reading the experience tables off of those variables, which will be wrong, since they are remaining untouched.

BTW: "make_exp_list" is a method. No need for an attr_accessor, which are used for variables.