MZ Looking for information about enemy AI

I can't seem to get a handle on how enemy AI chooses attacks in MZ. Every bit of testing that I've done seems like it contradicts the information I've found online. For context, everything that I've tried has been with and without the Visustella Battle AI plugin. The plugin doesn't seem to have really changed anything, in my experience.

For example, the attached screenshot shows the chosen action for a basic enemy I've been testing with. Going by how the official documents explain it, the enemy should only be able to use Tsunami and Shock, with a preference to the former. However, when I tested this, it ended up being about 50-50 between Shock and the basic attack, with the enemy not using Tsunami at all. I've had other instances where I haven't put the basic attack on the action list at all, but did include other actions to be used at all times, and the enemy just skips its turn most of the time.

Notably, I also tried using the 'Gambit' setting from the Battle AI plugin, which says it's supposed to choose skills from the top to the bottom of the enemy's skill list, but that still seemed to just choose skills randomly. I haven't read everything about the plugin, though, so that could be on me.

The best I can think of is that there's something to do with the basic attack that an enemy has to be capable of using it at all times, but I haven't noticed anything like that in any help documents or anywhere else I've looked online. It also doesn't seem like it's different enough from any other action for such a thing to be important, but I admit that I'm not very experienced so I could be wrong.

The only thing I've been able to use that works as advertised is using turn patterns to make enemies use different actions in sequence. And it's nice that I'm able to do that, but I want different enemies to behave in different ways.

I'd really just like some information. Whether it's because I'm doing something wrong or if there's something going on under the hood that I don't know about, I just want to know what is happening here, and how I can add some more variance to my enemies.
Well, just a guess here, but do these skills have an MP cost? And if so, did this test enemy have sufficient MP to use it?
God, my blood ran cold when I saw this reply. That would've been so embarrassing.

No, the skills don't have MP costs. They actually have TP costs, which is not something I'm using as a game mechanic, but I haven't gotten around to changing it yet. It hasn't stopped anything else, though (one of my party members still has a skill that uses TP which can be used without issue). I'm in a hurry right now, but I'll test it with MP costs later.
Well, just a guess here, but do these skills have an MP cost? And if so, did this test enemy have sufficient MP to use it?
Okay, this feels very strange to be saying, but when I changed it to be MP costs, the skill weight seemed to work as intended. The enemy was just going for Tsunami and Shock like it was supposed to. No word on the rest of it yet, but that is a good sign.

No idea why it was different with TP.
Okay, this feels very strange to be saying, but when I changed it to be MP costs, the skill weight seemed to work as intended. The enemy was just going for Tsunami and Shock like it was supposed to. No word on the rest of it yet, but that is a good sign.

No idea why it was different with TP.
Enemies don't have TP as far as I'm aware.
One of the attacks was working and the other wasn’t, both of which used TP. But I wouldn’t say it matters anyway. Away from my computer, but I’ll do testing on the other stuff once I get back home.
Enemies should have tp in MZ. I think it was ACE where enemies didnt have it but actors did

If all of the enemy's skills cost tp and none of them grant it, then they wouldnt really be able to use them much if ever. the only times theyd gain tp would be up to 25 on battle start and on taking damage.
Alright, I'm baffled as to why, but switching things over to MP seemed to fix the AI issues. There's still a couple things I need to pick apart, but for the most part, I think it's going the way I want it to now. Still need to do some research, but I think I'll be able to work out some AI patterns. Thanks for the help.
but switching things over to MP seemed to fix the AI issues.
I suspect there are a few overrides to guarantee that the enemy has an action if he can't pay the costs for skills, especially due to the TP being randomized at battlestart if the battler does not have the "preserve TP" trait, and enemies most likely only gaining TP by damage (unless you add a value of TP gain to their other skills).
So if a skill has a high TP cost (above 25 iirc) it might be impossible to have it used at the beginning of the battle due to the random start value for TP - MP on the other hand is a value set by enemy MaxMP value.


Back to your original action pattern: If there is no plugin that changes the enemy AI, then those ratings would give the skill "Tsunami" a weight of 3, the skill "Shock" a weight of 2 and the skill "Attack" a weight of 0.
That results in Tsunami being used 60% of all times and Shock 40% of all times - if the skills have no cost at all. Skill costs would cause that to change by disabling some actions.
See, that's the weird thing. When I tried it before switching to MP, the enemy used Shock (5 TP) four times and the basic attack four times. But it alternated, it didn't just use Shock a bunch and then switch to the regular attack. It was something like Shock, attack, attack, Shock, Shock, attack, Shock, attack. So even if it wasn't gaining TP at all, it clearly had enough to use Shock that many times and there was no reason it couldn't use Tsunami (10 TP). Unless it was repeatedly gaining an amount to specifically keep it between 5 and 9, I guess.

I'm kind of confused as to why this would be, but like I said, I don't think it matters. I did test it out with the same patterns in my screenshot after I switched to MP (gave the enemy 999 to make sure it could keep using them), and it was weighted properly. There's things to mess around with on my own time, but I think I can get a good understanding of how to vary things a bit more.
Unless it was repeatedly gaining an amount to specifically keep it between 5 and 9, I guess.
as mentioned, all battlers gain TP on damage, and start with a random and low amount (I don't remember the formula for the random amount).
The TP gain by damage is low, but it does depend on the damage received. A few TP per turn is absolutely normal.

A scenario where the enemy stays below 10 TP is easy to imagine, especially if the skill that costs 5 TP is used with a high probability.

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-information-about-enemy-ai.178638/