Request: Open menu during messages plugin

Discussion in 'JS Plugin Requests' started by shinigamidelta, Feb 6, 2016.

    Tags:
  1. shinigamidelta

    shinigamidelta The Great and Powerful Member

    Messages:
    12
    Likes Received:
    2
    First Language:
    eng
    This is the first script of my game, you can import it to a new project data folder

    1. The first decision, chose new game+

    when you arrive at the 2nd. decision Katie, Disco, or crystal. Save your game

    When you load off the 2nd decision, It will put you back on a different route, almost as if you never made the first decision.

    View attachment Map001.json
     
    #21
  2. Krimer

    Krimer Veteran Veteran

    Messages:
    135
    Likes Received:
    101
    Location:
    Kiev, Ukraine
    First Language:
    Ukrainian
    I see, but its not the same bug. I think thats why save during choices was disallowed in Ace. I can try to look for solution but i think its to difficult for me. All what i can do now is to disable save during choice.
     
    #22
  3. shinigamidelta

    shinigamidelta The Great and Powerful Member

    Messages:
    12
    Likes Received:
    2
    First Language:
    eng
    That would be great also. ^^


    I like the first one you posted, if you can disable save during choices on that one.


    If not, I could use the second one.
     
    #23
  4. Krimer

    Krimer Veteran Veteran

    Messages:
    135
    Likes Received:
    101
    Location:
    Kiev, Ukraine
    First Language:
    Ukrainian
    after days of research i manage to do some kind of fix...


    If you still need this plugin try this version

    /*=============================================================================
    * CallMenu.js
    *=============================================================================*/

    /*:=============================================================================
    * @plugindesc v1.1 Call menu during messages\choices on map by pressing one of the standart menu keys ESC, X, Insert, NUM 0.
    * @author Krimer
    * @Help
    * If you want call menu during choices just disallow cancel in choice command.
    * Place this plugin below non-standart message systems or choice windows in
    * plugin manager for compatibility.
    * =============================================================================*/

    /*=============================================================================*/
    /* Alias */
    var _DataManager_makeSaveContents_Alias = DataManager.makeSaveContents;
    DataManager.makeSaveContents = function() {
    var contents = _DataManager_makeSaveContents_Alias.call(this);
    contents.message = $gameMessage;
    return contents;
    };

    /* Alias */
    var _DataManager_extractSaveContents_Alias = DataManager.extractSaveContents;
    DataManager.extractSaveContents = function(contents) {
    _DataManager_extractSaveContents_Alias.call(this, contents);
    $gameMessage = contents.message;
    };

    /* Alias */
    var _Scene_Map_update_Alias = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function() {
    _Scene_Map_update_Alias.call(this);
    if (Input.isTriggered('escape') && $gameMessage.isBusy()) {
    this.callMenu();
    }
    };

    /* OVERWRITE */
    Window_Message.prototype.isTriggered = function() {
    return (Input.isRepeated('ok') || TouchInput.isRepeated());
    };

    /* OVERWRITE */
    Window_ChoiceList.prototype.updatePlacement = function() {
    var positionType = $gameMessage.choicePositionType();
    var messageY = this._messageWindow.y;
    this.height = this.windowHeight();
    switch (positionType) {
    case 0:
    this.x = 0;
    break;
    case 1:
    this.x = (Graphics.boxWidth - this.width) / 2;
    break;
    case 2:
    this.x = Graphics.boxWidth - this.width;
    break;
    }
    if (messageY >= Graphics.boxHeight / 2) {
    this.y = messageY - this.height;
    } else {
    this.y = messageY + this._messageWindow.height;
    }
    };

    /* OVERWRITE */
    Window_ChoiceList.prototype.windowWidth = function() {
    return Graphics.boxWidth;
    };

    /* OVERWRITE */
    Window_ChoiceList.prototype.drawItem = function(index) {
    var rect = this.itemRectForText(index);
    this.drawTextEx(this.commandName(index), rect.x, rect.y);
    this.width = this.maxChoiceWidth() + this.padding * 2;
    this.updatePlacement();
    };

    /* NEW */
    Game_Interpreter.prototype.previousInterpreterCommand = function(){
    this._index -= 1;
    };

    /* NEW */
    Game_Interpreter.prototype.previousEventCode = function(){
    return this._list[this._index-1].code;
    };
    /* NEW */
    Game_Interpreter.prototype.currentEventIndex = function(){
    return this._index;
    };

    /* Alias */
    var _Scene_Save_onSavefileOk_Alias = Scene_Save.prototype.onSavefileOk;
    Scene_Save.prototype.onSavefileOk = function() {
    if ($gameMessage.choices().length != 0 && $gameMap._interpreter._waitMode == "message"){
    $gameMessage.clear();
    interpreter = $gameMap._interpreter;
    if (interpreter.previousEventCode() == 102){
    for (;;) {
    interpreter.previousInterpreterCommand();
    if (interpreter.currentEventIndex() != 0){
    if (interpreter.previousEventCode() != 401 && interpreter.previousEventCode() != 101) break;
    if (interpreter.nextEventCode() == 101) break;
    } else {
    break;
    }
    };
    };
    };
    _Scene_Save_onSavefileOk_Alias.call(this);
    };

    /* End of File */
    /*=============================================================================*/

    This is almost like previous but now i hope it properly save and load during choice.


    If you want different key for call menu, find this:


    if (Input.isTriggered('escape') && $gameMessage.isBusy()) {


    and change 'escape' to any value from "Input.keyMapper" in "rpg_core.js" or any value from any full input plugin if you using one.


    UPD: I create own topic for this plugin.
    Link - you can find latest version here..
     
    Last edited: Nov 13, 2018
    #24
    ZephyrLightningheart likes this.
  5. shinigamidelta

    shinigamidelta The Great and Powerful Member

    Messages:
    12
    Likes Received:
    2
    First Language:
    eng
    So I started using your newer version. It seems to be working fine.


    The only problem now is, If the choices are to long, they cut off some of the letters.


    I tried messing with some of the numbers in the plugin, chaning the 2's. but I couldn't get it to work like normally.


    but when i open the menu and close it, the choices reappear as normal


    asd.png
     
    Last edited by a moderator: Mar 21, 2016
    #25
  6. Krimer

    Krimer Veteran Veteran

    Messages:
    135
    Likes Received:
    101
    Location:
    Kiev, Ukraine
    First Language:
    Ukrainian
    i forgot to update version here. I fix some minor bugs long time ago.


    Latest version

    Code:
    
    /*=============================================================================
     *  CallMenu.js
     *=============================================================================*/
    
    /*:=============================================================================
    * @plugindesc v1.2 Call menu during messages\choices on map by pressing one of the standart menu keys ESC, X, Insert, NUM 0.
    * @author Krimer
    * @help
    * If you want call menu during choices just disallow cancel in choice command.
    * Place this plugin below non-standart message systems or choice windows in
    * plugin manager for compatibility.
    * =============================================================================*/
    
    /*=============================================================================*/
    /* Alias */
    var _DataManager_makeSaveContents_Alias = DataManager.makeSaveContents;
    DataManager.makeSaveContents = function() {
        var contents = _DataManager_makeSaveContents_Alias.call(this);
        contents.message      = $gameMessage;
        return contents;
    };
    
    
    /* Alias */
    var _DataManager_extractSaveContents_Alias = DataManager.extractSaveContents;
    DataManager.extractSaveContents = function(contents) {
        _DataManager_extractSaveContents_Alias.call(this, contents);
        $gameMessage       = contents.message;
    };
    
    /* Alias */
    var _Scene_Map_update_Alias = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function() {
        _Scene_Map_update_Alias.call(this);
        if (Input.isTriggered('escape') && $gameMessage.isBusy() && $gameSystem.isMenuEnabled()) {
            this.callMenu();
        }
    };
    
    /* OVERWRITE */
    Window_Message.prototype.isTriggered = function() {
        return (Input.isRepeated('ok') || TouchInput.isRepeated());
    };
    
    /* Alias */
    var Window_ChoiceList_WidthEx_Alias = Window_ChoiceList.prototype.textWidthEx;
    Window_ChoiceList.prototype.textWidthEx = function(text) {
        try {
            return Window_ChoiceList_WidthEx_Alias.call(this, text);
        }
        catch(e) {
            return;
        }
    };
    
    /* NEW */
    Game_Interpreter.prototype.previousInterpreterCommand = function(){       
      this._index -= 1;
    };
    
    /* NEW */
    Game_Interpreter.prototype.previousEventCode = function(){
        return this._list[this._index-1].code;
    };
    
    /* NEW */
    Game_Interpreter.prototype.currentEventIndex = function(){
        return this._index;
    };
    
    /* Alias */
    var _Scene_Save_onSavefileOk_Alias = Scene_Save.prototype.onSavefileOk;
    Scene_Save.prototype.onSavefileOk = function() {
        if ($gameMessage.choices().length != 0 && $gameMap._interpreter._waitMode == "message"){
            $gameMessage.clear();
            interpreter = $gameMap._interpreter;
            if (interpreter.previousEventCode() == 102){
                for (;;) {
                    interpreter.previousInterpreterCommand();
                    if (interpreter.currentEventIndex() != 0){
                        if (interpreter.previousEventCode() != 401 && interpreter.previousEventCode() != 101) break;
                        if (interpreter.nextEventCode() == 101) break;
                    }    else {
                        break;
                    }
                };
            };
        };
        _Scene_Save_onSavefileOk_Alias.call(this);
    };
    
    
    /* End of File */
    /*=============================================================================*/


    UPD: I create own topic for this plugin.
    Link - you can find latest version here..
     
    Last edited: Nov 13, 2018
    #26
    shinigamidelta likes this.
  7. shinigamidelta

    shinigamidelta The Great and Powerful Member

    Messages:
    12
    Likes Received:
    2
    First Language:
    eng
     
    Last edited by a moderator: Apr 14, 2016
    #27
  8. Kemezryp

    Kemezryp it's me Veteran

    Messages:
    36
    Likes Received:
    3
    Location:
    Poland
    First Language:
    Polish
    Your plugin is not compatible with Yanfly Extension Message Pack 1.
    I fixed that by editing line 66:
    this.width = this.maxChoiceWidth() + this.padding * 2
    and removing existing line 95.
    this.updatePlacement();
    Everything works for me now. Thanks for plugin!

    QUICK EDIT: I modified v1.0. Didn't see there was v1.2, but this version doesn't work for me anyway, I'm not surprised tho, since i have lotta plugins.
     
    Last edited: Aug 28, 2018
    #28
  9. kako05

    kako05 Veteran Veteran

    Messages:
    88
    Likes Received:
    4
    First Language:
    Australian
    Primarily Uses:
    RMMV

Share This Page