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

0800d9e637692b8fe70e5bf0f8d410af.jpg

Im just gonna get a plugin or two....or five hundred.
MV/MZ dev: "I'll build an APK to run on Android mobile devices!"

Microsoft: "Here is the great news. Now you can play android apps on Windows 11!"
Work-in-progress dwarf character. Got him mostly there but he needs some earrings or hair jewellery.
TestChara-14.gif
I cant not for the life of me figure out where this bomb item comes from.

Forum statistics

Threads
112,548
Messages
1,069,125
Members
146,242
Latest member
darkescythe
Top