RMMV Targeting party member position instead of actor?

dsap

Villager
Member
Joined
Mar 23, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hello, I am looking for a little help. I have set up a common event that looks like this. The goal is that if in battle the player's entire currently alive active battling party has < 1 MP (negatives are possible in my game) the common event will grant them mp.

◆If:Script:$gameActors.actor(1).mp < 1
◆If:Script:$gameActors.actor(2).mp < 1
◆If:Script:$gameActors.actor(3).mp < 1
◆Change MP:Entire Party, + 7

:End

:End

:Else

:End

My problem is this; I intend for my game to have more than 3 characters. I'm sorry I don't know the proper name for this, but I would like for this event/script to check the "slots" or positions that the characters are occupying, so that it could check ANY character placed in the party. I think this code only works if the party currently consists of those three actors, and wouldn't work if there were other actors.

I tried for a very long time to get it to detect the party as a whole, and finally got it to function as intended by basing the conditional on actors instead and nesting "ifs". All of the other scripts I tried included multiple variables and booleans, but it wasn't working out.

Currently, this functions "as intended" inside the common event but im worried about problems in the future. As extra information I am calling the common event through a skill via yanfly's action sequences.

TLDR; how do i make
If:Script:$gameActors.actor(1).mp < 1
call not on the specific actor, but on either A) the whole allied party currently battling not dead, since thats the ultimate goal or B) the allied party currently battling roster position, so that it will still target all party members regardless of which actors are placed in those positions.

Very sorry if I worded this in a confusing way.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,501
Reaction score
727
First Language
indonesian
you can use this:
Code:
$gameParty.battleMembers()[member_index]
change member_index to the index of your battle member
0-> first member
1-> second member
2 -> third member
and so on

hope this help.
 

dsap

Villager
Member
Joined
Mar 23, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
you can use this:
Code:
$gameParty.battleMembers()[member_index]
change member_index to the index of your battle member
0-> first member
1-> second member
2 -> third member
and so on

hope this help.
Ill try this, thank you.
 

Latest Threads

Latest Posts

Latest Profile Posts

New version of my wife's art for Tundra's opening map. No new version of Katrina yet, but I think this looks awesome.1624062754755.png
Devil May Cry-Style Action Shooter in RPG Maker 2000! | RPG Maker News #75

So many good stat names, how do people chose!? :p
I am often just about to give in and ask for help in the forums, when I eventually figure things out myself. Spent almost the whole day with a minor issue, but in the and it's so satisfying that I didn't need to open a thread :D

Forum statistics

Threads
112,346
Messages
1,067,625
Members
145,992
Latest member
Baghead
Top