Yanfly Skill mastery level Skill Success

Zsloth24

Villager
Member
Joined
Aug 21, 2018
Messages
20
Reaction score
3
First Language
English
Primarily Uses
RMMV
pre-mention: I am using pretty much just Yanfly's plugins.

So in my game there is a skill like FF's Protect. However, at lower levels, the chances of it succeeding is low. As you continue to use it (using Yanfly's skill mastery levels) you will level up the skill. Currently in the database, the protect skill has a success of 25%.
the goal is that as you progress in levelling up this skill, the success rate of the skill will increase. The issue is implementing this into the coding.

I assumed that the answer lied within Skill Core using the lunatic <Before Eval> and checking the current mastery level of that skill. If the criteria is met, it would somehow increase the success rate. Is this the route to take? or maybe I am just not using the right scripting for the <Before Eval>

I've attempted
<Before Eval>

if (user.skillMasteryLevel(138) >=1) {

user.skillHitRate(138) +200%;

}

</Before Eval>
this was the test I have used. 138 is the skill ID, to ensure that it would work, I wanted to increase the success rate to 200%.
 

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
443
Reaction score
208
First Language
English
Primarily Uses
RMMV
I think a better approach for this is to set the Protect skill to Certain Hit with 100% success, but in the code, try this:

<After Eval>

var odds = 0.25;

var chance = Math.random();

if (user.skillMasteryLevel(138) >= 1) {

odds += 0.05 * user.skillMasteryLevel(138);

}

if (chance <= odds) {

target.addState(protectStateId);

}

</After Eval>

Rather than changing the success rate of the skill, which can be tricky, the skill runs the above code that adds the state. If the state is added through the trait database, that part should be removed since the database can't run variable odds. Replace protectStateId with the ID of the Protect state, and you should be set.
 

Zsloth24

Villager
Member
Joined
Aug 21, 2018
Messages
20
Reaction score
3
First Language
English
Primarily Uses
RMMV
I will test this out as soon as I get a chance and let you know of the results. Thank you in advance!
 

Zsloth24

Villager
Member
Joined
Aug 21, 2018
Messages
20
Reaction score
3
First Language
English
Primarily Uses
RMMV
I have managed to test it out and....IT WORKED!
thank you again. I added a few modifications to simplify the process. It is:

<After Eval>
var odds = 1
var chance = Math.randomInt(6) + 1;
if (user.skillMasteryLevel(138) >= 1) {
odds += 1 * user.skillMasteryLevel(138);
}
if (chance <= odds) {
target.addState(50);
} else {
target.result().missed=true;
}
</After Eval>

the protect skill is the 138 and the actual state is the 50.
Gotta admit that it feels like its not paying attention to the odds += equation but none-the-less it is working as I feel like it is intended to do.
Thank you again, this was a huge weight off my shoulders. I've been trying to figure this out for a couple days now.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Oh man the controls in Mario Sunshine are pretty awful and I haven't even witnessed the controls without FLUDD
Lots of cool changes for Battle Castle in the works! Not just reworked dialogue, but gameplay, combat, and possibly lore changes to make things weightier.
Actor2_2 added!

I started really going in on my project April of last year... I'm just now making starting the actual game... making assets (and not even all of them), whoooo... TIME SINK.


Imagine being a pleb and using --------------------.js :LZSwink:

Forum statistics

Threads
102,946
Messages
996,198
Members
134,410
Latest member
Kylion_Shadowwolf
Top