Problem with Yanfly auto passive states and buffs & states core

Status
Not open for further replies.

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
601
First Language
English
Primarily Uses
RMMV
Okay so here is the problem (I think): I have a custom passive state set up to affect all battlers, enemies and actors, and I'm having an issue with the <Custom Remove Effect> working properly. What I believe is the issue is that the auto passive state has a requirement to be active (user's MP > 1%), and when the auto passive state is deactivated it is not technically removed, so custom remove effects and custom leave effects don't work.

So I am wondering if there is some way to make something happen when the auto passive state is no longer active? I want there to be damage that happens when the condition is no longer met. Maybe I'm just not thinking about this in the right way?

Here is my note tag for the auto passive state:
Code:
<Passive Condition: MP Above 1%>

<Custom React Effect>
if (value > 0 && this.isHpEffect()) {
  var mpDmg = Math.floor(value * 0.85);
  mpDmg = Math.min(mpDmg, target.mp);
  target.gainMp(-mpDmg);
  value -= mpDmg;
}
</Custom React Effect>

<Custom Regenerate Effect>
// Formula used to heal HP
var heal = target.mdf * 0.50;
// Play heal animation
target.startAnimation(59);
// Target gains MP
target.gainMp(heal);
// Play the popup
target.startDamagePopup();
// Clear the results
target.clearResult();
</Custom Regenerate Effect>
Here is the bit that is not working:
Code:
<Custom Remove Effect>
target.startAnimation(107);
var end = target.mmp * 0.25;
target.gainHp(-end);
target.startDamagePopup();
target.clearResult();
</Custom Remove Effect>
Here are links to Yanfly auto passive states and Yanfly buffs & states core.

I have this state set as a global passive, not sure if that makes a difference or not though. Any help is appreciated.
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
259
Reaction score
73
First Language
German
Primarily Uses
RMMV
Ok I probably cant solve your problem,but i can try to explain,what i know about auto passive states .
That are not regular States,.. if u use the Console f8 than u can see its not listed in "_states" ,they have they own Category..
That means for Example that you cant use "if Conditions" like "isStateAffected" on these auto passive states.. aswell as Commands like "removeState" ect.
The only Way to remove an AutoPassive is by its Condition Or perhaps if u try to mess around with the Category (= "_passiveStateRaw" ) where they are stored.. which u can find using the Console..
That probably means u cant use these Passive States like regular States on any other Function,when the Function trys to find a regular State..
Screenshot_1.png

Sry for bad englisch
 
Last edited:

Sirius270

Villager
Member
Joined
May 2, 2020
Messages
20
Reaction score
5
First Language
English
Primarily Uses
RMMV
Okay so here is the problem (I think): I have a custom passive state set up to affect all battlers, enemies and actors, and I'm having an issue with the <Custom Remove Effect> working properly. What I believe is the issue is that the auto passive state has a requirement to be active (user's MP > 1%), and when the auto passive state is deactivated it is not technically removed, so custom remove effects and custom leave effects don't work.

So I am wondering if there is some way to make something happen when the auto passive state is no longer active? I want there to be damage that happens when the condition is no longer met. Maybe I'm just not thinking about this in the right way?

Here is my note tag for the auto passive state:
Code:
<Passive Condition: MP Above 1%>

<Custom React Effect>
if (value > 0 && this.isHpEffect()) {
  var mpDmg = Math.floor(value * 0.85);
  mpDmg = Math.min(mpDmg, target.mp);
  target.gainMp(-mpDmg);
  value -= mpDmg;
}
</Custom React Effect>

<Custom Regenerate Effect>
// Formula used to heal HP
var heal = target.mdf * 0.50;
// Play heal animation
target.startAnimation(59);
// Target gains MP
target.gainMp(heal);
// Play the popup
target.startDamagePopup();
// Clear the results
target.clearResult();
</Custom Regenerate Effect>
Here is the bit that is not working:
Code:
<Custom Remove Effect>
target.startAnimation(107);
var end = target.mmp * 0.25;
target.gainHp(-end);
target.startDamagePopup();
target.clearResult();
</Custom Remove Effect>
Here are links to Yanfly auto passive states and Yanfly buffs & states core.

I have this state set as a global passive, not sure if that makes a difference or not though. Any help is appreciated.
Hello!
Try setting this Auto Passive onto a skill that everyone in the game has (or all the actors, whomever you want to use this). One way may be to put this on the 1st skill that's used as the initial "Attack" button.

@Dopan I am curious as to how you would make if/else clauses work with passive states, then. I have been having a problem myself with a conditional clause and you may have found the answer. What should I put instead of "ifStateAffected"?
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
259
Reaction score
73
First Language
German
Primarily Uses
RMMV
Hello!
Try setting this Auto Passive onto a skill that everyone in the game has (or all the actors, whomever you want to use this). One way may be to put this on the 1st skill that's used as the initial "Attack" button.

@Dopan I am curious as to how you would make if/else clauses work with passive states, then. I have been having a problem myself with a conditional clause and you may have found the answer. What should I put instead of "ifStateAffected"?
i dont know u can only experiment with the:
" _passiveStateRaw " Category.. its basicly something that store passives and it should be possible to ask the System: "what is stored inthere?".. but i didnt try to make this work yet.. sry
Perhaps its needed to build a own Command for this but im far away from beeing skilled enough to do such thing.
(addState, removeState ,isStateAffected .. are "Commands" that allredy exist,, and at the moment i dont know if or how its possible to build such Commands)
EDIT
Another Info i can give is:
If u use Passive State "5" for Example and u also use a Command to add State "5" to an Actor (with "addState" for EG) ..than the Actor has this State but with 2 parts..
-1 part is the real State which can be used with regular commands like "removeState"..ect
-the second part is the Passive State part which only reacts on its "Conditions"..
=> so its possible to use both at the same time on the same state (passive and regular state) even if i dont know what this could be good for.. im just tryin to explain what i know for sure about auto passive states
@ Sirius270
Edit2

ok i tryed this: "$gameActors.actor(1)._passiveStateRaw" in the Console that could be helpfull.. the Actor has no Passive thats why the "[ ]" is empty.. probably its possible to ask about something like :
if -> " $gameActors.actor(1)._passiveStateRaw[5] " ect..
(This would ask about : "if passive state nr 5 is active on actor 1")
Screenshot_2.png
 
Last edited:

ATT_Turan

Veteran
Veteran
Joined
Jul 2, 2014
Messages
89
Reaction score
39
First Language
English
Have you tried having a second passive state with the opposite condition? If you have one with Passive Condition: MP Below 2%, that code will execute only when your original state isn't doing anything.

As to how to make that do a one-time effect...I think you'd have to have each actor have a global variable that represents if they've lost your MP<1% state. So inside your second state you'd do, pseudo-code,
if (actor's variable is 0)
call the common event that makes them play the animation and do the rest of the stuff in your Remove
set actor's variable to 1

Then, add code to your original state
if (actor's variable is 1)
set actor's variable to 0, so the next time your other state becomes active it'll run again

There might be a more elegant way to do it, but I don't see a way just using the Yanfly States commands.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
601
First Language
English
Primarily Uses
RMMV
@Dopan thank you for the info.
@Sirius270 thanks for the suggestion
@ATT_Turan thanks for the suggestion. This actually got me thinking outside the box. What I ended up doing is having another passive that triggered when the MP < 1%, and this passive has a custom turn start effect that adds another state if this other state is not already applied, which then does what I needed it to. It's kind of a long work around; however, the result that I wanted is repeatable and consistent.

I would say the problem is solved, thanks.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,366
Reaction score
5,027
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Recent threads, and my very poor algorithm for my minimap plugin have made me face the fact that I need to review algorithms and such.

Going through Cracking the Coding Interview now. I am so excited.
Kes
I've seen a reference to a Community Lighting plugin for MZ, but cannot find it. Is it still in beta?

Todo:
Add fog of war
Add enemy indicators
Make window draggable
Optimise map drawing algorithm (5 seconds to load the map you see, so it's a... poo-poo algorithm)

Any suggestions? :kaoblush:
bleh studio hell job haha at least they like it didnt had time to do much laundry tho ;w;'....YES I DO AT LEAST TAKE A SHOWER everyday!
Ami
--- Food Ingredients ---

Hero: Since the Chef are in Hospital,we can't eat his Dish in 3 Days.
F.Mage: What we have to Eat?
M.Healer: Don't worry,we can Eat the Food Ingredients.
Hero & F.Mage
: Really?

(3 Days Later)

Chef: Hi,Guys. I'm Ba---
(Entire Party Collapse After Eat Raw Meat)
Chef: Wha...WHAT GOING ON HERE!!!!!!

Forum statistics

Threads
102,912
Messages
995,911
Members
134,360
Latest member
Balthierrff
Top