KingKraken

Veteran
Veteran
Joined
Apr 2, 2015
Messages
154
Reaction score
57
First Language
English
Primarily Uses
RMMV
Hello! I'm implementing a "win quote" screen similar to something you'd see in a KOF game. The way these screens usually work, is that you pick a team of three characters and whichever of those three characters wins the match, gets their unique quote shown at the end of a fight.

My theorized way of going about this, was to simply make a single common event that sets the chosen variable to the actors ID, and apply it to every player skill. That way, whoever ended the fight, would have the variable set to them. However, I have no idea how to go about grabbing the ID of a skills user.

Anyone got any insight for this? Thank you in advance!
 

Kenen

Veteran
Veteran
Joined
Apr 3, 2012
Messages
341
Reaction score
253
First Language
English
Primarily Uses
RMMZ
What you're proposing (checking the actor ID after each skill use and presumably updating a variable continually) would work. But since it sounds like you only care about checking that information when you win the battle, you can do so when you actually win. BattleManager still knows the current subject when the victory stuff gets processed.

JavaScript:
_BattleManager_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
    var actorId = BattleManager._subject._actorId;
    _BattleManager_processVictory.call(this);
};
 

KingKraken

Veteran
Veteran
Joined
Apr 2, 2015
Messages
154
Reaction score
57
First Language
English
Primarily Uses
RMMV
What you're proposing (checking the actor ID after each skill use and presumably updating a variable continually) would work. But since it sounds like you only care about checking that information when you win the battle, you can do so when you actually win. BattleManager still knows the current subject when the victory stuff gets processed.

JavaScript:
_BattleManager_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
    var actorId = BattleManager._subject._actorId;
    _BattleManager_processVictory.call(this);
};
Thanks for the reply! I'm still pretty new to javascript so I'm not exactly sure how to apply the code.

Is the actual ID being stored in actorId or _BattleManager_processVictory in this result? I tried using either and my variable either turns into a "function" or stays at zero.

I put the script in the win condition of a battle process, but perhaps when you mean "win the battle" am I supposed to apply it in the actual troop menu for it to count?
 

Kenen

Veteran
Veteran
Joined
Apr 3, 2012
Messages
341
Reaction score
253
First Language
English
Primarily Uses
RMMZ
BattleManager.processVictory is the JavaScript function that the game runs by default when you win a battle. The code I posted hooks into that function and checks the actor ID of the current subject. From there, you can do whatever you want with that information.

In terms of application, you could copy the following code to a text editor, save it as a .js file, and install it as a plugin:
JavaScript:
_BattleManager_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
    var actorId = BattleManager._subject._actorId;
    $gameVariables.setValue(1, actorId);
    _BattleManager_processVictory.call(this);
};
Each time you win a battle, the 1st game variable will be updated with the ID of the acting actor. Which, if I'm understanding your OP correctly, is what you're trying to accomplish.

You can change the 1 in $gameVariables.setValue(1, actorId) to whatever number variable you would like to use to store the actor ID.

You could then use that stored actor ID to do other things with events or other plugins.
 

KingKraken

Veteran
Veteran
Joined
Apr 2, 2015
Messages
154
Reaction score
57
First Language
English
Primarily Uses
RMMV
BattleManager.processVictory is the JavaScript function that the game runs by default when you win a battle. The code I posted hooks into that function and checks the actor ID of the current subject. From there, you can do whatever you want with that information.

In terms of application, you could copy the following code to a text editor, save it as a .js file, and install it as a plugin:
JavaScript:
_BattleManager_processVictory = BattleManager.processVictory;
BattleManager.processVictory = function() {
    var actorId = BattleManager._subject._actorId;
    $gameVariables.setValue(1, actorId);
    _BattleManager_processVictory.call(this);
};
Each time you win a battle, the 1st game variable will be updated with the ID of the acting actor. Which, if I'm understanding your OP correctly, is what you're trying to accomplish.

You can change the 1 in $gameVariables.setValue(1, actorId) to whatever number variable you would like to use to store the actor ID.

You could then use that stored actor ID to do other things with events or other plugins.
Ah, I was overthinking it by a large margin, haha. This works straight out of the box!
Thanks for the patience and efforts!
 

Kenen

Veteran
Veteran
Joined
Apr 3, 2012
Messages
341
Reaction score
253
First Language
English
Primarily Uses
RMMZ
You’re welcome!
 

Latest Threads

Latest Profile Posts

so... I decided since a park was an area in my game... here's an enemy that's slide with a hand behind it. cause why not.
Hot chocolate and music make studying and note-taking much easier :kaoluv:
Until my hand cramps up from writing too much!
Doing RPG Maker News for 21st September 2021


Malak is still waiting for Dark Deception Chapter 4... This was him yesterday after another sugar crash.
Again, he's fine. He's just bored at this point, considering he's exhausted his entire vacation bucket list.
Am I the only one who files custom resources under specific folders to remember who to credit? :kaoswt2:
1632263519730.png

Forum statistics

Threads
115,270
Messages
1,088,481
Members
149,874
Latest member
AlolanNinetales
Top