MV YEP AI: enemy self-skill based on party state

I kept getting an error 404 when trying to get the plugin page, but it's the Battle AI Core in this free bundle (the link is NOT the problem haha; just tried to point any help to the plugin I'm using)

I'm trying to have an enemy that will use a self-targeting skill based on if anyone in the party has a particular state. For example, if one of the characters has State 15, the enemy will use skill 7 on itself. Skill 7 has a scope set to "the user".

I know there's an 'eval' option in the AI core, and I know there's $gameParty, but I'm a little lost beyond that 😅
If it's important info, I don't care if all or one or some of the party has the state. Just if at least one character in the party is affected by the state, I want the enemy to use a self-targeting skill.
what link give you the 404 page, the one that explain it how to do it?
or the target on a enemy has the state?
No, no, just the plugin page itself. I wanted to link the plugin to make it easier for people; instead I had to link the bundle page 🙂
Here you go, @Cythera.
Yeah, that link still gives a 404 error for me

Anyways! The link is not the problem haha!
Yeah, that link still gives a 404 error for me
that means you have a problem with your browser or your provider, because the link takes me directly to the wiki page that contains the entire instructions.

perhaps try with a different browser?
if it's a 404 to that page, its not always the provider, but a setting in
the browser that mark it as "unsafe" which you could white list as "safe".

after that, it should work, but it's weird if it gives a 404 error, mostly
there is a prompt or a button to "reload" or "go to website" which is on
your own risk.

if you know the site is safe, you dont have to worry 🙂 I had to do it twice
and I had no problem after that.
I'm not concerned about the link. I have the plugin and all the instructions. What I'm trying to do ISN'T a default function of the plugin. I only wanted to post the link so anyone who tried to help me could easily find the plugin in question, instead of having to search it up themselves.
I'm trying to have an enemy that will use a self-targeting skill based on if anyone in the party has a particular state.
You could do it with troop events on the base troop [Turn 1 * X]:
  • If hero is in party, if hero has state.... force action (OR add state to enemy).
On enemy tab:
  • If enemy has state, use skill
  • skill should probably remove that enemy state to prevent enemy from spamming it.
Thanks for the idea, but not quite what I want.
It's not for a specific skill; it's like a response. I want the enemy to react depending on what the player is doing. So if player is adding states that increase their defense, this enemy will see it, and use a skill on herself that enables her to steal states on attack, for example.
Thanks for the idea, but not quite what I want.
It's not for a specific skill; it's like a response. I want the enemy to react depending on what the player is doing. So if player is adding states that increase their defense, this enemy will see it, and use a skill on herself that enables her to steal states on attack, for example.
i had worked something out for this reason some time ago. im sure someone has a cleaner way fo doing it, but heres a template for it you could use

JavaScript:
<AI Priority>
Eval var choice = false; user.opponentsUnit().aliveMembers().forEach(member => {if(member.isStateAffected(2)) choice = true }); choice: Guard
</AI Priority>
just replace the state being checked and the skill to be used and it should use whatever skill you chose if anyone on the other side has the state
Thank you, @Robro33 that does exactly what I want!
If I figure out any way to make it 'cleaner' or less cumbersome to write, I'll let you know. Now I can make some very cruel enemy tactics. Thanks! 😂

*Quick edit for future info: if you use the code ^ and want multiple conditions, the +++ AI Core offers doesn't seem to work. But if you put the extra condition as an eval, it seems to work just fine.
Example:
Code:
Eval var choice = false; user.opponentsUnit().aliveMembers().forEach(member => {if(member.isStateAffected(2)) choice = true }); choice; !user.isStateAffected(3): Guard
I think a shorter way to write it is:

Eval $gameParty.members().some(actor => actor.isStateAffected(Id)): Skill
*Quick edit for future info: if you use the code ^ and want multiple conditions, the +++ AI Core offers doesn't seem to work. But if you put the extra condition as an eval, it seems to work just fine.
Mind sharing one of the nonfunctional examples? i had tried it out before but i hadnt found anything like that. heres one that does for me
Code:
<AI Priority>
Turn < 5 +++ Eval var choice = false; user.opponentsUnit().aliveMembers().forEach(member => {if(member.isStateAffected(2)) choice = true }); choice: Guard
</AI Priority>
Reversing it to this works as well
Code:
<AI Priority>
Eval var choice = false; user.opponentsUnit().aliveMembers().forEach(member => {if(member.isStateAffected(2)) choice = true }); choice +++ Turn < 5 : Guard
</AI Priority>

EDIT:

I think a shorter way to write it is:

Eval $gameParty.members().some(actor => actor.isStateAffected(Id)): Skill
Just tried it. That it is, my friend. That it is. Thank you!
I'm on mobile so I'll test the new one when I get home.

Not that it's an issue, but for me using the +++ didn't work - in either order. Might be engine or plug in version I'm using.

Thank you for the help solving this though! ^-^ I reported the thread so it'll be closed whenever the mods get to it.

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/yep-ai-enemy-self-skill-based-on-party-state.161840/