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

If you still don't subscribe our Polish channel please consider it :)
1.png
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.
A lot to learn to make a game. Can I handle it?
I've been working on status effects since last thursday, and today I finished the core mechanic of Zombie, Teleport, Curse and Recall. Zombie and Curse are lacking a few things to make them complete atm. Teleport though is the "HAHA" spell for some of my mobs, but can "NOPE" at them with Recall.
I'm weird as there are a few game franchises I'll watch and read about, but have no interest in playing.

Forum statistics

Threads
115,162
Messages
1,087,738
Members
149,707
Latest member
hardrockmessi12
Top