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

Make a Game in RMMZ Streams are going to remain in hiatus this week. Too much to do! 4 things will be announced on Monday though! Look forward to that.
Typed a long-ish reply to a post... forgot to actually HIT the post button, and moved to a different page.... finally noticed, don't remember what all I had typed and don't feel like trying to re-type it all.... smh....
Their tactics are evolving. They've learned to call for help when cornered. Never trust a mammal!
Good morning all. I still have a post up on video editing for cinematic trailers. Please make sure to check that out and give me a message as its still active in offers.
Hey everyone! I'm back :D

Snow White? More like Snowhere to be seen amiright? Hahaha I'm so sorry!! :kaocry:

Forum statistics

Threads
112,371
Messages
1,067,842
Members
146,017
Latest member
Anselmo00
Top