Yanfly Battle AI Question

BlackJoe2

Villager
Member
Joined
Apr 6, 2018
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Is there a way to make it so if an enemy has a state already applied to them, they will do a specific other action? Or at least not cast the skill that applies that state to them again?

From what I can tell the only checks you can do are if the target passes some check, apply some skill to that target. I can't figure out a way to make it check one battle member, and target a different battle member.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,838
Reaction score
5,222
First Language
Dutch
Primarily Uses
RMXP
Since you're asking for help with a plugin, I've moved this to Plugin support for you.
 

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
444
Reaction score
208
First Language
English
Primarily Uses
RMMV
State !== State 10: Skill, Target

It checks if the target has the state in question. If it doesn't, it's a valid argument.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
You can do this in the editor too...Just redo the attack pattern with a priority that is 3 higher than your default
 

BlackJoe2

Villager
Member
Joined
Apr 6, 2018
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
You can do this in the editor too...Just redo the attack pattern with a priority that is 3 higher than your default
I thought the priorities just made it more likely or less likely to cast. How exactly do those work then?
 

BlackJoe2

Villager
Member
Joined
Apr 6, 2018
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
State !== State 10: Skill, Target

It checks if the target has the state in question. If it doesn't, it's a valid argument.
I don't want to check a target and then apply a skill to that same target, I want to check: IF user has state X, do skill Y on target enemy.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Kinda/sorta, but the priorities are set up so that only skills that are 1 or 2 lower than the highest skill which is valid will ever activate. So if you use the default of 5, that means that any skill with a priority lower than 3 will never run. So what you could do is use the default of 5 for your usual pattern, then set a new pattern with a priority of 10 (or 9 or 8) which only runs when the enemy has that state, and will not include the option to use the skill which reapplies that state.

Also please don't double post, which is posting 2x in a row on the board. Instead use the edit button to put all the replies in one spot. I know if you hit quote it defaults to a new post, so best use @ instead so they know you are replying to them.
 

BlackJoe2

Villager
Member
Joined
Apr 6, 2018
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Alright thanks for the help.
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
I'll share some related wisdom with you:

Code:
state === Row-F
//When checking for a state without eval,
//it checks the target scope of the skill.
//in question.

Eval !user.isStateAffected(13)
//Check's specifically if the user
//lacks a state.

Eval (!user.isStateAffected(33) || !user.isStateAffected(33))
//Check if the user of skill lacks either
//of these states.

Eval (State(A) || State(B)) +++ Random 40%
//Evals can be combined with the '+++' conditions if they are put in brackets.
//This checks if the target has either State A or State B, AND triggers with a
//conditional 40% random chance

Eval user.hpRate() === 1
//Checks to see the user's HP rate.
//(1 is 100%, 0.5 is 50%, etc.)

Important:
Eval target.isStateAffected(13)
//This WON'T work. You can't check a target
//in an eval as the target isn't yet defined.
 

BlackJoe2

Villager
Member
Joined
Apr 6, 2018
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Ok I swear I had already tried user.isStateAffected and it didn't work but I tried again after your post and now it's working.

Another question related to this kind of thing: if I want to have an enemy do a skill every X number of turns, what's the best way to do so? I've tried using a variable that's changed by a common event called by the skill cast by the enemy in question, but that means I need an extra skill just for calling that event any time I want that skill to be only cast on certain turns. The way I'm using now which is super messy is just:
user.turnCount === 1 || user.turnCount === 3, etc.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top