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

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?
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 🙂
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.
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. 😔



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!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-write-if-party-member-exists-then-check-x-condition-for-srds-hud-maker-condition.154970/