# Check probabilities of States in battle?

#### Neo Soul Gamer

##### Veteran
This is hard to explain... So I'm curious as to what the final chance is of inflicting a state when a skill is used. Yes, I can figure it out mathematically, but when you factor in states that change rates, it becomes a headache. Is there any way to confirm what calculations are being done that leads to the final result? Even something that shows the chance that the state had of being inflicted in battle?

#### Kaliya

Game_Action.prototype.itemEffectAddNormalState = function(target, effect) {var chance = effect.value1;if (!this.isCertainHit()) {chance *= target.stateRate(effect.dataId);chance *= this.lukEffectRate(target);}if (Math.random() < chance) {target.addState(effect.dataId);this.makeSuccess(target);}};
That is the code done to calculate chance right before applying a state in battle, or through items, etc. Not sure what you were entirely asking for really though, if you want something to output the process to console I can make that real quick.

#### Neo Soul Gamer

##### Veteran
Yeah. I spotted that code and I'm actually looking to tweak it for a plugin. But I'm looking for the end result to be displayed, well... Somehow. I just want to know what the actual % chance is whenever a state is attempted to be applied to a battler.

Edit: And how do I access the console? This is all new to me. Sorry.

Last edited by a moderator:

#### Kaliya

If you are using YEP_CoreEngine there is a parameter you can use to always have it shown, otherwise you could press F8 when in play test.

You could do something like this:

Game_Action.prototype.itemEffectAddNormalState = function(target, effect) {var chance = effect.value1;if (!this.isCertainHit()) {chance *= target.stateRate(effect.dataId);chance *= this.lukEffectRate(target);}console.info("Chance of Applying State " + effect.dataId + "  Is: " + chance);if (Math.random() < chance) {target.addState(effect.dataId);this.makeSuccess(target);}};
It will output the chance a state will be applied to console, every time a state is to be applied.

#### Neo Soul Gamer

##### Veteran
Thank you very much! I'll give it a shot as soon as I get home from work. I'm just always concerned about probabilities when it comes to balancing my game. I need to see what's going on behind the scenes. I really wanted this for testing purposes.

### Latest Profile Posts

Learning about how trademark works for game titles has given me new understanding about another reason why AAA developers/publishers sometimes reveal new games as "Project XXX" as a working title instead of the actual title. The cutthroat world of trademarks and IP trolls gets rougher every year as the pool of available titles for (legally safe) use shrinks due to the limitations of language.
how does everybody even finish anything

i have like 5 projects in the backburner and it's just so sad that i probably won't get to finish all or maybe even any of them
Did you know that 90% of people in the world use the number in their sentence as they see fit?
It's been a long time since I was here but I have a lot of updates... btw I am teaching again about game programming and game design in some schools here in Brazil hahahaha It's good to see kids and teens learning this kind of thing!