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,802
Reaction score
1,642
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,802
Reaction score
1,642
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,802
Reaction score
1,642
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,802
Reaction score
1,642
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 Posts

Latest Profile Posts

Happy Saint Nicholas Day! May there nice stuff in your shoes when you wake up!
Choosing Beggars are the best source of entertainment.
DavidUchina wrote on caethyril's profile.
You chad, thanks a lot for your plugins. You helped me costumize the buttons in my game.
I created the first teaser for my game! I decided to make an animation of Cabaret Helen advertising the Pizza Time Theater, set to an actual radio commercial. But this is no ordinary advertisement...
"Somber melody and stunning visuals takes one through the bittersweet tale of False Rebirth" ~ Marmalade
https://rpgmaker.net/games/12069/reviews/7576/

Got a first review on my game, on RPG Maker dot net. :kaothx:

Forum statistics

Threads
117,215
Messages
1,105,536
Members
153,360
Latest member
zombiedans
Top