Small modification for Yanfly Item Core (delenting sub-window)

Discussion in 'JS Plugin Requests' started by vegetamaker, Oct 18, 2018.

    Tags:
  1. vegetamaker

    vegetamaker Warper Member

    Messages:
    3
    Likes Received:
    1
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Hello and thanks for your time. Let me explain what I am looking for. I am using Yanfly Item Core, but it has a feature that I don't like so much.

    When you use an item in game menu it appears a secondary window to confirm the use or cancel. It is there just in case you need add more things to do with them, but it isn't my case. So... it becomes really unfriendly for the player.

    Thats why I want to delete it and I tried it myself. Let me post what I was trying.

    The first thing I did was localize where the sub-window was creating. I am not complety sure how it works, but I located where the window was created (or called?). In the line 2035.

    After that I tried to localize where the "use" was called, It is in the line 2163.

    So I did a call ( Scene_Item.prototype.onActionUse.call(); ) to the function from 2163 inside 2035. Of course it crashed because, I suppose, it isn't taking the correct parameters in some way.

    I promise I was trying to understand it for many hours, but I must admit that I can't continue alone.

    Link to the plugin: http://yanfly.moe/2015/10/16/yep-11-item-core/

    Again, thanks for your time and sorry for my English.
     
    #1
    Aloe Guvner likes this.
  2. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,239
    Likes Received:
    793
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    We might have different versions, because I found the function on a different line. Here's the function that is called when the player first clicks the item:
    Code:
    Scene_Item.prototype.onItemOk = function() {
        var item = this.item();
        this._itemActionWindow.setItem(item);
    };
    Normally, it opens the Window_ItemActionCommand that asks the player to 'use' or 'cancel'.

    Instead, you can just comment out those lines and call 'onActionUse' instead.
    Code:
    Scene_Item.prototype.onItemOk = function() {
        // var item = this.item();
        // this._itemActionWindow.setItem(item);
        this.onActionUse();
    };
     
    #2
    vegetamaker and Uzuki like this.
  3. vegetamaker

    vegetamaker Warper Member

    Messages:
    3
    Likes Received:
    1
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Oh my god, worked like a charm!

    We had the same version, but my "knowledge" show me the wrong way ^^.

    I guess I'll try to find a way to check if the items is usable or not (I saw a fuction over there for it). So items will not sound if they are't usable.

    Thanks so much for your time!
     
    #3

Share This Page