RMMV Make state duration dependend on other battler's state

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
188
Reaction score
289
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
2,830
Reaction score
1,652
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
188
Reaction score
289
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
2,830
Reaction score
1,652
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
188
Reaction score
289
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
2,830
Reaction score
1,652
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
188
Reaction score
289
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
2,830
Reaction score
1,652
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

Where would you go if you're looking to hire someone on here? I'm in need of a writer to take my story concept and turn it into npcs/dialog in my game.
Evening humans! How goes the game make?
The anime characters we saw 20 years ago,
still have the same age when we see them now.
Somehow it's strange but also beautiful.
It's like no matter how much we change,
there's certain part of ourselves we can reconnect to when we see them again.
Took a long, long time, way longer than it should to be honest...but I've finally finished the big content update to my demo!
Lots of not good things happening IRL but I'm not gonna let this day end like this. Quote time:
"Success is not final, failure is not fatal: it is the courage to continue that counts." -Winston Churchill

So, keep going, lads. Whatever you do keep going. Until next time.

Forum statistics

Threads
117,252
Messages
1,105,873
Members
153,420
Latest member
doldol
Top