MV (SOLVED) Show current state icon?

I'm using SRD's HUD Maker. I would like to know the value to get an actor's (gameParty.members()) state ICON, the one they're currently affected with.
I've researched everywhere and the conclusion in most posts I either don't understand, doesn't work or apparently you have to make one for each state, but I have a lot of states, and they will definitely overlap if they get two different ones. I know there's a simple solution for this, but i cant figure it out.

Additionally, I'd like this to show on the enemy as well, but only when it's being targeted.

Thank you so much.
I don't think there should be a need to make a HUD element for every state, but your problem is this:
an actor's state ICON, the one they're currently affected with.
...
I have a lot of states, and they will definitely overlap if they get two different ones.
These things directly contradict each other.

There's no such thing as "the one state an actor is currently affected by" if you have a lot of states and the actor can potentially get two different ones.

Perhaps you can clarify exactly what you're trying to do.
SRD HUDmaker doesn't have any functionality to cycle through icons, so yes, you'd have to make an element for each and every state, and put them like... Next to eachother or something.
I don't think there should be a need to make a HUD element for every state, but your problem is this:

These things directly contradict each other.

There's no such thing as "the one state an actor is currently affected by" if you have a lot of states and the actor can potentially get two different ones.

Perhaps you can clarify exactly what you're trying to do.
Apologies for the oversight. I mean to display the first state they're affected by.
SRD HUDmaker doesn't have any functionality to cycle through icons, so yes, you'd have to make an element for each and every state, and put them like... Next to eachother or something.
I haven't used HUDMaker, but I should think it would be possible to display the icon using JavaScript, no? Do you have to manually specify the image?

stateIcons()[0] would be the icon ID of the first state on the battler.
it would be possible to display the icon using JavaScript, no? Do you have to manually specify the image?
Yes, it is. It's pretty much the same only difference is one has to add "${...}" to the line
stateIcons()[0] would be the icon ID of the first state on the battler.
Thank you! I'd need to specify, I think, that I want to retrieve an icon (like with .name, etc) How can I do that?
There's no such thing as just "retrieving an icon" - you have the icon ID and you use that in a draw function which parses the correct area out of your iconsheet file.

Yes, it is. It's pretty much the same only difference is one has to add "${...}" to the line
Which line? Can you show what you're talking about in HUDMaker?

My understanding from looking at it since the last post is you can't do this. You have to have any image you want to use saved in its own file.
Well, HUDmaker can't do what you want. I'm confused as to what exactly it is you're trying to do. Can your battlers only be affected by one state at a time? I don't see why else you'd want to *not* show the player all the states that are currently active.

And if that's the case, yanfly already does show states on battlers, why not just use notetags, that remove all other states?
problem is, you can show icon of the states, but to do that, as condition
and show picture, you need this icon of the state (every single one that
you want to save).

than in its condition "$gameParty.members[0].isStateAffected(x)"
but if you want to loop through them, you need a small playing to call that function
as a condition.

direct call for icons isn't possible.
problem is, you can show icon of the states, but to do that, as condition
and show picture, you need this icon of the state (every single one that
you want to save).

than in its condition "$gameParty.members[0].isStateAffected(x)"
but if you want to loop through them, you need a small playing to call that function
as a condition.

direct call for icons isn't possible.
No need for looping through, I know there's a "placement" on the states, it'd suffice if I could just show the icon of the first state the character is affected by.

Well, HUDmaker can't do what you want. I'm confused as to what exactly it is you're trying to do. Can your battlers only be affected by one state at a time? I don't see why else you'd want to *not* show the player all the states that are currently active.

And if that's the case, yanfly already does show states on battlers, why not just use notetags, that remove all other states?
Oh I wouldn't mind really, I just thought it wasn't possible. I just want to show the icon of the state I'm actually so frustrated because nothing I try is working

problem is, you can show icon of the states, but to do that, as condition
and show picture, you need this icon of the state (every single one that
you want to save).

than in its condition "$gameParty.members[0].isStateAffected(x)"
but if you want to loop through them, you need a small playing to call that function
as a condition.

direct call for icons isn't possible.
I figured out the condition, my problem is the value.
Also I can't use "show picture", I'm not using the event editor I'm using SRD's Hudmaker.

1000020983.jpg


Ps sorry if the image isn't clear enough lmk if I should send a better one

There's no such thing as just "retrieving an icon" - you have the icon ID and you use that in a draw function which parses the correct area out of your iconsheet file.


Which line? Can you show what you're talking about in HUDMaker?

My understanding from looking at it since the last post is you can't do this. You have to have any image you want to use saved in its own file.
1000020983.jpg

I meant the "value" when I said line.
Also what do you mean by your last paragraph? I'm confused

Edit: I got it to say [object object] that's a step I think.
Maybe \I[${$gameParty.members()[0].allIcons()[0]}], i.e. "the \I[x] text code, where x is the index of the party leader's first state/buff icon".
Maybe \I[${$gameParty.members()[0].allIcons()[0]}], i.e. "the \I[x] text code, where x is the index of the party leader's first state/buff icon".
Just tried... It just remains as text, "i[38]".
Oh. I assume that's the right icon index, though?

You could try putting another \ at the front: \\I[${$gameParty.members()[0].allIcons()[0]}]
Oh. I assume that's the right icon index, though?
It is!
You could try putting another \ at the front: \\I[${$gameParty.members()[0].allIcons()[0]}]

Yes! This worked, I know it did because it went blank.
So that's the new occurring issue... I use 64x64 icons, I'm assuming it's that.
Captura de pantalla 2024-11-08 003512.png

Here you can see it's transparent. I used a normal text with the same value to check for the icon index, as you can see it says "I[19]".
Captura de pantalla 2024-11-08 003617.png

Here, I just called for the 19th icon, and NOW I am getting the icon I want to show, but for some reason, it's not showing on the code, even though it is giving me back the icon index 19. I feel maybe it's the 64x64 icons? I tried setting, in the state, in the database, the icon 38 (double that), and all four grids conforming it, but I still get an empty icon (as shown in the first picture).
Captura de pantalla 2024-11-08 003724.png

See, here 19 gives an empty icon, but when I use i[19] it gives me the icon I want.
Captura de pantalla 2024-11-08 003751.png

Here you can see how my sheet looks. If it helps, to use 64x64 icons I followed the instructions here:
https://forums.rpgmakerweb.com/index.php?threads/64x64-icon-size-in-rpg-maker-mv-resolved.122189/
AND I also set, in Yanfly's ItemCore and CoreEngine, icon sizes to 64x64 (they wouldn't work if I just did either or)

Thank you so much for taking the time to help, lmk if I'm missing anything.
it might not be evaluating the code. if you put something like \\i[${10+9}], does icon 19 still show up?
Update: Also tried doubling the iconset sheet, just to check (I know I shouldn't but I'm desperate atp). Same results so I assumed it wasn't that and put it back to normal
if you put something like \\i[${10+9}], does icon 19 still show up?
Just tried, no, it shows blank, so you're probably right. Is there a way to solve this?
Is there a way to solve this?
so, i downloaded the plugin and gave it a couple tries. you can use Wayne's Eval Text plugin to be able to evaluate the code in the lines.

EDIT: if you try it, the WAY core and eval text plugins need to be loaded after the SRD ones. when you have it, try this: \\I[${$gameParty.members()[0].allIcons()[0] || 0}]
Okay...I had no idea when you were talking about showing icons that you wanted to do it through the escape code in a text window.

As a side note, it will be much clearer in your future threads if you post actual screenshots instead of taking pictures of your monitor:

Good luck with your project.
so, i downloaded the plugin and gave it a couple tries. you can use Wayne's Eval Text plugin to be able to evaluate the code in the lines.
Captura de pantalla 2024-11-08 043433.png

EDIT: if you try it, the WAY core and eval text plugins need to be loaded after the SRD ones. when you have it,
Here's how my plugins look like. I assumed by loading WAY after SRD you mean placing it below SRD? Or is it something else?
try this: \\I[${$gameParty.members()[0].allIcons()[0] || 0}]
I tried this, and it's still showing blank, still not evaluating. Could this be because it is technically not a textbox as it is like...an external window or something? I thought maybe I could try to reference another element of the HUD, so getting the icon index, then doing \i[*element ID] but that also didn't work.

As a side note I'm using HUDMaker because I'm still a bit green at JS and it's been the easier way, but if I can achieve the same result via other methods I'd be glad to know
If ultimately this isn't possible, I would settle just getting the state name the actor is affected by but Id rather exhaust all options.
Thank you so much for the help so far by the way

EDIT: I managed to make it work with the help of a friend! I had to force the TextEx within HUDMaker to evaluate by adding this to the .js itself:

Sprite_HUDTextEx.prototype.convertEscapeCharacters = function(text) {
text = text.replace(/\${(.*?)}/g, (match, p1) => {
try {
return eval(p1); // Evaluate JavaScript within ${...}
} catch (e) {
console.error("Error evaluating expression:", e);
return "";
}
});
return Window_Base.prototype.convertEscapeCharacters.call(this, text);
};

It's been a real nightmare to crack this one but it finally works! Ty everyone for the help too
I tried this, and it's still showing blank, still not evaluating. Could this be because it is technically not a textbox as it is like...an external window or something?
I was in a rush when i said the WAY plugins should be loaded before the SRD ones. I said the opposite of what i meant 🤣 Try an order like this and if you dont have any other plugins that mess with how TextEx is handled, it should be fine
1731046043928.png


1731045730362.png
1731045741285.png

Original thread: https://forums.rpgmakerweb.com/threads/solved-show-current-state-icon.173076/