RMMV Quick question about Yanfly's Auto Passive States

Sword_of_Dusk

Keyblade Master
Veteran
Joined
Sep 13, 2015
Messages
366
Reaction score
403
First Language
English
Primarily Uses
RMMV
I know you can set up a custom passive condition with the plugin, but can you make a condition that requires the actor to have a specific skill learned?

I imagine you probably can, but I'm not sure how to write it. The plugin in question is linked to below.

 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
712
Reaction score
380
First Language
English
Primarily Uses
RMMV
How do you mean? Do you require the actor to have a specific skill in order to have the state applied? Get the state but require a skill in order to apply its effects? Always have the state once you've learned a skill?

The answer is yes, but how you'll do it depends on what you mean.
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
276
Reaction score
235
First Language
English
Primarily Uses
RMMV
I know you can set up a custom passive condition with the plugin, but can you make a condition that requires the actor to have a specific skill learned?

I imagine you probably can, but I'm not sure how to write it. The plugin in question is linked to below.

Try:
Code:
<Custom Passive Condition>
user.isSkillLearned(X)
</Custom Passive Condition>
Replace X with the Id of the skill you wish to check.
Also make sure to add this state to the actor's note box.
 

Sword_of_Dusk

Keyblade Master
Veteran
Joined
Sep 13, 2015
Messages
366
Reaction score
403
First Language
English
Primarily Uses
RMMV
How do you mean? Do you require the actor to have a specific skill in order to have the state applied? Get the state but require a skill in order to apply its effects? Always have the state once you've learned a skill?

The answer is yes, but how you'll do it depends on what you mean.
The third option is what I'm looking for. I want to give every actor a state, but in order for the state to apply, they need to know a particular skill.

@xDRAGOONx
Didn't work, unfortunately. Actor has the state, and that code is in the state's notebox, but it still takes effect without having the skill.
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
911
Reaction score
575
First Language
English
Primarily Uses
RMMV
Try this instead.
Code:
<custom passive condition>
if (user.isLearnedSkill(x)){
condition = true
} else {
condition = false
}
</custom passive condition>
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
712
Reaction score
380
First Language
English
Primarily Uses
RMMV
@xDRAGOONx - per the Lunatic Mode documentation, a straight boolean won't work. Yanfly has a little internal variable called called "condition" that needs to be used, or the custom condition won't do anything. That allows for more complex rules than you could get with a one-operation conditional.
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
276
Reaction score
235
First Language
English
Primarily Uses
RMMV
@xDRAGOONx - per the Lunatic Mode documentation, a straight boolean won't work. Yanfly has a little internal variable called called "condition" that needs to be used, or the custom condition won't do anything. That allows for more complex rules than you could get with a one-operation conditional.
Yes, thank you for correcting me. I even copied the notetag setup from one of my existing states and still missed this...so thank you again. Also, @ramza thank you for providing the correct code, and for your amazing plugins!
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
911
Reaction score
575
First Language
English
Primarily Uses
RMMV
Np. The function being named backwards has caught me a couple of times when I'm not paying attention. I don't know why isLearnedSkill is used instead of isSkillLearned :/
 

Sword_of_Dusk

Keyblade Master
Veteran
Joined
Sep 13, 2015
Messages
366
Reaction score
403
First Language
English
Primarily Uses
RMMV
@ramza So, your solution works. . .as long as I actually learn the skill, and not just gaining it via "Add Skill". Jeez, why is that trait so finicky?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
911
Reaction score
575
First Language
English
Primarily Uses
RMMV
@ramza So, your solution works. . .as long as I actually learn the skill, and not just gaining it via "Add Skill". Jeez, why is that trait so finicky?
In that case, you can use user.skills().includes($dataSkills[x]), which combines all skills learned with all skills gained via traits. Replace x with the id of the skill, of course.
 

Latest Threads

Latest Posts

Latest Profile Posts

I really lack discipline and find myself far too often giving into or at least seriously considering the temptation to start a new project rather than following through on a WIP that's no longer a shiny and new idea.

Does anyone have any strategies or tricks for making themselves follow through with things instead of doing this? Like that actually work?
I'm starting the "Switches lesson" on Learn MV today, what would you like to learn about them?
I managed to review my previous lessons on Learn MV and fixed a lot of things. Yay! :kaopride:

Forum statistics

Threads
110,414
Messages
1,053,137
Members
143,482
Latest member
Bede0
Top