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

Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.
E_6fAErVkAQILXu.png
I'm so close to releasing my game on steam! :blush::blush::blush:
Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the Modern British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.

Forum statistics

Threads
115,287
Messages
1,088,660
Members
149,913
Latest member
badalias
Top