Thank you again for the help. Originally, I thought I had it working, but more problems arose as I moved forward. Now, it is late in the evening, so I cannot provide a full explanation of everything. However, I just thought it might be useful to give some feedback. Again, thank you to everyone for the ideas!
Try using @interpreter.wait_for_message
I wasn't able to get this to work.
-disregard, Fibers don't work that way-
Edit: I say to move your stuff to a common event and have the script call it. You're trying to work with Game_Interpreter methods in an area that doesn't even handle events.
This worked pretty well, but I eventually ran into a problem.
I basically just need to add a custom message and change the actor's graphics whenever the actor changes class. It needs to work on the field or in battle, because I have some items that change class, and you can also change class when you level up. With my current setup, when multiple actors change class at the same time, all the classes change correctly, but the messages only show up for the last actor in the party.
The way that I had it setup was that I simply aliased the Game_Actor.change_class method and added $game_variables[3] = self.id, $game_variables[5] = self.class.id, and $game_temp.reserve_common_event(5) at the end. Common event #5 uses game variables 3 and 5 to work out the necessary messaging and graphics changes. See below:
Code:
class Game_Actor < Game_Battler
alias evolution_change_class change_class
def change_class(class_id, keep_exp = false)
$game_variables[3] = self.id # actor id
evolution_change_class(class_id, keep_exp)
$game_variables[5] = self.class.id # new class id
#$game_message.add("test " + $game_variables[3].to_s)
#SceneManager.scene.update_basic while $game_message.busy?
$game_temp.reserve_common_event(5)
end
It worked, but it only ran the common event once using the variables and parameters that would have been setup for the last actor. All previous actors were "skipped". I'm not really sure how the reserve_common_event method works, so maybe I am simply using it wrong. The "test" messaging (when not commented out) will trigger once for each actor that levels up before the common event happens once. Perhaps when the common event is called, it is unable to break out of the script processing, and it needs to wait until the script ends? Thus, multiple common events get stacked up waiting to happen, and then they only have the most recent version of the game variables, so it only seems to apply to the most recent actor?
@Malchar You might need to do something like:
Code:
interpreter = $game_map.interpreter if SceneManager.scene_is?(Scene_Map)
# text and things go here
interpreter.wait_for_message
EDIT: updated the code; don't think you need to use the interpreter if it's at the end of battle.
This works in the field, but it doesn't work after battle.
Just make your own custom wait, for example
Code:
SceneManager.scene.update_basic while $game_message.busy?
This worked for field and battle. I'll try moving forward with this code. I had been using a common event, but per the problem I explained above, I'll have to move everything into the script. I will provide additional updates, and I might even make a whole thread if needed. I just need some time to work out a few things first.