Help with custom battle system fix [RESOLVED]

Hi all,


I have had a battle system written for me but there is a game crashing bug which I'm trying to fix.


I get a TypeError, cannot read property 'setItem' of undefined, when I try to use an item after an actor has been revived, if they haven't been revived it all works fine but as soon as they do that's when I get the issue. This bit of code seems to be the problem


    Scene_Battle.prototype.onItemOk = function() {
        var item = this._itemWindow.item();
        var action = BattleManager.inputtingAction();
        action.setItem(item.id);
        $gameParty.setLastItem(item);
        this.onSelectAction();
    }; 


Does anyone have any ideas to point me in the right direction with this?


Thanks in advance


EDIT: I've put this up in commercial request for a fix if anyone is interested in helping for a fee
This can be closed as it is being resolved 😀

Original thread: https://forums.rpgmakerweb.com/threads/help-with-custom-battle-system-fix-resolved.58440/