Hello, I'm trying to highlight the actor's name when it's their turn to act, but everything I've tried doesn't work. I've tried BattleManager.actor() && BattleManager.actor().actorId()===3, BattleManager.actor() ? BattleManager.actor().index() === 0 : false, but nothing is working. What am I missing? Am I putting it in the wrong place?
MZ SRD Hudmaker highlight current actor's name on turn
Javascript/Plugin SupportWell...what are you trying to check? Those code samples you threw out there do entirely different things.
checks whether the currently inputting actor is ID 3. If you allow the player to change the order of the party members (by default enabled in the Formation menu), you don't want to use this, because you have no guarantee that a given actor ID is in a specific place on the screen.
this is unnecessary. You don't need to explicitly provide a false result, any boolean evaluation will provide false if it's not true.
this is a valid check, but it doesn't look like what you want to check.
In your first screenshot, it looks like you're highlighting the middle instance of "ACTOR NAME". That wouldn't be index 0 in the party, it would be index 1.
Code:
BattleManager.actor() && BattleManager.actor().actorId()==3
Code:
BattleManager.actor() ? :
Code:
BattleManager.actor() && BattleManager.actor().index()==0
In your first screenshot, it looks like you're highlighting the middle instance of "ACTOR NAME". That wouldn't be index 0 in the party, it would be index 1.
My bad, I'm pretty bad at javascript so I was using code I found on these forums ^_^'. What I'm trying to check is if it is a certain actor's turn to act, then highlight their name in yellow. For example, if it is actor 1's turn to choose an attack, then turn their name yellow. I put a yellow text over the actor's names which should appear if it is the actor's turn.
Code:
BattleManager.actor() && BattleManager.actor().actorId()==1
Are you sure? As I described above, checking the actor ID is usually not what you want to do, for most games.
If your game is different and all party members are in locked positions, then that should be the correct conditional. You can check by getting into battle then, when it's that actor's turn, press F12, go to the Console tab, and paste in that line of code and hit Enter. It should return
trueYes, all of my party members are in locked positions. The code does return true, but the yellow name isn't showing up for some strange reason. Here's a screenshot with where I placed my code.
Here's also a screenshot of my game. The actor with the current turn should have their name in yellow, but it's not showing up. It is impossible to know who's turn it is, as you can see.
Also thanks for being patient w me, I'm new to all of this ^_^'.
The issue is likely with the settings on thr HUD element which we can't see.
Just to make sure: this "battle" is using the front view battle scene and isn't on the map scene, right? I'm asking because I do remember telling you it was possible to make this scene on the map with a HUD and picture buttons.
Yes to all. ;-;
I have a hard time finding documentation on how the eval is supposed to be formatted for this plugin. I have the MV version but it's different
So I'll ask:
What happens if you put everyting in parentheses?
Eval: (BattleManager.actor() && BattleManager.actor().actorId()==1)
Or Curly braces:
Eval: {BattleManager.actor() && BattleManager.actor().actorId()==1}
So I'll ask:
What happens if you put everyting in parentheses?
Eval: (BattleManager.actor() && BattleManager.actor().actorId()==1)
Or Curly braces:
Eval: {BattleManager.actor() && BattleManager.actor().actorId()==1}
It evaluates to "true" on the console but the name will not show up in yellow. Here's a screenshot.
Gabriel's name should be in yellow. I wonder if this is a bug?
Did you put the word Eval: in there? Or is it built into HUD Maker? You definitely shouldn't be adding it.
My bad, I did put the word Eval: in there, but even without Eval: the code evaluates to true. Here's another screenshot. Both () and {} return the same thing.
When the console log is telling you those statements are true, the issue is with how HUD Maker is processing it. What does HUD Maker's documentation say about how to format an evaluation inside HUD Maker?
Where can I find the documentation? I've searched up and down and can't find anything ^_^'
I am asking you, since you have a copy of the plugin and have been using it and presumably were familiar with it. I don't have MZ, but I did find this image on the product page and it looks like it doesn't use Eval: at all and just has unaltered Javascript code. In that case, why did you put Eval in there?
The plugin doesn't seem to come with documentation, I've searched the files and there's nothing. I did not put eval there, it is automatically added when I added the code. The screenshot looks way different from what I have.
Edit: Ok so I added return true; to the end of each statement and now the color shows up yellow, but only for the first actor. How do I get it to show up for each actor when it is their turn?
For Leonardo's name HUD Element use
if(BattleManager.actor() && BattleManager.actor().actorId()==2)
and Mira
if(BattleManager.actor() && BattleManager.actor().actorId()==3)
I just saw this:
if(BattleManager.actor() && BattleManager.actor().actorId()==2)
and Mira
if(BattleManager.actor() && BattleManager.actor().actorId()==3)
I just saw this:
If you're adding return true you are forcing the evaluation to be true instead of checking whether it is. That will make it so the first actor's name is yellow all the time regardless of if it is their turn or not.
I finally got it to work how I needed! Apparently I needed an if statement. I wish there was more documentation on this. Here's the code I used for anyone who needs it in the future:
The number should be changed depending on the actor. Actor 1 is 1, Actor 2 is 2, and so on.
Thank you @AquaEcho and @ATT_Turan for the help! I really appreciate it ^_^
Code:
if(BattleManager.actor() && BattleManager.actor().actorId()==1)
return true;
Thank you @AquaEcho and @ATT_Turan for the help! I really appreciate it ^_^
That's...really weird. I can't think of how that field could be used in the plugin code such that it's expecting a return statement.
It also is a complete departure from the original HUD Maker, I know from many other posts that simply putting the condition into that field will give the expected results.
It also is a complete departure from the original HUD Maker, I know from many other posts that simply putting the condition into that field will give the expected results.
Original thread: https://forums.rpgmakerweb.com/threads/srd-hudmaker-highlight-current-actors-name-on-turn.159269/