Follow up on Dynamic Skill Icons

A few weeks ago, a user here by the name of Robro33 gave me a wonderful notetag that made if so my physical skills always matched the same icon as the actor's equipped weapon:

<Cost Display Eval>

item.iconIndex = user.weapons()[0] ? user.weapons()[0].iconIndex : 0

</Cost Display Eval>

This works wonderfully with any skill I apply it to... except for basic attacks. When I pick Attack during battle, even if I put the notetag on the Attack skill, it overrides whatever icon it would otherwise show (my equipped weapon) and shows icon 76 instead (the default icon for normal attacks).

I've tried WeaponsUnleashed by Yanfly to try and replace the attack command, but the same happens. Is there a way for me to fix this?
I thought you needed like a plugin to draw those icons, what are you using?

Here's something that says it will draw it for you depending on the weapon:

When I pick Attack during battle, even if I put the notetag on the Attack skill, it overrides whatever icon it would otherwise show (my equipped weapon) and shows icon 76 instead (the default icon for normal attacks).
In hindsight, it makes sense. the basic attack is bound to the actor window and doesnt actually have display evals ran on it. I tested it and it seems like it also uses a battleDisplayIcon property instead of iconIndex with yanfly's battle engine core. you dont have to change the other skills, but give the basic attack this one

Code:
<Custom Execution>
item.battleDisplayIcon = user.weapons && user.weapons()[0] ? user.weapons()[0].iconIndex : 76
</Custom Execution>
In hindsight, it makes sense. the basic attack is bound to the actor window and doesnt actually have display evals ran on it. I tested it and it seems like it also uses a battleDisplayIcon property instead of iconIndex with yanfly's battle engine core. you dont have to change the other skills, but give the basic attack this one

Code:
<Custom Execution>
item.battleDisplayIcon = user.weapons && user.weapons()[0] ? user.weapons()[0].iconIndex : 76
</Custom Execution>

Thank you once again!

Just a quick question though. Is it possible to have the icon show up on the action sequence as well? I mean the icon right by their names. It shows up perfectly up top (so the icon of the skill itself has correctly changed) but I would like it if I could also have it down there. Sorry to be such a bother.

1750449509982.png
It shows up perfectly up top (so the icon of the skill itself has correctly changed) but I would like it if I could also have it down there.
i didnt know you were using yanfly's battle status UI plugin. depending on your battle system it might be problematic. The pictures on the bottom do use iconIndex, so this would update both

Code:
<Custom HP Cost>
item.battleDisplayIcon = user.weapons()[0] ? user.weapons()[0].iconIndex : 76
item.iconIndex = user.weapons()[0] ? user.weapons()[0].iconIndex : 76
</Custom HP Cost>
the notetag is the one that determines hp cost, but it wont add one. its just so that the icon updates early enough since it needs to be changed before selection, but cant be in a cost display eval. Its not ideal, but it should be harmless

the problem is that if your battle system doesnt the separate input and execution phase (the default battle system doesnt), then that icon updates for everyone as later actors select attack. if you are using one that does separate the phases like atb, stb, or ctb then it should be fine.

with the systems that dont split the phases, if person 1 has a sword and person 2 has a rod and they both use attack, the first bottom icon will be a sword when the first guy selects attack but both it will change to a rod when the second guy selects it. at that point you'd most likely need a separate plugin to do it. the one above may work or it might partially work (the battle log icon might not change, but the execution notetag earlier can do that if it doesnt).
i didnt know you were using yanfly's battle status UI plugin. depending on your battle system it might be problematic. The pictures on the bottom do use iconIndex, so this would update both

Code:
<Custom HP Cost>
item.battleDisplayIcon = user.weapons()[0] ? user.weapons()[0].iconIndex : 76
item.iconIndex = user.weapons()[0] ? user.weapons()[0].iconIndex : 76
</Custom HP Cost>
the notetag is the one that determines hp cost, but it wont add one. its just so that the icon updates early enough since it needs to be changed before selection, but cant be in a cost display eval. Its not ideal, but it should be harmless

the problem is that if your battle system doesnt the separate input and execution phase (the default battle system doesnt), then that icon updates for everyone as later actors select attack. if you are using one that does separate the phases like atb, stb, or ctb then it should be fine.

with the systems that dont split the phases, if person 1 has a sword and person 2 has a rod and they both use attack, the first bottom icon will be a sword when the first guy selects attack but both it will change to a rod when the second guy selects it. at that point you'd most likely need a separate plugin to do it. the one above may work or it might partially work (the battle log icon might not change, but the execution notetag earlier can do that if it doesnt).
Using STB and everything now works perfectly. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/follow-up-on-dynamic-skill-icons.178437/