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 Posts

Latest Profile Posts

 …I think I might need to switch from standard ATK/DEF up/down buffs to parameter altering states. I just had an actor whose usual attack against an enemy does ~25 do a buffed attack against a debuffed enemy for ~600…
just saw that titan quest is free on steam until the 23rd
Zombie status is now complete. I didn't have to do much in the way of changing how healing is applied to undead targets, was just a simple 3 line code. I thought I had to overhaul Game_Action lol. Everything else was doable by events. So.. Zombie: You turn undead. Your element changes to darkness. You're weak to light, you're strong to physical attacks and healing hurts you and revival items will kill you.
My Overworld might be a mix of inspiration from 2D Final Fantasy games, Breath of Fire, Battlechasers: Nightwar, Super Mario World, and Pillars of Eternity. If I can make it more in-depth than just walking from point A to point B, that might do a lot for the gameplay experience. Hmm...

Forum statistics

Threads
115,225
Messages
1,088,218
Members
149,815
Latest member
MaeBski
Top