MZ Check ActorID of last actor to use a Field Skill (from menu, not battle)

Hello! I'd hoped this'd be relatively simple but I'm at a brick wall!

I'm using VS Field Skills and want to have different conditions in the event depending on which character used that skill. Visually I just want to show each individual character casting the spell, depending on which character was selected to use it.

In this case, for your visualisation, I'm using Fire in a passive way which can light torches, whilst also being a regular fire spell in battle.

There seem to be a bunch of ways to set a variable to the last actor to use a skill, but I can't seem to get them to work and I'm assuming it's because these methods rely on the skill being used in combat. I'm looking for a field only, out of combat option to check which actor last used a skill (either a specific skill or I guess the last to use any skill would work here).

I tried the v[X] = a.isActor() in the damage formula, but since the Field Skill use doesn't do damage, I didn't expect this to work.

I found the script $gameParty.menuActor().actorId() with my supreme googling but I can't get this to work.

Screenshot 2026-01-12 115704.png


My current attempt is utilising the in-engine method; Control Variables -> Game Data -> Last -> Last Actor ID to Act
but to no avail:

Screenshot 2026-01-12 114423.png


There's no actual movement events in here, just some test textboxes. I can't get the text "Skill actor 2" to appear, and I'm using the skill with a bunch of actors, including who I think should be Actor 2 here.

Pay no mind to the berating tone of these messages; they're for me <3

Can a kind soul shed any light?
Not having the original plugin because it's paywalled makes it a bit trickier, but I'm sure we trick a little bit.

Create a new plugin with any name and paste this:

JavaScript:
/*:
 * @target MZ
 */

(function() {

const _GameActor_setMp = Game_Actor.prototype.setMp;
Game_Actor.prototype.setMp = function(mp) {
    _GameActor_setMp.call(this, mp);
    
    $gameVariables.setValue(1, this.actorId()); // <--
}

})()

Everytime, the MP of any of your heroes changes, it puts the Actor ID of the affected actor into Game Variable 1. Replace the number accordingly.

So, my idea is, that Visustella changes the MP when spelling out a field skill, and this triggers my plugin to write the actor Id into a game variable.
@Aerosys that's a fantastic idea! Thank you. It's not working right now though, but possibly an error on my part.

I've loaded it in as a plugin, unchanged. I'm using Variable 1 (Actor MP Changed), tested using Fire with Actors 0001, 0002, and 0003 but it's not triggering any of these text boxes.

Am I missing a step? Do I need to call the plugin to fetch the variable manually perhaps?

Screenshot 2026-01-12 131336.png



EDIT: To add context to the VS Field Skills plugin - as far as I know, its involvement stops as soon as you use the field skill and trigger the common event specified in that skill's notetags. From that point, it should just be regular eventing.

The Field Skill is triggering a Common Event that checks the region ID you're stood on and ultimately just turns on a Switch if you're on the right Region. Other than that, the main meat of the spellcasting event itself is contained to separate events on a map (the above screenshot is in the map event, not the common event). Each map event then has a check to see if you're stood near it, and turns itself off if you're not. Probably unnecessary context to have here but I thought I'd share it.

EDIT2: To confirm, yes the characters' MP is actually being spent when using the skills. I'm hoping to also use this variable in else branches in the common event to refund the MP of that character if there isn't anything that spell can interact with nearby.
After using the field skill, what are the values for game variables 1, 2, and 3? I would make sure they match the if condition.

If they do, then your event isn't triggering.
Did my code snippet work and put a legit number into the "Actor MP" Variable? You can check it by pressing F9 in testplay.
Did my code snippet work and put a legit number into the "Actor MP" Variable? You can check it by pressing F9 in testplay.

Ah, it does not - tested after having each actor use Fire (MP is depleting) and the variable stands at 0.
I have this plugin because it was bundled with front view UI. There's the actor method in that window to get the actor. Modify the processOk, think that should work:

Window_FieldSkillList.prototype.processOk = function() {
if (this.isCurrentItemEnabled()) {
$gameVariables.setValue(10, this.actor().actorId());
this.playOkSound();
this.updateInputData();
this.deactivate();
this.callOkHandler();
} else {
this.playBuzzerSound();
}
};
@Rpg
I have this plugin because it was bundled with front view UI. There's the actor method in that window to get the actor. Modify the processOk, think that should work:

Window_FieldSkillList.prototype.processOk = function() {
if (this.isCurrentItemEnabled()) {
$gameVariables.setValue(10, this.actor().actorId());
this.playOkSound();
this.updateInputData();
this.deactivate();
this.callOkHandler();
} else {
this.playBuzzerSound();
}
};

This is the way!

Thank you everybody for your help! <3

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/check-actorid-of-last-actor-to-use-a-field-skill-from-menu-not-battle.181915/