Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,200
Reaction score
849
First Language
Hungarian
Primarily Uses
RMVXA
Ahoy everyone!


Recently I tried to figure out how exactly this setting works.


I tried to understand the description the editor provides, I swear I tried hard, but I am not sure if I understood it right, so here I am, asking about it.


Here is what I know for sure:


- Enemy skills will be disabled if they do not meet the conditions defined to use them. That means they will not be calculated as a possible skill to use, until they become available, so they will not do anything with the "Rating" option.


- The "Rating" option will decide what action the enemy will do somehow.


Here is what I don't know for sure:


- The "somehow" part from above...


So, the description says:


- The one with the highest rating will be the standard, and the one within 2 rating points of the standard will be used.


What... the... fruit...?


No idea who made these descriptions, but this one is so confusing (maybe I am just too tired to understand it now, dunno)...


Ok, I got a skill with a rating of 8 set up, another one with a rating of 7, 2 with a rating of 6 and 4 with rating 3.


Which one will be used the most? I guess the one with the highest rating, but that description just killed my logical way of thinking, so I am not so sure anymore...


And what will be the exact usage rate in percentages for the above setup?


And the next part of the description in the editor is just oil to the fire for me:


- Actions 1 rating point away will be used 2/3 of the time, and those 2 rating points away will be used 1/3 of the time.


And now comes my most important question:


If the actions with 2 points away will be executed 33% of the times, and the ones with 1 point away 66% of the times, what happens to the other skills which got a rating setting that is 3 or more points away from the "standard"?


3 points away would be executed 1/6 of the time and so on, basically halving the usage rate with each points?


And by "points away" it means +2 or -2, or only -2? 2 is 2 points away from 4 but 6 is 2 points away from 4 too, right? I am guessing it actually means "lower than the standard", and it is just a bad, very bad translation, but want to make sure.


And what happens with the "standard" skill to begin with? What is the usage rate for that one?


I am almost completed with my encyclopedia, working on the bestiary part now, and want to display the enemy's skill usage rate too with a simple text display (like: "Rarely", "Often", "Special", "Standard", or something similar), but obviously I can't do that if I have no idea how the "Rating" option works at the enemy skills setup.


I hope I made some sense.


Any insight on this would be greatly appreciated! *-*


Thanks for any help in advance!
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,827
Reaction score
14,633
First Language
English
Primarily Uses
RMVXA
The way I read it is the highest skill is the standard, and if you have any skills within 2 points of it they might be selected too. This means in your example only the ones rated 8 and 6 will be selected, 4 is too far below 8 for it to be selected that turn.

The way I handle it is I set all skills with a rating of 5, unless I want the skill to be rare, then I use 4 (very rarely 3). If I want the enemy to always use a skill on a specific turn, I use 10 for the rating. Since I have no skills rated between 8 and 10 besides that skill, it will always pick that skill rated 10 on that turn. This way if you want your enemy to cast "Meteor of Doom" every 8th turn, you set it up with a rating of 10, and turns 8 + 8*x.
 

Liak

Veteran
Veteran
Joined
Mar 13, 2012
Messages
1,788
Reaction score
270
First Language
German
Primarily Uses
As far as I know the translation is very misleading and the actual calculation is as follows:

All skills within 3 points from the highest priority could potentially be used. Let's say you have set up 4 skills.

A: 5

B: 4

C: 3

D: 2

In this case, A, B and C could be used. The engine adds the ratings together, so 5 + 4 + 3 = 12. Then skill A has a chance of 5/12, B of 4/12 and C of 3/12.

Please correct me if I'm wrong!

EDIT: Oh, and another example with multiple same ratings maybe:

A: 5
B: 5

C: 3

D: 2

Then A is 5/13, B is 5/13 and C is 3/13.
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,200
Reaction score
849
First Language
Hungarian
Primarily Uses
RMVXA
Thanks for the replies guys!

I found the code which decides what action stays inside the "valid" action pool.

Why didn't I think about this before? >.>

#-------------------------------------------------------------------------- # * Randomly Select Action # action_list: RPG::Enemy::Action array # rating_zero: Rating value to consider as zero #-------------------------------------------------------------------------- def select_enemy_action(action_list, rating_zero) sum = action_list.inject(0) {|r, a| r += a.rating - rating_zero } return nil if sum <= 0 value = rand(sum) action_list.each do |action| return action if value < action.rating - rating_zero value -= action.rating - rating_zero end end #-------------------------------------------------------------------------- # * Create Battle Action #-------------------------------------------------------------------------- def make_actions super return if @actions.empty? action_list = enemy.actions.select {|a| action_valid?(a) } return if action_list.empty? rating_max = action_list.collect {|a| a.rating }.max rating_zero = rating_max - 3 action_list.reject! {|a| a.rating <= rating_zero } @actions.each do |action| action.set_enemy_action(select_enemy_action(action_list, rating_zero)) end endWhat a weird piece of code, wow.So, in the case of this skill set up:

1. rating 8

2. rating 7

3. rating 6

4. rating 6

---------------

5. rating 5

6. rating 4

7. rating 4

8. rating 3

The code will reject any skills with a rating lower or equal 5. That is what the line shows above.

This is the possible skill execution setup.

Then it moves on with the random selection.

This part is weird to me, but I guess it makes some sense...

So, it will add up some values first.

Each remaining skill will add their rating value - the rating_max value, which is 5 in my example.

So, the remaining skills will add 3, 2, 1 and 1 in order to make a value for the random factor. This random factor will be total amount of the numbers previously listed above, so it will be 7 in the example.

Now, this number will get a rand(x) method, which means it will select a random number between 0 and 6 in the example.

Then it will start to go through the possible skills from the valid list starting from the first skill on the enemy skill list.

If the random number generated will be lower than the skill's rating - the rating_zero value (which is 5 in the example), the skill will trigger.

If it is not lower, it will subtract the checked skill's rating minus the rating_zero from the random number generated before and moves on to the next skill on the list.

It will continue this until it matches the condition.

Interesting way for sure. Understanding this is much harder than I thought.

Not sure how should I calculate the real percentage value on this, but now that I know how it works, I am one step closer than before.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,877
First Language
English
Almost all of the probabilities in the game are weighted.


If the rating for A is 4 and the rating for B is 6, then the total is 10.


So A has 4/10 chances of getting picked


B has 6/10 chances of getting picked.


The way they decided to implement the actual selection is to just start with a random number and then just take away the weights one by one.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,200
Reaction score
849
First Language
Hungarian
Primarily Uses
RMVXA
I see.


So, I should just add up the possible ratings and divide the actual skill ratings with the total rating amount, and that should be the percent value of the skill being used.


Then I can use that value to decide what to display in the bestiary.


Okay, I will go with that then, thank you all!
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,877
First Language
English
The rating system was meant to handle complex conditions where certain actions are given more priority under certain circumstances, so whatever I said is only true for actions that are valid.


You still have to deal with the threshold and the conditions.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,200
Reaction score
849
First Language
Hungarian
Primarily Uses
RMVXA
If someone knows the threshold there is no point to make any skill without a condition to be lower/higher than the threshold rating or else the other skills could be made ineffective under any circumstances.


And for the conditions, I simply made a check for that, so if it got a condition, it simply displays "Special", afterall it is a special case. :)


Made the same check when calculating the total rating amount, so it won't count the rating of any skill with a condition.


All is working well, yay! :D
 

Blair Pendragon

Veteran
Veteran
Joined
Jul 15, 2012
Messages
107
Reaction score
47
First Language
English
Primarily Uses
I decided to try and learn how to use this feature properly (i always used work arounds) But before I read the thread, i assumed a few things. So, knowing how threat works, i read it as;
if its 1 less rating, you multiply its rate by 0.66 if 2 less, then multiply it by 0.33.
whats being multiplied? "the percentage" based on how many actions there are.

If you have 2 actions, each has a 50% chance to trigger. if 3, then each has 33%. etc.
so if you have 2 skills, and one of them is rated 1 lower than the other...
50%
50% x 0.66 = 33%
the remaining 16% lost from the above, gets added to the original 50% of the prior skill at max rating.

so...
50% + X
50% x 0.66 = 33~. Then you do 50-33~=16~
(or
50 x .66 = Y. then 50 - Y = X )

which is;
66~%
33~%

(in the case of 3 skills, each is 33~% and you multiply that by 0.66, and X split and added to the other two)

Now, looking at the thread, its done somewhat differently, but will come to the same result it seems.
So if you have a rating of 2 and 1, it adds them together (3) and 1st skill is 2/3 and 2nd skill is 1/3.
Sorry for bumping this, but I feel I should mention why the description of the skill is phrased the way it is, as im fairly certain its basically saying what i said. But I also agree the 2nd half is a better representation, and easier to work with.

EDIT: i forgot to mention my "work around" which was to just put the same skill multiple times. example; id make attack with a rate of "5" nine times, and a spell once with a rating of 5. this made it a ratio of 90% vs 10%.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,518
Reaction score
2,627
First Language
English
Primarily Uses
RMMZ
I decided to try and learn how to use this feature properly (i always used work arounds) But before I read the thread, i assumed a few things. So, knowing how threat works, i read it as;
if its 1 less rating, you multiply its rate by 0.66 if 2 less, then multiply it by 0.33.
whats being multiplied? "the percentage" based on how many actions there are.

If you have 2 actions, each has a 50% chance to trigger. if 3, then each has 33%. etc.
so if you have 2 skills, and one of them is rated 1 lower than the other...
50%
50% x 0.66 = 33%
the remaining 16% lost from the above, gets added to the original 50% of the prior skill at max rating.

so...
50% + X
50% x 0.66 = 33~. Then you do 50-33~=16~
(or
50 x .66 = Y. then 50 - Y = X )

which is;
66~%
33~%

(in the case of 3 skills, each is 33~% and you multiply that by 0.66, and X split and added to the other two)

Now, looking at the thread, its done somewhat differently, but will come to the same result it seems.
So if you have a rating of 2 and 1, it adds them together (3) and 1st skill is 2/3 and 2nd skill is 1/3.
Sorry for bumping this, but I feel I should mention why the description of the skill is phrased the way it is, as im fairly certain its basically saying what i said. But I also agree the 2nd half is a better representation, and easier to work with.
That's not quite right. It takes the aggregate of all applicable ratings minus the "zero rating", so if your skills have ratings of 5 and 4 for example, the aggregate will be 5. The rating considered to be rating zero is 3 less than the max, so in this case it would be 2 (since the highest is 5).

First the engine generates a random number from 0 to 4. If the generated value is less than the current action's rating minus rating zero, it will be chosen. The first action's rating minus rating zero will be 5 - 2, or 3. So if the random number is less than 3, that will be the action used. If it isn't (let's say we get 4), value is decremented by the rating less rating_zero, which in our example case will be 3 - 2 = 1.

Then when it looks at the second skill, it's checking whether 1 is less than 3, which it obviously is, so that's the one that gets used.

Slip into Ruby covered this back in 2015. ^_^1622054694462.png
 
Last edited:

Blair Pendragon

Veteran
Veteran
Joined
Jul 15, 2012
Messages
107
Reaction score
47
First Language
English
Primarily Uses
That's not quite right.
Which part? My original assumption which is incorrect, or what others said after?
Thank you for replying btw,
As for the detailed explanation, its technical wording makes the math get lost in what you wrote.
I have no idea what the equation is. Im sorry.
But, as someone who has no idea what the true answer is, I'd assume the technical answer would be too long for the description box, and so i then assumed the reason they gave the description they did, was to reflect my original train of thought (to some degree) even if its not actually accurate, as we're trying to over simplify it for understanding purposes.

again, idk if its true or not. if possible, i would like to know the equation. (as direct as possible, w/o the extra removed steps being listed ^^; or lines of code being listed. just variable X going against variable Y, etc. thanks in advance)

EDIT: I should try to explain certain points of confusion.
when you said the total between 5 and 4 is 5, this confused me. wouldnt it be 9? and 5 is the "max" number that could be chosen for the RNG? (i know its 0-4, and not 1-5, but for simplicity ill say 1-5, and 5 is max) Then it RNGs a number based on the max, and rerolls if it doesnt fall in the window.
but from there im lost as to how the number is picked by %, and what % each action then has.
I mostly just read the last lines as "and then math happens, and it picks a skill" and no mention of the final percent chance of each skill (in the case of 5,4,5)
Im sure you did answer, but like i said, i lost the answer ^^; sorry.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,518
Reaction score
2,627
First Language
English
Primarily Uses
RMMZ
Which part? My original assumption which is incorrect, or what others said after?
Thank you for replying btw,
As for the detailed explanation, its technical wording makes the math get lost in what you wrote.
I have no idea what the equation is. Im sorry.
But, as someone who has no idea what the true answer is, I'd assume the technical answer would be too long for the description box, and so i then assumed the reason they gave the description they did, was to reflect my original train of thought (to some degree) even if its not actually accurate, as we're trying to over simplify it for understanding purposes.

again, idk if its true or not. if possible, i would like to know the equation. (as direct as possible, w/o the extra removed steps being listed ^^; or lines of code being listed. just variable X going against variable Y, etc. thanks in advance)

EDIT: I should try to explain certain points of confusion.
when you said the total between 5 and 4 is 5, this confused me. wouldnt it be 9? and 5 is the "max" number that could be chosen for the RNG? (i know its 0-4, and not 1-5, but for simplicity ill say 1-5, and 5 is max) Then it RNGs a number based on the max, and rerolls if it doesnt fall in the window.
but from there im lost as to how the number is picked by %, and what % each action then has.
I mostly just read the last lines as "and then math happens, and it picks a skill" and no mention of the final percent chance of each skill (in the case of 5,4,5)
Im sure you did answer, but like i said, i lost the answer ^^; sorry.
The part about it being 50/50; it depends on the ratings, but even when they have the same rating it's theoretically not half and half because the first one "goes first" and so has a higher chance of being picked by virtue of being the first one the engine considers, if that makes sense. Or to put it another way, the ones further down are only ever chosen if the first one isn't, rather than it being a pseudo-random choice.

What you're missing in the total is that the rating has the rating zero subtracted from it. So it's not 5 and 4; it's 3 and 2.

Let's take your 5,4,5 example. The max is still 5, so the zero rating is 2.

The aggregate calculation ends up being 5 - 2 + 4 - 2 + 5 - 2, simplified to 3 + 2 + 3, for a total of 8.

From there, it goes more or less like the example for 2 skills. A random number from 0-7 is generated against the first skill with rating 5; if it's less than 3, that skill is used. If not, we subtract 3 from what the number ended up being (let's say it was 7 to start with, it's now 4). It still isn't less than 3, so we subtract 3 from it (it's now 1) and the only possibility left is that it's less than 3, so the enemy will use the last skill in its list.

If the random number had been less than 3 to begin with, the first skill would have been used. If it had been a value where subtracting 3 from it made it less than 3 afterwards, the second one would have been chosen.

Expressing that as a percentage...hmm. So there are 4 possible values out of 8 where the first skill could go, so it's technically a 50% chance. But from there, the chance of the skills after it triggering are based on what the original value was, rather than a new number being generated for it, so it's hard to express what the actual chance is after the first one.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,200
Reaction score
849
First Language
Hungarian
Primarily Uses
RMVXA
How did you even find this topic after so many years? :eek:

Looking back to these times feels nostalgic. :D
I successfully managed to display the proper percentages back then, it just took more time for me to get the code for skill selection, because I was a complete newbie in Ruby at those times.

I don't even use any code from the default script list since several years by now for my own projects (aside from the base classes such as Bitmap, Sprite, etc).
Now that I see this part of the default engine again, and compare it to my own skill selection system, this one seems way too complicated for absolutely no reason. One of the reasons why I wrote my own classes for everything.

@Blair Pendragon
If you know Ruby, you can check the code for skill selection in the scripts. It's kinda hard to explain this without directly referencing that code part for non-coders. I look at what Trihan wrote, and now it makes sense to me (it's basically the same what I wrote here years ago), but if I would try to understand that without knowing how the code works, I'm not sure if I would get it right. :D
 

Blair Pendragon

Veteran
Veteran
Joined
Jul 15, 2012
Messages
107
Reaction score
47
First Language
English
Primarily Uses
(sorry dont know how to fix the quotes, and it wont let me undo the mistake)

@Trihan
Expressing that as a percentage...hmm. So there are 4 possible values out of 8 where the first skill could go, so it's technically a 50% chance. But from there, the chance of the skills after it triggering are based on what the original value was, rather than a new number being generated for it, so it's hard to express what the actual chance is after the first one.
If the RNG generates a 0, would that make the 1st skill go off? (just curious)
As for how to calculate it, (in the case of 5/4/5. or 3/2/3*) would you say its;
(for the 1st 5) 4/8 chance
(then the 4) 3/9 chance
(then the 2nd 5) 4/10 chance
?

4 out of 8 numbers the RNG makes can trigger the 1st skill to go off. but the other 4 will lead it to go to the 2nd skill, which would have been out of 8 chances, but the prior attempt on the "5 rating" counts towards the possible attempts? so 3/9?
same with adding both attempts for the final "5 rating"? does it go in order like that? or does it place all "rating 5" first, and then all "4 rating" and lastly all "3 rating"?

@Sixth I did a google search for "Skills and Ratings RPGMaker MV". Its how i usually find the answers im looking for. Your post was the 1st result, and is usually the most recent. Though your post is from 2014, and I didnt realize until I posted, so I risk being banned for talking in the thread. I also just NOW realized its not in the actual MV forums lol. But id imagine the method for rating is the same for MV, despite not using ruby.
You'll have to expand my quote, the site glitched my message, and when i copy/paste, it just repeats the problem, and I dont want to retype it lol.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,518
Reaction score
2,627
First Language
English
Primarily Uses
RMMZ
You'll have to expand my quote, the site glitched my message, and when i copy/paste, it just repeats the problem, and I dont want to retype it lol.
A 0 would be a success, yeah, since it's less than the threshold.

Your breakdown sounds about right; I'm a far better coder than I am a statistician. XD

And you're right, it's done exactly the same way in MV and MZ.
 

Jragyn

JABS codemonkey
Veteran
Joined
Aug 14, 2012
Messages
221
Reaction score
169
First Language
English
Primarily Uses
RMMZ
This has been an enlightening conversation on one of the key elements that I wasn't really sure about.
My take away is that I obviously need to rewrite this to be clearer and cleaner because there simply has to be a less-convoluted way to solve for which skill the enemy is about to use (aside from just writing AI to make them decide for themselves, which is what I ultimately did for JABS).
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,518
Reaction score
2,627
First Language
English
Primarily Uses
RMMZ
This has been an enlightening conversation on one of the key elements that I wasn't really sure about.
My take away is that I obviously need to rewrite this to be clearer and cleaner because there simply has to be a less-convoluted way to solve for which skill the enemy is about to use (aside from just writing AI to make them decide for themselves, which is what I ultimately did for JABS).
The thing that perplexes me is why the rating even has 9 possible values when you can't have any that are more than 2 lower than the maximum value anyway.

Ah, I think I get it now actually. It's so that you can give your conditional enemy skills ratings high enough to completely ignore anything else in the list.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,141
Reaction score
709
First Language
English
Primarily Uses
RMVXA
Ah, I think I get it now actually. It's so that you can give your conditional enemy skills ratings high enough to completely ignore anything else in the list.
And now I understand as well. Thanks.
This was a confusing point in the editor and I just left everything at 5 and used 4 occasionally.
Maybe now I can make adjustments.
 

Blair Pendragon

Veteran
Veteran
Joined
Jul 15, 2012
Messages
107
Reaction score
47
First Language
English
Primarily Uses
Ah, I think I get it now actually. It's so that you can give your conditional enemy skills ratings high enough to completely ignore anything else in the list.
Yeah. What I used to do was use skills ONLY on ratings 10, 7, 4, and 1. (no other numbers)
Then have switches activate or other conditionals, which would change which skills would be chosen.
Then, if i wanted a skill to go off more times, Id just repeat the same skill multiple times.
So lets say I have a "fire" phase, "ice" phase, "dark phase" and "self heal" phase.
I want the boss to use those spells, and basic attack roughly 50% each, during the corresponding phases.

So the condition is set for HP above >80%
And he uses fire or attack
then at <60%
ice or attack
then at <40% dark or attack
and <20%
he either heals himself, or uses basic attack.


I had basic attack listed 4 times, with the ratings of 10, 7, 4, and 1.
healing with 10, dark with 7, ice with 4, and fire with 1.

EDIT: im no statistician either, and rethinking of what i said, i think the;
4/8
3/9
4/10
idea, is actually countered by the fact the RNG wont pick a number TOO high for the 2nd/3rd skills, because that same high number was already used on the prior attempt, and was lowered.
example:
it rolled a 7.
its lowered by 3.
so its actually a possible number of 0-4 not 0-7.

so if i were to add up the odds, they would exceed a 100%. (they were 123~%)
so its also not;
4/8
3/8
4/8
as thats 11/8 lol. (137~%)

So even if the way the code works, prioritizes things the way it does, im inclined to think the original statement on how to calculate the percentages still remains relatively close. (at least reasonably so)
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Looks like I'm going to have to cancel another game.
For now it is in testing phase: Changing the game icon from Rm2k/2k3 without needing to edit the executable.
Rm2k-DinChangeIcon.png
When there's a will, there's a lifehack. :ninja:

Before i mess with battle UI further, does it look decent enough? :hswt:
Free MZ? That's good. I should go try it out then.

Forum statistics

Threads
112,524
Messages
1,068,919
Members
146,206
Latest member
TyRo87
Top