Single Actor Menu Target

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:

Spoiler: error message
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.
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()]];
    }
};
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?
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.
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 ^^ '
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.
@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.
I hope it's ok to gravedig this thread, but the problem appears to go beyond ItemCore. I'm using YEP Message Core and MainMenu Core and getting the same error (those are the only YEP plugins I'm using)

Original thread: https://forums.rpgmakerweb.com/threads/single-actor-menu-target.90853/