Get # of Party Members

Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
18
First Language
English
I am performing actions based on the Party members actor IDs. However if there is no party member present in one or more of the checked party slots, the game returns an error.

How can I first check how many party members there are so I can set when to break the loop?

Below is what I'm trying to do. ( I don't need to know how to do the loop code, it's just there to give more information on what I'm doing)

I suppose I could always keep track of the # of party members in my own variable, but if there is already a way then I would rather use it.

LoopVarA = 0

NumofPartyMembers = Number of party members <--- How do I do this?

Loop

$gameParty.members()[LoopVarA]._actorId

LoopVarA = LoopVarA + 1

if LoopVarA = (NumofPartyMembers) Break Loop

End Loop
 

Traverse

Veteran
Veteran
Joined
Jul 3, 2014
Messages
161
Reaction score
102
First Language
English
Primarily Uses
There's a function already built-in that returns the number of party members. It's called "$gameParty.size()".

The first thing you should always do is check the functions and properties of the objects you're using so you don't waste time duplicating existing code.
 

Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
18
First Language
English
There's a function already built-in that returns the number of party members. It's called "$gameParty.size()".
Thanks for the help.

I was looking for that function, not trying to duplicate it.

I need help with this now,

$gameParty.members()[0]._actorId <-- This line works, but I want the 0 to be replaced with a variable

$gameParty.members()[$gameVariables(7)]._actorId <-- This returns Object is not a function, I also tried:

$gameParty.members()[$gameVariables()[7]]._actorId
 

Schlangan

A madman with a computer
Veteran
Joined
May 20, 2015
Messages
1,421
Reaction score
1,701
First Language
French
Primarily Uses
RMMV
You should use :

Code:
$gameParty.members()[$gameVariables.value(7)]._actorId
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
$gameParty should have an array of actors. do .length on it
 

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,854
Messages
1,016,998
Members
137,562
Latest member
tamedeathman
Top