Permanent state script is not showing state icons.

This was originally a response to the following topic:
in which scripts were being used for permanent states not removed by KO, resting at inns, etc.

In it, the following script is linked:
http://www.himeworks.com/2013/03/10/permanent-states/


Hi everybody. I've just implemented the above script as one of my characters uses different 'stances' that emphasise different stats and unlock the use of different abilities in combat. I've done this by creating each one as a state, with commands that apply and remove the states as necessary. Each one has an icon to make it clear which stance is active. Without the script there was a huge bug whereby allowing him to be KO'd and then revived removed all stances and unlocked all abilities.

From what I can tell, the script has worked in that death and inns do not remove the states, but for some reason the state icons are not appearing next to the character in the menu whereas they were before I put the script in. Any idea why this may be? Is there something in the script that disables permastate icons? Or is it conflicting with something else in my scripts (I'm using Yanfly's battle engine)?
from reading the comments in that link the permastates being invisible is a known thing.
copy/paste hime said:
You would need to modify the status windows to include permastates, since permastates are separate from states.

I've moved this thread to Script Support. Thank you.

Hmmmmm. So I see. I wouldn't know how to go about that though. Presumably it would be a case of finding the line that draws the state icon in the default script(s) and adding a command to add the appropriate icons from the permastate script, but I can't see anything that leaps out in Hime's script that would reference a permastate icon, and I'm under no illusions that it would actually work anyway.

May have to look for something else unless anyone with more scripting know-how can see something that I can't?
You could try this little snippet:
Spoiler
Code:
class Game_BattlerBase

  def state_icons
    icons = (states+permastates).collect {|state| state.icon_index }
    icons.delete(0)
    icons
  end

end
Disclaimer: I did not test this. At all. 😀
Hey thanks very much! Where would I put that? Would it go into the permastate module itself, and if so whereabouts?
You should be able to put it in a new script slot anywhere below the default scripts but above the Main script slot.
Thanks very much indeed! The icons are displaying perfectly now.
Had some issues with the states last night but tested it today and everything is working perfectly.

Thanks Sixth for a great fix! I'll add you to the credits.

Original thread: https://forums.rpgmakerweb.com/threads/permanent-state-script-is-not-showing-state-icons.129175/