For some skills I am using the default state 'Stun'. However, I don't want all enemies to be stunned, so I have tried preventing that by using 'State Resist'. However, although the skill only has a 50% chance of inflicting Stun, enemies continue to get it. I have also tried setting the 'State Rate' to 0% but they still get stunned anyway. The same also appears to be true for Paralysis.
Any ideas about why this might be?
Thanks.
Erhm... being able to script helps > _ >
With Indi he would give me what's needed to recreate the issue and I would debug it.
Shotgun debugger = when you put a bunch of p something in your code hoping to hit something right.
A good debugger allows you to step through the code while presenting the state changes as they occur. I.e. what the values of the variables are.
is that skill set to "certain hit"? If I remember correctly, any skill set to that option overrides all possibilities of evading the effects.
If that's not it, it would help to see screenshots of both skill and enemy...
Zeriab is referring to editing the scripts that run when a skill inflicts a state, to print stuff out to the console and see exactly what's going on.
Can you disable all your custom scripts temporarily and test to see if the problem still happens? If you have a lot, the quickest way to disable them all is to copy the Main slot and insert/paste it above the custom scripts.
State rate 0% actually does not totally stop state infliction. What it does is it will multiply the state rate by 0 on physical and magical attacks, but certain hit skills and troop events ignore it. If you want absolute immunity to states you have to use state resist to make them totally immune to the state.
Do a Ctrl+Shift+F and look for item_effect_add_state_normal. That's the code where state rates are computed. Make sure it is still being called when states are added (I do this by adding a line to have it print a line every time it comes there, though I can't recall how to do that. Maybe I need more caffeine?)
The key code you want is
change *= state_rate(effect.data_id) if opposite?(user)
if that code is not running then your state rates will always be ignored.
As for the scripts, yep, for reasons I cannot understand if you disable Effectus it will no longer load your save games. Maybe you can try disabling all but that one?
Yep, I do. That's called I need more caffeine.
As for the printout, I looked it up. msgbox_p() will print a message via windows, though it will take all focus away from the game until you close the message. Still could work for a test. I think there's a way to print it to the console instead, but I don't know it.
So maybe try, right below all the lines involving chance *= (stuff) add the following line:
msgbox_p(chance)
This will print out (in decimal form) what the chance is to apply a status aliment. Though, fair warning, it will do this for every single status aliment, which will get annoying fast, so remember where you put the code so you can delete it later!
Did you put it at the bottom? As in after the line that reads:
chance *= luk_effect_rate(user) if opposite?(user)
If it is still the same as in the skill, then that means for some reason you have no luck affecting your stats (possible), and you have no state rates affecting your states. Not sure how to fix that though, as this should be just drawing it from the database.
Actually, that means the luck line is working, as it is really tiny by default (like 0.01% per point of difference in luck). But it does mean the state rate is not applying somehow. Though do you still have it as state rate resist Stun, or state resist * 0%? If the first I think it will not show up here, as the code for that is I think under how states are applied. Will have to dig more on that.
It is probably completely unrelated - but you never know:
Is it correct that you have an unnamed (empty) element selected? Is it perhaps possible that you have several elements without names and selected the wrong one, causing some other rates to apply?
Can you test if anything changes if you select "none" instead of that unnamed element?
And can you test out what happens with a regular damage number? I don't know which script defined that base array, but code in the damage formula is one thing that can throw off the engine if there is a mistake in it.
And now it would be better to remove anything else while searching for the cause of the problem...