Random Chance of Enemy Usage

In Brief: Wanted a 10% Chance for one skill to be used and the 90% to use attack.

Looking into how the battle rankings worked I came up with this solution:
1637932989642.png

9 Attacks to 1 Venom;

I have only down a very small test run on this:
95 Attacks, 5 Venom (About a 5% Chance)

Which seems like it may be working.
Is there any logically reason this wont work before I move forward?

Noted: I Tried using Battle A.I. Core (YEP) but seems to give an error of not being compatible with MZ and I was getting 50/50 split in the skill usage (think I did it right, followed the instructions)
Why aren't you using MZ plugins?
http://www.yanfly.moe/wiki/Battle_AI_VisuStella_MZ#A.I._Rating_Variance
Missed that, downloading now, something else to learn. But been through a lot of posts, some people out there who want to do no-plugins or who cannot afford it. But cant find any reason this would not work for just % base chance with better accuracy then just the 2/3 1/3 so on chances
There are many ways to achieve the same result. It's up to you how you want to go about it. There's no right or wrong, because it's YOUR game.
Yea, I think that should work out as you have it, no need to use a plugin for this unless you want it. 👋

Overview of enemy action selection:
  1. Filter out actions that do not meet their condition.
  2. Determine maximum action rating: rating of highest-rated available action.
  3. Determine minimum action rating: maximum - 3.
  4. Filter out actions with rating at minimum or less.
  5. Weight the remaining actions by their rating - minimum.
  6. Randomly select an action based on those weights.
I am making a large game so happy to use it, but just trying to learn it is hard. Installed the base plugin and the Battle AI ones, but this in the enemy but it does not work. Not sure what I am doing wrong. Nor can I find a good source to show someone who is dumb how this type of thing works:
1637939767979.png
Code:
<AI Style: Classic>
<AI Level: 100>
<AI Rating Variance: 1>

Classic style because: "Classic" style is the traditional and default RPG Maker MZ A.I. style. It puts emphasis on the Rating system, where skills with higher ratings are given more priority than skills with lower ratings within variance.
This will follow the skill rating in Enemy Action Patterns.
The other systems all ignore Raitings.
Set skills to 1 to be used the least.
Set skills to 9 to be used the most.
Include multiples or add conditions(to the skills themselves).

AI Level 100 because: The higher one's A.I. Level, the more they are to follow conditions. With Level 100 A.I. Level, an A.I. will never disobey a condition.
(If you set conditions to be met)

AI Rating Variance 1 because:
0 has no variance towards following priority.
In the RPG Maker database editor, when deciding an enemy's Action Patterns you can decide on the action's "rating". The rating is a value from 1 to 9 where 9 gets the highest priority and 1 gets the lowest. RPG Maker, by default, will sometimes dip the rating a few levels lower to allow lower ratings and bypass the priority system.

This plugin allows you to set the variance level through Plugin Parameters on a global scale or notetags on an individual basis to allow for larger, smaller, or no variance on ratings at all.
@King David
going back to your original post, this might help you understand a bit more about how the ratings work.
Just remember that the weight assigned to any one skill entry will be 3, 2, 1 or 0 depending on what the maximum active rating is compared to the entry rating.
@Andar Done about a month of evening learning RPG Maker, the issue I saw is when you try and do it with 2 skills in the enemy screen. It ignores any skills that is 3 levels or more below the biggest variance so you can do is Rating of 4 and a Rating of 2;
So if Skill 1 is set to 4, and Skill 2 is set to 2 then; that means 4/6 (67%) it will use skill 1, and 2/6 (33%) time it will use Skill 2. I wanted it to be 10% not any of these figures. Just every post I want through in google about this just was use the plugin (same as said before) could not understand why the method I posted above would not work, so why I asked. Think I got that down.

@NaosoX tried what you put above:
1637946587695.png

But it just seems to of resorted back to rpg makers default of ignoring Venom and not weighting them out this way.
Addition: Why I would like to understand this plugin is, in the next area I have 3 enemies types that appear in 3 random sets of 3, buff, debuff and magic users and the advanced AI would really help me there. Once I get the basic principles then logic routes/if paths and all that can come naturally to me
@Andar Done about a month of evening learning RPG Maker, the issue I saw is when you try and do it with 2 skills in the enemy screen. It ignores any skills that is 3 levels or more below the biggest variance so you can do is Rating of 4 and a Rating of 2;
So if Skill 1 is set to 4, and Skill 2 is set to 2 then; that means 4/6 (67%) it will use skill 1, and 2/6 (33%) time it will use Skill 2. I wanted it to be 10% not any of these figures. Just every post I want through in google about this just was use the plugin (same as said before) could not understand why the method I posted above would not work, so why I asked. Think I got that down.

@NaosoX tried what you put above:
View attachment 207906
But it just seems to of resorted back to rpg makers default of ignoring Venom and not weighting them out this way.
Do the enemies have the resources to use venom?
If it requires mp, and they don't have mp.. it will be ignored.
@NaosoX 1st Test: 100/100 Attacks had it skill type set to special; so did another 100 and still got 100 attacks:
1637949166400.png

1637949198958.png


1637949253959.png
It ignores any skills that is 3 levels or more below the biggest variance so you can do is Rating of 4 and a Rating of 2;
that is why I wrote
Just remember that the weight assigned to any one skill entry will be 3, 2, 1 or 0 depending on what the maximum active rating is compared to the entry rating.

for example you could have done your original sequence with one "venom: AR 3" and three "attack: AR 5"
In that case the three attack would have a weight of 3 each, and the single venom would have a weight of 1 (or 1/3 of the weight 3 of AR 5), resulting in the same 1:9 weight ratio that you got with ten entries, but only using four entries.

The system of the attack ratings is a bit tricky to learn, and that learning is complicated by the default AR of 5 (the correct default AR should have been 3 for a better mathematics), but if you do know how to use it it can be very versatile.

I have a half-finished tutorial on how to create an evented AI for troops, but unfortunately I can't finish that alone or it would have been posted years ago...

EDIT:
if you have a single skill at AR9, only AR 7 to 9 will be used at all, any skills with AR 1 to 6 will get weight of 0 and never be used.
I ran tests with ratings 9, 5, 1
Skill 1: 9/15 = 60%
Skill 2: 5/15 = 33.3%
Skill 3: 1/15 = 6.6%
With low variation (1)

I saw the skills come out in this way.
BTW, Can you place attack above venom.
that is why I wrote


for example you could have done your original sequence with one "venom: AR 3" and three "attack: AR 5"
In that case the three attack would have a weight of 3 each, and the single venom would have a weight of 1 (or 1/3 of the weight 3 of AR 5), resulting in the same 1:9 weight ratio that you got with ten entries, but only using four entries.

The system of the attack ratings is a bit tricky to learn, and that learning is complicated by the default AR of 5 (the correct default AR should have been 3 for a better mathematics), but if you do know how to use it it can be very versatile.

I have a half-finished tutorial on how to create an evented AI for troops, but unfortunately I can't finish that alone or it would have been posted years ago...

EDIT:
if you have a single skill at AR9, only AR 7 to 9 will be used at all, any skills with AR 1 to 6 will get weight of 0 and never be used.
If I got this right for anyone reading this:
My way was to place Attack and Venom at the same weight; so 9 attacks weighed up against 1 venom;

Your way is much neater, thank you, by doing this Attack each get a value of 3, Venom gets a weight of 1, so by putting in 3 attacks that equals 9 weighing against the single Venom of 1.
I ran tests with ratings 9, 5, 1
Skill 1: 9/15 = 60%
Skill 2: 5/15 = 33.3%
Skill 3: 1/15 = 6.6%
With low variation (1)

I saw the skills come out in this way.
BTW, Can you place attack above venom.
1637952392327.png

160 attacks in a row.
Spoiler: Enemy
Enemy.png

EDIT: This worked for me as shown by example above.
I then removed Bodyslam, swapped Attack's priority to 9, Venom to 1 and i got nothing but attacks.
I then changed Variance to 5 and it works out(adjust variance until you get the desired ratio outcomes).
Spoiler: Enemy

EDIT: This worked for me as shown by example above.
I then removed Bodyslam, swapped Attack's priority to 9, Venom to 1 and i got nothing but attacks.
I then changed Variance to 5 and it works out(adjust variance until you get the desired ratio outcomes).

Tried This:
1637955282799.png


And got 100 attacks in a row again;
Wondering Issue in the plug in itself:
1637955391594.png

1637955415534.png

1637955439035.png

1637955463513.png
I didnt change any of the default settings for this example. I'm using visustella sample project with Battle AI added in.

Try:
Attack 9
Venom 1
(Only 2 skills)

Then adjust notetag Variance to 5 and see how you go.


excuse graphics all place holders atm

1637956373518.png

Original thread: https://forums.rpgmakerweb.com/threads/random-chance-of-enemy-usage.142485/