RMMV Make state duration dependend on other battler's state

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
260
Reaction score
380
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
7,629
Reaction score
5,398
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
260
Reaction score
380
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
7,629
Reaction score
5,398
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
260
Reaction score
380
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
7,629
Reaction score
5,398
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
260
Reaction score
380
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
7,629
Reaction score
5,398
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 was surprised to see a email from Safeway that my grocery have been delivered when they have not. The email was a noreply message. So enjoy the $88 of free food random person.
Well friends, I'm happy to announce that I've officially completed 1 plugin and am running compatability tests and writing the documentation for the second tomorrow morning!
Vegan post. Pic of a pig in a suit and tie like he is laying in a coffin but it's a sandwich. 'One meal soon forgotten, in exchange for a whole life." Really don't think rolling around in poop your whole life would be so valuable.
Guys, Tutorials is for posting tutorials you have written, not for asking for help. Use the Support forums for that please.
Trailer is almost done for the game i can't wait to show it to everyone

Forum statistics

Threads
129,862
Messages
1,205,780
Members
171,040
Latest member
babeby_s
Top