Jump to content

Calling state resist variables in scripts

Recommended Posts

I've begun using Yanfly's Ace Status Menu script to add more visibility to in-game parameters.




I've added functionality to display elemental and state resistances.




For elements, I was able to use @actor.element_rate(n), and, with a little math, displayed them as positive integers.

For states, I tried @actor.state_rate(n) but it returned their chance to inflict states on attack, rather than their resistances.

Question then, what variable stores state resistances?
I'm assuming there would be two per state, since items allow both a state rate and a state resist; and if I'm correct, would the latter also be stored as a boolean?

I'm also trying to figure out how to add an icon from the icon file before the name of each element and state, if anyone can help with that too.



The state thing is what I'm most concerned with, but as far as adding icons, in keeping format with the rest of the script, the strings placed into the slots above are set up like:

      [:firZ, "Fire Resistance"],
      [:iceZ, "Ice Resistance"],
      [:thuZ, "Thunder Resistance"],
      [:watZ, "Water Resistance"],
      [:earZ, "Earth Resistance"],
      [:winZ, "Wind Resistance"],
      [:ligZ, "Light Resistance"],
      [:shaZ, "Shadow Resistance"],
    ] # Do not remove this.

And the part that displays this and the value is like:


    when :firZ
      value = sprintf(fmt, @actor.element_rate(3) * -100 + 100)


I'm not sure if I simply can't add an icon before the string, or if I am just doing the syntax incorrectly.


The entire section (and what I'm trying to do with states) is set up like the parameters section in the base script, with some tweaks to column number, and display width. I aped the setup of the menu options by duplicating what was in the base script as well.

Edited by Japhasca
additional question; spelling, update

Share this post

Link to post
Share on other sites

EDIT: Got Icons to work. Still can't figure out how to get the state resists.





Edited by Japhasca

Share this post

Link to post
Share on other sites

I don't have an answer for you, but I use Blackmorning YEA status addon and it does what you want, but I don't really understand how.

It takes the states in the array and gets the resist value from it for your character and displays it. 

This is some inner workings I don't understand yet.

  • Like 1

Share this post

Link to post
Share on other sites

Remember that there are state rates and state resists. State rates effects the chance a stat will be applied, State resists are flat immunity. You can use @actor.state_rate(state_id) to get rates and @actor.state_resist?(state_id) to check for resists.

  • Like 1

Share this post

Link to post
Share on other sites

Thanks so much everyone! Got it now.

I was on the right track but was using the ? wrong.


value = sprintf(fmt, (@actor.state_resist?(21)? 1:0) * 100)


will give me a result of 0 or 100 depending on if the state is resisted or not (I'm not using % rates so this is perfect!)

Share this post

Link to post
Share on other sites

Be careful when using only state resists around the death state though! Remember if something resists death, they won't die even if their hp is zero! It's a good idea to use a state rate of zero if you want something immune to instant death spells. Good luck whatever you do! *sprinkles fairy dust on you*

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

Top ArrowTop Arrow Highlighted