RMMV How to write 'IF party member exists THEN check X' condition for SRD's Hud Maker condition?

casteco

Villager
Member
Joined
Feb 13, 2023
Messages
28
Reaction score
13
First Language
english
Primarily Uses
RMMV
Trying to make an image appear over each actor to indicate their turn using '$gameParty.battleMembers()[x].isInputting()'

However, if there is less than 4 party members present then it returns an error as it does not let me set up that condition for non existent party members.

How do i write a condition that will check if there is a party member active before checking if they're inputting?
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,243
Reaction score
3,515
First Language
Dutch
Primarily Uses
RMMV
you can check for the length of the battle members instead of checking
the [x] for each member that doesn't exist yet.

you could use this in battle:

BattleManager.actor().actorId()

to cycle the members in turn. so isInputting might work.

this one checks if the actor is a battle member:
however you use it is up to you, there is also a topic on this subject on
the SRD HUDMaker if you have 1 hud, with multiple actors to see who's
turn it is which has a bit more indepth on the approach :)
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,268
Reaction score
4,754
First Language
EN
Primarily Uses
RMMZ
You can do something like this:
JavaScript:
$gameParty.battleMembers()[x] && $gameParty.battleMembers()[x].isInputting()
This makes use of the "short-circuit" evaluation of Logical AND (&&): if the first part (xth member of battleMembers) is falsy, it won't check the second part.
 

casteco

Villager
Member
Joined
Feb 13, 2023
Messages
28
Reaction score
13
First Language
english
Primarily Uses
RMMV
You can do something like this:
JavaScript:
$gameParty.battleMembers()[x] && $gameParty.battleMembers()[x].isInputting()
This makes use of the "short-circuit" evaluation of Logical AND (&&): if the first part (xth member of battleMembers) is falsy, it won't check the second part.

Thank you, oddly enough I did try this earlier and it didn't work. Must've been a typo!

The code works now, however not as intended since the picture doesn't show when it is the actors' turn. :kaosigh:



there is also a topic on this subject on
the SRD HUDMaker if you have 1 hud, with multiple actors to see who's
turn it is which has a bit more indepth on the approach :)

Thanks, I'll look into it!
 

Latest Threads

Latest Profile Posts

So in my SRPG, when kill monsters, they leave an aura that grants +20% Crit, +20% PDMG MDMG. Aura lasts only for 1 turn, it forces players when and where to last hit.

1702177938686.png
So frustrating when you just wanna work on your game but people want to do stuff in RL... :p
Day #9 of Advent is all ready in one spot! Do you prefer doing your shopping way before Xmas, or…do you like the chaos? Are you done shopping and/or crafting for Xmas?
Fast test with Wagon and horse no animation. yes it looks strange horse is Ralph and wagon is follower xDDDD
Should first boss be easy or maybe little medium, I don't want to be overwhelmingly hard

Forum statistics

Threads
136,888
Messages
1,271,063
Members
180,663
Latest member
brendancamarillo
Top