Switch Actors when leader is KO'd outside of battle?

Mystic_Enigma

A shadow keeping itself together...
Veteran
Joined
Mar 7, 2018
Messages
311
Reaction score
1,567
First Language
English
Primarily Uses
RMMV
This is something that has been on my mind for the longest time now, but I want to make it possible for the party's leader to change when their HP hits 0. Namely when the leader's HP runs out on the field, they'll be swapped with the next healthy Actor in the lineup, making them leader. OR if there's nobody else, it triggers an event instead!

But i'm not sure how I could go about doing that. Is it possible to do so with eventing? If not, is there a plugin out there that will allow what i'm looking for? Apologies if this is in the wrong section, but i'd appreciate any aid!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,098
Reaction score
7,993
First Language
German
Primarily Uses
RMMV
how do you expect the HP to run out outside the battle?

This usually means that there is an event that causes HP damage, and you can simply use the event that causes the damage to change party order or remove the first actor from the party or whatever.

if the damage isn't done by events then there are a few other options, but it depends on how the actor gets the damage, or requires a parallel process that will add to lag.
 

Rugman

Veteran
Veteran
Joined
Jun 11, 2020
Messages
174
Reaction score
44
First Language
English
Primarily Uses
RMMV
$gameParty.swapOrder(0,$gameParty.members().indexOf($gameParty.members()[1]))
Use that in conditional branches that check Hp. Keep in mind that while this will work instantly, you’ll have to refresh the scene to make the sprites visually change.

Edit: no scene refresh is needed. I was thinking of the “splice” function.
 
Last edited:

Mystic_Enigma

A shadow keeping itself together...
Veteran
Joined
Mar 7, 2018
Messages
311
Reaction score
1,567
First Language
English
Primarily Uses
RMMV
how do you expect the HP to run out outside the battle?

This usually means that there is an event that causes HP damage, and you can simply use the event that causes the damage to change party order or remove the first actor from the party or whatever.

if the damage isn't done by events then there are a few other options, but it depends on how the actor gets the damage, or requires a parallel process that will add to lag.

That is precisely what I intended when I asked about this. I want on-map events that can damage the player (traps, wrong choices, etc.) and, if it KOs them, force their leading Actor to switch with another(Or trigger a negative event if there's no one available).

$gameParty.swapOrder(0,$gameParty.members().indexOf($gameParty.members()[1]))
Use that in conditional branches that check Hp. Keep in mind that while this will work instantly, you’ll have to refresh the scene to make the sprites visually change.

Edit: no scene refresh is needed. I was thinking of the “splice” function.

Oh, thank you! I'll give it a try. :kaothx:
 

Mystic_Enigma

A shadow keeping itself together...
Veteran
Joined
Mar 7, 2018
Messages
311
Reaction score
1,567
First Language
English
Primarily Uses
RMMV
While i'm still here, is there a script call that checks the (leading) Actor's HP? I'm not very good with scripts, i'm afraid...
 

Rugman

Veteran
Veteran
Joined
Jun 11, 2020
Messages
174
Reaction score
44
First Language
English
Primarily Uses
RMMV
$gameParty.members()[0].hp for current hp
$gameParty.members()[0].mhp for max hp
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,098
Reaction score
7,993
First Language
German
Primarily Uses
RMMV
While i'm still here, is there a script call that checks the (leading) Actor's HP? I
no need for a script call, it can be done with eventing alone.
the script variant is easier, but the event variant can do much more especially if you have problems with scripts.

control variable - game data section (the one that defaults to map id) can do much more if you know how.
to get the HP of the first actor (or any actor) you can use the command to get the ID of any actor in the first (second, third, ...) position and then use that ID to get that actors HP, MP, ATK, etc.
 

Latest Threads

Latest Profile Posts

How can I look up the components for a medieval bomb for my game without the FBI showing up at my door?
I don't think I can handle using the real SNES resolution of 512x448 because resizing absolutely every interface element I had on hand by painstaking trial & error/guess and check (is there any other way?) is KILLING me.
If anyone wants to Program for me give me a DM, ill pay if i have to!
I made a drawing of Moss
RPG Maker Games Critique with Studio Blue: Militibus Elementis Redux starts now! Watch live!

Forum statistics

Threads
108,987
Messages
1,041,072
Members
141,456
Latest member
Germelshausen
Top