Get position of party member within battle party?

mdwilliams

Warper
Member
Joined
Jun 10, 2019
Messages
4
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hi,

I was wondering if there was a script call or way to retrieve the value of an individual party member's battle position. I know you can return info about the whole battle party using $gameParty.battleMembers(), but basically I'm trying to get the current actors position within the battle party (1st, 2nd, 3rd or 4th) and store that value in a variable to then call a switch - so I can make different things occur depending on which battle member is identified.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
to get the position of the party members position, use simply those:
$gameParty.members()[0] - 1st Member or Leader
$gameParty.members()[1] - 2nd Member
$gameParty.members()[2] - 3rd member
$gameParty.members()[3] - 4th Member
 

mdwilliams

Warper
Member
Joined
Jun 10, 2019
Messages
4
Reaction score
0
First Language
English
Primarily Uses
RMMV
Thanks, would there be any way to find this dynamically, for example:

var activeMember = ???

switch(activeMember) {
case "0":
case "1":
etc...

So that on every turn, depending on who the active party member is in the battle, something different will happen based on the results on the switch? If that makes sense? :)
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
While, so far JS code goes, im not that good, but the above mention is the most simple position,
there is another scriptcall for the actor's ID, like if you have actorID 3, and switch with actor 1, that stays actor 3.
but on the part you want and what you like to achieve, explain it a bit more, so ppl with more js knowledge can
help you out on it (if not needing for a plugin) but you can event some as well in a commen event that you can call.

if you use discord, join the the lunatic discord server, where you get faster help :)
 

mdwilliams

Warper
Member
Joined
Jun 10, 2019
Messages
4
Reaction score
0
First Language
English
Primarily Uses
RMMV
No worries, thanks for your help :) I'm new to MV and not amazing with JS so it's all a learning exercise for me too!

Basically what I'm trying to achieve is this:

Say I have a party with Harold, Therese, Martha and Lucius as my battle party. On every turn, I need to find the party member's position within the battle party, and then run a JS switch to determine an action, so if my party shows as follows in battle:

Harold HP 100/100 MP 100/100
Therese HP 100/100 MP 100/100
Martha HP 100/100 MP 100/100
Lucius HP 100/100 MP 100/100

So on Harold's turn, the script finds his position in the battle party and would return "0" - then the switch executes and does what it needs...
Then it's say Martha's turn, the script finds her position and returns "2" - then the switch executes and does what it needs and so on...

Hopefully this makes more sense to anyone that can help!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
but basically I'm trying to get the current actors position within the battle party (1st, 2nd, 3rd or 4th) and store that value in a variable
absolutely no need for a script call for this.

just use control variable command and go to "game data" (the one that defaults to map id). This part of the command le't you load dozens of different values into the variable, including the actor IDs of the actors in specific party positions.
 

mdwilliams

Warper
Member
Joined
Jun 10, 2019
Messages
4
Reaction score
0
First Language
English
Primarily Uses
RMMV
Thanks, I've looked into that but I don't think it's what I'm looking for, it's so I can change the colours of the HP/MP/TP bars for a battle party member depending on other things within a battle, so I need the position (not the actor ID) in the battle party of the active character on their turn, regardless of which actor that is.

So to expand on my example above, if Harold is the first battle party member, when it's his turn, it would return "0", but if he was the second battle party member, when it was his turn it would return "1", and so on...

So for example: $gameParty.members().getPosition() ...which would return 0, 1, 2 or 3
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top