Right... lets try this once more...
I've been trying to code a custom Character Class Change scene, based on what I see in things like Scene_Equip and Scene_Status. It's working pretty well but I simply cannot figure one thing out. I have a handler that is processed after a class is chosen, and I want to put a message box and an "are you sure?" choice in there. Character classes in my game are exclusive - characters A and B cannot both be white mages at the same time, so their classes are swapped if they try to be and the player needs to be notified.
Calling the class change screen though the menu, picking a class and changing the character's class are all working perfectly, it's the confirmation window and message window that are causing problems.
Here is the class change scene class, where I think the problem probably lies.
class Scene_Class < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super create_class_window end #-------------------------------------------------------------------------- # * Create Class Window #-------------------------------------------------------------------------- def create_class_window @class_window = Window_ChangeClass.new(0,0,@actor) @class_window.viewport = @viewport @class_window.set_handler🙂ok, method🙂on_changeclass)) @class_window.set_handler🙂cancel, method🙂on_cancel)) @alert_window = Window_Message.new @alert_window.viewport = @viewport end #-------------------------------------------------------------------------- # * on Change Class #-------------------------------------------------------------------------- def on_changeclass # occupied contains the actor id of another actor who has this class, or -1 if none occupied = @class_window.occupied? if (occupied >= 0) otherone = $game_party.members[occupied] @alert_window.activate $game_message.add(otherone.name + " is already a using this orb. Her class will be\nchanged. Proceed?") # HERE. I WANT TO PUT A YES/NO BOX HERE. NOTHING WORKS. else @actor.change_class(@class_window.targclass?,true) @class_window.activate end end def on_cancel return_scene end
I did see this code in another support thread, and tried it, but it crashes on the last line. I assume because it needs to go through an interpreter I can't access here?
I don't anticipate it's the problem (or at least not the problem I'm thinking of) but here is a pastebin of Window_ChangeClass too. As far as I can tell this is all WAI.
I'm sure it's a lot of work deciphering my insane code, but any help or just a "forget about it" would be greatly appreciated, thanks.
I've been trying to code a custom Character Class Change scene, based on what I see in things like Scene_Equip and Scene_Status. It's working pretty well but I simply cannot figure one thing out. I have a handler that is processed after a class is chosen, and I want to put a message box and an "are you sure?" choice in there. Character classes in my game are exclusive - characters A and B cannot both be white mages at the same time, so their classes are swapped if they try to be and the player needs to be notified.
Calling the class change screen though the menu, picking a class and changing the character's class are all working perfectly, it's the confirmation window and message window that are causing problems.
Here is the class change scene class, where I think the problem probably lies.
class Scene_Class < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super create_class_window end #-------------------------------------------------------------------------- # * Create Class Window #-------------------------------------------------------------------------- def create_class_window @class_window = Window_ChangeClass.new(0,0,@actor) @class_window.viewport = @viewport @class_window.set_handler🙂ok, method🙂on_changeclass)) @class_window.set_handler🙂cancel, method🙂on_cancel)) @alert_window = Window_Message.new @alert_window.viewport = @viewport end #-------------------------------------------------------------------------- # * on Change Class #-------------------------------------------------------------------------- def on_changeclass # occupied contains the actor id of another actor who has this class, or -1 if none occupied = @class_window.occupied? if (occupied >= 0) otherone = $game_party.members[occupied] @alert_window.activate $game_message.add(otherone.name + " is already a using this orb. Her class will be\nchanged. Proceed?") # HERE. I WANT TO PUT A YES/NO BOX HERE. NOTHING WORKS. else @actor.change_class(@class_window.targclass?,true) @class_window.activate end end def on_cancel return_scene end
I did see this code in another support thread, and tried it, but it crashes on the last line. I assume because it needs to go through an interpreter I can't access here?
Code:
params = []choices = []choices.push("Yes")choices.push("No")params.push(choices)params.push(1)setup_choices(params)
I'm sure it's a lot of work deciphering my insane code, but any help or just a "forget about it" would be greatly appreciated, thanks.