MZ SRD Hud Maker Ultra Arrow indicating actor turn

SRD Hud Maker Ultra: http://sumrndm.site/hud-maker-ultra/#more-58695
I was wondering if there was anyone way to check which actor's turn it is. For example, if it's Bob's (Actor 1) turn how would I check it?
Heyyyy I had this exact question a few days ago with SRD's HUD Maker!


So to put it simply, you'll take the actor-turn indicator image you want, and you will plug in this piece of script-code under the conditions of that image:

Code:
BattleManager.actor() ? BattleManager.actor().index() === 0 : false


This is the script that's used to determine which actor's turn is "selected" in that battle moment. Simply replace the "0" near the end with whichever corresponding actor it is.

0, 1, 2, 3... = 1st fighter, 2nd fighter, 3rd fighter, 4th fighter....etc, respectively.

Hope that helps!
Heyyyy I had this exact question a few days ago with SRD's HUD Maker!


So to put it simply, you'll take the actor-turn indicator image you want, and you will plug in this piece of script-code under the conditions of that image:

Code:
BattleManager.actor() ? BattleManager.actor().index() === 0 : false


This is the script that's used to determine which actor's turn is "selected" in that battle moment. Simply replace the "0" near the end with whichever corresponding actor it is.

0, 1, 2, 3... = 1st fighter, 2nd fighter, 3rd fighter, 4th fighter....etc, respectively.

Hope that helps!
I put the code in but the image didn't appear.
Oh no!

Huh, weird. It's working for me when I use actors 0,1,2,3 for my maincast of 4.

Can you show screenshots of where you're copying/pasting that code pretty please?

Something that comes to mind is that I am using MV, and not MZ. But I'm not sure if that effects the code...
bump
bump
Hello. This is my first post on here but I feel like it is necessary for me to write this as this has been an issue I've been trying to solve for the past few days, and, thankfully, succeeded at doing so. For anyone out there still looking for an answer to how to do this in Hud Maker Ultra (Pro), I present you my solution for it:

No matter what your intended use for this is, you need to set up some switches to use in RMMZ. Just pick 4 empty slots and name them accordingly, each one is for a single actor in battle.

Once that is done, open Hud Maker Ultra, select the battle HUD and add an invisible object. I went with a "group" since these don't display anything, and just cram it somewhere where it doesn't overlap with anything. Then within that object you only need to setup the following code:

JavaScript:
// Replace w, x,  y, and z with your switch numbers, in order of actor.
// Check if BattleManager isn't empty
if (BattleManager.actor() !== null)
{
  
    // Check 1st switch
    if (BattleManager.actor().index() === 0)
    {
        $gameSwitches.setValue(w, true);
    }
    else
    {
        $gameSwitches.setValue(w, false);
    }
  
    // Check 2nd switch
    if (BattleManager.actor().index() === 1)
    {
        $gameSwitches.setValue(x, true);
    }
    else
    {
        $gameSwitches.setValue(x, false);
    }
  
    // Check 3rd switch
    if (BattleManager.actor().index() === 2)
    {
        $gameSwitches.setValue(y, true);
    }
    else
    {
        $gameSwitches.setValue(y, false);
    }
  
    // Check 4th switch
    if (BattleManager.actor().index() === 3)
    {
        $gameSwitches.setValue(z, true);
    }
    else
    {
        $gameSwitches.setValue(z, false);
    }
}
else
{
    // This resets everything once the turn is over
    $gameSwitches.setValue(w, false);
    $gameSwitches.setValue(x, false);
    $gameSwitches.setValue(y, false);
    $gameSwitches.setValue(z, false);
}

Make sure to set it to On Update. Otherwise it will only do it once which, albeit kinda funny, is not what you want.

From here on, whatever effect you want to do can use the 4 switches you established in RMMZ. In my case I wanted the player portraits to raise and lower depending on the switch states. I basically set up 2 animations, one for going up and one for going down. I decided it's more fail proof to tell it directly to lower the portrait once the switch is off, so I used the custom condition of checking a switch which allows me to check if it's on or off.

And there we have it. I know the code is a bit amateurish with all the blatent if and else statements, but it works and that is what matters. This also does not take into account moves being performed, this only does things while you're selecting moves for the actors.

I hope this helps. c:
While normally we prefer not to have necroposting on support threads, since the new post is a soluton to it and none was presented yet I approved it as I felt it was a valid exception to the rule.
No matter what your intended use for this is, you need to set up some switches to use in RMMZ. Just pick 4 empty slots and name them accordingly, each one is for a single actor in battle.
Welcome! Thanks for posting your solution. I'm curious as to why you feel the switches are necessary.

I haven't used HUD Maker personally, but from the other threads about doing this, it looks like it uses any valid code statement for the condition of the HUD element, no?

So wherever you're checking your switch $gameSwitches.value(16) for example, can't you just look directly at the current actor? BattleManager.actor() && BattleManager.actor().index()==1

Or does the HUD Maker provide something in the interface where you select a switch to use and you don't have the option of a script condition?
Welcome! Thanks for posting your solution. I'm curious as to why you feel the switches are necessary.

I haven't used HUD Maker personally, but from the other threads about doing this, it looks like it uses any valid code statement for the condition of the HUD element, no?

So wherever you're checking your switch $gameSwitches.value(16) for example, can't you just look directly at the current actor? BattleManager.actor() && BattleManager.actor().index()==1

Or does the HUD Maker provide something in the interface where you select a switch to use and you don't have the option of a script condition?
I tried that before but it just told me it didn't exist, I discovered you had to check for a null exception first.
That said, switches are just simply quicker to set up. I personally find it more convenient to have a controller and then check for switches to perform actions because of that. There is no particular strong reasoning behind it other than a small logistic advantage in the long run.
I tried that before but it just told me it didn't exist, I discovered you had to check for a null exception first.
That's what the first half of the conditional I typed does 😉

Thanks for sharing, good luck with your project.

Original thread: https://forums.rpgmakerweb.com/threads/srd-hud-maker-ultra-arrow-indicating-actor-turn.151225/