Possible to make an enemy only use an attack when the party currently has a certain item?

Hello, I've had an idea for a boss where, the attacks they use would be based on certain key items the player has, thinking that was a default feature. But I learned the best you can do is have a switch, and it seems wasteful to have a switch for EVERY key item. I know I could do it through force action in troops events, but I'd like the agility stats of the player and enemy to matter.
I imagine it's possible through yanfly battle ai core, but I don't know how I could make it work. Thank you.
Personally id use the AI core, but the switch approach does work right? youre allowed 1000 of them. surely you dont have that many key items?

Also, if you dont want to use the AI core, but youre using anfly's skill core and these skills only belong to that enemy, its possible to make those additional skills require the item being present in the party so that they can only use it if the player has them in the first place and then set up the priorities with the default editor like normal
Personally id use the AI core, but the switch approach does work right? youre allowed 1000 of them. surely you dont have that many key items?

Also, if you dont want to use the AI core, but youre using anfly's skill core and these skills only belong to that enemy, its possible to make those additional skills require the item being present in the party so that they can only use it if the player has them in the first place and then set up the priorities with the default editor like normal
Ah, I'd prefer the battle ai core but I don't actually know how to make it check for items.
Ah, I'd prefer the battle ai core but I don't actually know how to make it check for items.
try this in your AI priority. just replace the skillid and the itemid
JavaScript:
Eval $gameParty.hasItem($dataItems[ItemID]): Skill SkillID
try this in your AI priority. just replace the skillid and the itemid
JavaScript:
Eval $gameParty.hasItem($dataItems[ItemID]): Skill SkillID
Sorry it took me so long to respond, I went to sleep, would this code check for key items?
Sorry it took me so long to respond, I went to sleep, would this code check for key items?
It does. hasItem doesn't filter on item type.
It does. hasItem doesn't filter on item type.
Ah ok!
try this in your AI priority. just replace the skillid and the itemid
JavaScript:
Eval $gameParty.hasItem($dataItems[ItemID]): Skill SkillID
It works perfectly, thank you!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/possible-to-make-an-enemy-only-use-an-attack-when-the-party-currently-has-a-certain-item.163280/