How can I alter a formula so it would 'add a percentage'?

HiddenCrops

Villager
Member
Joined
Feb 8, 2019
Messages
5
Reaction score
3
First Language
Not English
Primarily Uses
RMMV
First off, I'm very new to coding business. Really sorry for the noob question..

So in a game I'm currently working on for the sake of making the luck stat useful as well as clarity, I intend to make my debuff rate more or less works with a formula like "Debuff total chance = Fixed % from skill + (user.luk - target.agi)%"

I've looked up the forums and suspect that 'target.debuffRate(effect.dataId) * this.lukEffectRate(target)' in the rpg_object.js would be my go to script to change. But when I change
target.debuffRate(effect.dataId) * this.lukEffectRate(target)
into
target.debuffRate(effect.dataId) + this.lukEffectRate(target)
there seems to be no change of percentage to the debuff rates in my playtesting, (even when after I set the difference between luk and agi into '100' or '(100)*001').

Am I looking at the wrong script? or is there anything else I need to do for that '+' to work?
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
147
Reaction score
166
First Language
Danish
Primarily Uses
RMMV
Okay after having looked into this it seems you have a few misunderstandings.
First of all how a debuff works. First their is a check if the skill (debuff) hit or not, this is the percentage you can see on the skill. In the case it does hit then it check rather or not the debuff took affect. This is done by the formular you presented:
Code:
target.debuffRate(effect.dataId) * this.lukEffectRate(target)
So what does this mean you might ask? The first part:
Code:
target.debuffRate(effect.dataId)
Is the rate the TARGET is affected by a specific debuff. In the case nothing is specified then it is 100% as default. You can think of it as the target might have a resistance towards the specific debuff.
The other part:
Code:
 this.lukEffectRate(target)
Is how your luck affects the chance of the debuff having an effect. This is calculated with the following formular:
Code:
Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0)
What this means is that for every point of luck you have more than the target it affects your chance with 0.1%.
So with a debuff that have an effect 100% of the times it hits and your luck is 20 points less than targets then you have: 1 * 0.98 = 98% chance of the debuff having an effect.
So to your question if you want to add the lukEffectRate instead of multiplying you would need to subtract 1 as well. Giving you:
Code:
target.debuffRate(effect.dataId) + this.lukEffectRate(target) - 1
You have to do this as to increase something with 1% means multiplying by 1.01. But if you want to just flat add 1% it would by adding 0.01.
 

HiddenCrops

Villager
Member
Joined
Feb 8, 2019
Messages
5
Reaction score
3
First Language
Not English
Primarily Uses
RMMV
Thankyou so much for replying!
though i've not make sure the code works or not thanks to you I discovered that theres a bug in my skills.json that for some reason makes the state rate of an enemy doesnt effect the actual rate whasoever!

im a bit frustrated now tbh lol..

I'll post again to notify if the code works though!

(EDIT)
don't know if its actually inside the skills.json though.. but the state rate of an enemy definitely stops to work once i replace the skills.json from a brand new project with my game's..
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top