How do I find the actorId (the actor using a specific skill) during battle

winkr7

Veteran
Veteran
Joined
Oct 27, 2015
Messages
99
Reaction score
31
First Language
english
Primarily Uses
N/A
Hello;

I have a move skill that is a battle skill and I want to call a common event whenever that skill is used during battle that tells me which actorId is using the skill. I can see the skill getting used but BattleManager.actor() inside the common event seems to be null when the skill is used. And BattleManager.actor() is a battler not an ID anyway. So how do I get the actorId?

I just want a line in my common event to work--console.log( " Move Skill actorId:"+your answer here) to print out the actor Id of the skill user.

thanks for your time
yours
winkr7
 

Alistair

Treasure Hunter
Veteran
Joined
Jun 15, 2014
Messages
283
Reaction score
196
First Language
English
Primarily Uses
RMMV
BattleManager.actor().actorId() returns the id.
 

winkr7

Veteran
Veteran
Joined
Oct 27, 2015
Messages
99
Reaction score
31
First Language
english
Primarily Uses
N/A
Thanks Alistair. When I try this in the Attack skill I get a null. This is probably because it is targeting an enemy and so there is no actor. I appreciate your help.
 

Alistair

Treasure Hunter
Veteran
Joined
Jun 15, 2014
Messages
283
Reaction score
196
First Language
English
Primarily Uses
RMMV
Hello,

you could alternatively use "$gameVariables.setValue(x, a.actorId());0" in your skill's damage formula and use console.log($gameVariables.value(x) + "text") in your common event. Replace both x with any variable number.

If your skill is supposed to deal damage, then just replace the 0 after the semicolon with your usual damage formula.
 

Coelocanth

Veteran
Veteran
Joined
Oct 10, 2018
Messages
42
Reaction score
69
First Language
English
Primarily Uses
RMMV
If you're trying to do this from a common event run by the skill:
Use "control variables" / "game data" / "last" - it can assign skill id, actor id / target id etc to variables.
(New feature of MZ so you don't need to script call as you did in MV)
 

winkr7

Veteran
Veteran
Joined
Oct 27, 2015
Messages
99
Reaction score
31
First Language
english
Primarily Uses
N/A
Many thanks Coelocanth--that is just the thing I needed. I had not seen this new feature.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,883
First Language
English
BattleManager.actor() is actually the "inputting actor", which doesn't exist when your skill is performed. That's why you're getting null.
 

41728280

Veteran
Veteran
Joined
May 31, 2020
Messages
240
Reaction score
73
First Language
Chinese
Primarily Uses
RMMV
I also have this need. Can anyone tell me how the MV can get the actorId of the current action in battle?
 

Latest Threads

Latest Posts

Latest Profile Posts

A video update on the progress I've been making on the cutscenes. :kaosalute:

I wonder if color LUTs is possible for RPG Maker. It would be game changer and can replace the not so good looking tint screen
new mechanic in battle where you can mentally erase enemies when you deplete all their MP instead HP. this gives you a special item of their "memory". it's pretty to do in battle so far.
Apparently MZ lets you preview move routes in the move route editor without having to start up test game. That could save a lot of time during development compared to MV, especially for a long game that uses a lot of event movement for cutscenes.
A repost of an old meme I had made, now with music

Forum statistics

Threads
115,863
Messages
1,093,555
Members
151,083
Latest member
pasted
Top