Single Actor Menu Target

Discussion in 'JS Plugin Requests' started by ArcheoFox, Feb 4, 2018.

  1. ArcheoFox

    ArcheoFox Novice Veteran

    Messages:
    36
    Likes Received:
    27
    Location:
    Switzerland
    First Language:
    French
    I have a major compatibility problem with the plugin from Yanfly “ItemCore” and Galv's plugin named "Single Actor Menu Target".

    The problem is when I use an item on the map menu, an error message appears and contains these errors:

    TypeError: Cannot read property ‘isDead’ of undefined
    at Game_Action.testApply (-----/js/rpg_objects.js:1568:46)
    at Scene_Item. (-----/js/rpg_scenes.js:997:23)
    at Array.some (native)
    at Scene_ItemBase.isItemEffectsValid (-----/js/rpg_scenes.js:996:36)
    at Scene_ItemBase.canUse (-----/js/rpg_scenes.js:990:52)
    at Scene_ItemBase.onActorOk (-----/js/rpg_scenes.js:939:14)
    at Scene_Item.onItemOk (-----/js/plugins/Galv_SingleActorMenuTarget.js:81:9)
    at Window_ItemList.Window_Selectable.callHandler (-----/js/rpg_windows.js:896:31)
    at Window_ItemList.Window_Selectable.callOkHandler (-----/js/rpg_windows.js:1165:10)
    at Window_ItemList.Window_Selectable.processOk (-----/js/rpg_windows.js:1150:14)

    I only have these two plugins that are active and Galv confirms that there seems to be a compatibility problem.
    Has anyone ever had the same problem? And can someone please help me? I really need to run these two plugins together.
     
    #1
  2. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Assuming you have Yanfly first, and Galv second, this little patch plugin should get you fixed. (I tested it on a blank project and it fixed the error.)

    Just paste into a text editor, save as a .js file in your plugins folder, and add it to your game (below the other two).
    Code:
    //Patches YEP_ItemCore.js v1.28 and Galv_SingleActorMenuTarget.js v1.0
    
    Scene_ItemBase.prototype.itemTargetActors = function() {
        var action = new Game_Action(this.user());
        action.setItemObject(this.item());
        if (!action.isForFriend()) {
            return [];
        } else if (action.isForAll() || Galv.SAMT.oneMember()) {
            return $gameParty.members();
        } else {
            return [$gameParty.members()[this._actorWindow.index()]];
        }
    };
     
    #2
    Canini and ArcheoFox like this.
  3. ArcheoFox

    ArcheoFox Novice Veteran

    Messages:
    36
    Likes Received:
    27
    Location:
    Switzerland
    First Language:
    French
    Thank you so much ! This solves the problem with a blank project. Nevertheless, with my project (which contains more than 200 plugins) it poses problems. If I can identify conflicts, I'll come back here. Anyway, I'm sure it will allow me to fix the problem in the end, so thank you again. If I use that, can I credit yourself? With wich name?
     
    #3
  4. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Ah, sorry, when you said you had only those two active, I assumed you meant in your entire project, not as a troubleshooting step. Yes, with 200 plugins, you're going to have conflicts. That's a lot of plugins!

    You don't need to credit me, it's a simple fix.

    I've been digging at it a little more. I can't figure out a way to put a proper patch on this [and ensure maximum plugin compatibility], so try instead making the following one-line edit to Galv's code (this is allowed by his Terms of Use):

    Find the block starting with "Galv.SAMT.Scene_Item_onItemOk". (There's also a Scene_Skill block...make sure it's the Scene_Item block!) Change the "if" statement to the following:
    Code:
            if (Galv.SAMT.oneMember()) {
                SceneManager._scene._actorWindow._index = 0; //edit added for plugin compatibility
                this.onActorOk();
                this.onActorCancel();
            }
    Once you do that, ditch my patch plugin.
     
    #4
    ArcheoFox and Canini like this.
  5. ArcheoFox

    ArcheoFox Novice Veteran

    Messages:
    36
    Likes Received:
    27
    Location:
    Switzerland
    First Language:
    French
    I tried with your new method (and with only these two plugins) but unfortunately the selection of my only player is still.
    It works for you with only "ItemCore" and "Galv.SAMT (edit version)" plugins?

    I have another problem that I did not notice before: with the patch version (your first method), when I use a potion, that I return to the categories of items and that I select another one, it does not cancel my item selection while I am no longer supposed to be there.

    I'm not sure if I'm clear, my english is a bit limited ^^ '
     
    Last edited: Feb 7, 2018
    #5
  6. Amerrigan

    Amerrigan Villager Member

    Messages:
    27
    Likes Received:
    4
    First Language:
    English
    Primarily Uses:
    RMMV
    Just a note I'd like to add in case anyone searches for this fix in the future and finds this thread when trying to get the compatibility to work:

    I have the YEP Item core and the Galv Single Actor running. I have used the patch above as a new plug in. (The first one.) It worked well.

    However... there is still one minor bug to be aware of.

    Here is an example: If you have an item that you wish to be able to use to trigger a common event on the map, you would usually put the scope as 'none', just because it logically doesn't have a scope. But, if you have the item's 'scope: none', then it will only return a fail sound. (Note: Before the patch was installed, doing this would just crash the game).

    Here is the fix: If you instead set an item's scope to 'scope: The User' it will work and trigger the event the way it is intended. So, pay attention to scopes if you plan on using the YEP/GALV/PATCH method to make a single actor game.
     
    #6
  7. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @ArcheoFox yes I was using a blank project with only those two plugins and the patch.

    Unfortunately I am not able to troubleshoot further right now; I simply don't have the time. I wanted to let you know so that you can try to find someone else to help. My apologies.
     
    #7

Share This Page