RMMV Make state duration dependend on other battler's state

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
193
Reaction score
309
First Language
German
Primarily Uses
RMMV
I'm still not sure how to title this, so here is what I mean:

An enemy inflicts a state on an actor. I want the enemy to be stunned as long as the actor keeps being in this state.

So I created a skill using Yanfly's Action Sequences that inflicted said State A to the Target and State B on the Caster. State B makes the enemy unable to move. Both states have the same duration, so if they wear of naturally they do so at the same time.

But what if the actor with State A dies or is cured? How do I check this and make State B on the original caster disappear? I could do something using battle events, but I think this will only work if there is just one enemy able to use this skill and my battle events are pretty cramped already, so I figured I'd rather use Yanfly's Buffs & States Core to do something like this:

<Custom Action End Effect> if(user.isDead()) { origin.removeState(59); } </Custom Action End Effect>

Unfortuantely I don't know how to refer correctly to the unit the state is inflicted on, nor at which time I should apply this effect, how to make State B wear of, when State A is cured or if this is the right approach at all.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,878
First Language
English
Primarily Uses
RMMV
You have the right idea, you just missed the correct notetag - Custom Remove Effect runs when the state is removed manually or due to decay. So inside there you'd just put origin.removeState(59)

The trick is that there are no tags which run when an actor dies and gets stripped of states. So there are a few ways to go about it, but I think the easiest is to make a Custom React Effect that checks whether incoming damage is enough to kill the actor, and if so removes the state from the origin as above.
 

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
193
Reaction score
309
First Language
German
Primarily Uses
RMMV
Thanks! Putting it under Custom Remove Effect worked.
For the next step though, this only works for attacks, right? If the actor is killed by Damage Over Time Custom Respond won't trigger?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,878
First Language
English
Primarily Uses
RMMV
Correct. The only way I know to make it trigger if your game has that mechanic is for the state to also make the actor immortal, then every troop that uses this attack has an event page that checks every actor in the party to have no HP, sees if they have the state, remove it from the origin, then remove immortal.
 

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
193
Reaction score
309
First Language
German
Primarily Uses
RMMV
Hmm, I'd rather disable death by damage over time, then, but I also use Custom Regenerate Effect to get those effects. Is there any way to make actors immune to being killed by those kind of effetcs, or maybe make them wear off automatically, if they'd reduce hp to 0?

I know it's slightly off topiv now, maybe I'll need to open another thread, but I'd be thankful for any idea to make this mechanic work properly.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,878
First Language
English
Primarily Uses
RMMV
Hmm, I'd rather disable death by damage over time, then, but I also use Custom Regenerate Effect to get those effects. Is there any way to make actors immune to being killed by those kind of effetcs
Several. You could make the damage be based on a percentage of the actor's current hp, so that can never take them to 0. You could use Math.min(your current damage, user.hp-1) so it can never hurt them lower than 1 HP.
or maybe make them wear off automatically, if they'd reduce hp to 0?
Right inside your custom regeneration add a check that says if current HP is 1, remove the state.
 

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
193
Reaction score
309
First Language
German
Primarily Uses
RMMV
You could make the damage be based on a percentage of the actor's current hp, so that can never take them to 0
Wow, that's what I do anyway for all the states that have this effect. I just forgot that I included a line to round up the damage ... Sometimes I feel like the solution is just one minute of thinking away from the point it point where I gave in and asked xD

So deleting that line or using Math.floor instead should also do the trick.

Thank you again! If there aren't any other things that could cause death, I think I'll be able to make this work now.
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,878
First Language
English
Primarily Uses
RMMV
Sometimes I feel like the solution is just one minute of thinking away from the point it point where I gave in and asked
I have days like that, man.
 

Latest Threads

Latest Profile Posts

I think Kipling said it best.

If you can make one heap of all your winnings
And risk it on one turn of pitch-and-toss,
And lose, and start again at your beginnings
⁠And never breathe a word about your loss,
(...)
Yours is the Earth and everything that's in it,
⁠And—which is more—you'll be a Man, my son!


Do you feel like your modern cities are too clean? I made some dumpsters and trash variations. Visit my MZ resource thread (link in signature).

Forum statistics

Threads
118,579
Messages
1,117,115
Members
155,644
Latest member
Balphegor
Top