VXAce Get Last Item ID

Hi, first of all I want to say that english is not my mother language so I apologize for any grammar mistake.

So, I'm making a game where there is a rare OP potion that can recover full HP of every party member, and if that wasn't OP enough, it can be used twice. Now, the way I'm doing this is by adding a common event to the item that simply gives you the second potion. Simple, right?

Well, it'd be simple if it was just a health potion. I also want to have MP and TP potions, but I don't want to make three common events with each giving the player just one item, it seems like a waste of space in my opinion. So what I'm trying to do is a single common event that checks the ID of the last item that has been consumed, and depending on which one it was, the player gets the corresponding potion.

And this is where the problem lies. When I checked on google, I learned that more recent makers like MV and MZ allow you to directly store the last used item's ID on a variable, or it can be manually done with the $gameParty.lastItem() script call, but VX Ace doesn't seem to have that. Is there a way to store the ID of the last used item in a variable? Any help is appreciated, thanks.
Paste this into your script editor:
Ruby:
class Game_Interpreter
  def last_item_id
    $game_party.last_item.object.id unless $game_party.last_item.object.nil?
  end
end
Now you can go to 'Control Variables', select the 'Script' option, and put this to get the item's id:
Ruby:
last_item_id
It worked! Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/get-last-item-id.180366/