[RMMV] Inflict Status on User After Skill?

Pandappuccino

Depressed Panda
Member
Joined
Aug 2, 2020
Messages
17
Reaction score
19
First Language
English
Primarily Uses
RMVXA
Hi, this may sound like a very specific question with a very simple answer, but I just want to verify it to be 100% certain.

I have a character in mind for a project who, for her own reasons, suffers severe fatigue. She can fight but it runs the risk of her getting winded and not being able to act for a turn. I want to have this factor into her attacking skills, in which she performs the attack, dealing damage to an enemy, but can't move on the next turn.

My question is thus: how can I make use of the damage formulas to inflict said status on her, not on whichever enemy she attacked? I know that a lot can be done with the RMMV damage formulas, I'm just not totally certain how to go about creating this formula. The idea is something like this:

Character uses skill -> Damage dealt to enemy -> Fatigue status inflicted to character
 

DawnStar

Star of Hope
Veteran
Joined
Nov 25, 2020
Messages
44
Reaction score
52
First Language
Spanish
Primarily Uses
RMMV
Damage formulas are used to determine the amount of damage a skill does (user's attack vs target's defense, stuff like that), they only deal with HP and MP values so you can't add a state through a formula. However, you can use plugins to achieve what you want.
For example, one of the easiest ways is you can install Yanfly's Battle Engine Core and Battle Action Sequences plugins (they're available in this pack), and add the following to the Notebox of her skills:
Code:
<follow action>
if user.actorId() == x
    add state y: user
end
</follow action>
Replace x with your character's actor ID (their number in the database), and y with the ID of your Fatigue state. What this does is that it check who the current battler who launched the skill is (by their ID), and if it's that particular actor, it adds the state only to her. Since it's a follow action, it will be executed after the damage is dealt. The check is in case you want this also happen on the normal attack as well or on shared skills by other battlers.
 

Pandappuccino

Depressed Panda
Member
Joined
Aug 2, 2020
Messages
17
Reaction score
19
First Language
English
Primarily Uses
RMVXA
Damage formulas are used to determine the amount of damage a skill does (user's attack vs target's defense, stuff like that), they only deal with HP and MP values so you can't add a state through a formula. However, you can use plugins to achieve what you want.
For example, one of the easiest ways is you can install Yanfly's Battle Engine Core and Battle Action Sequences plugins (they're available in this pack), and add the following to the Notebox of her skills:
Code:
<follow action>
if user.actorId() == x
    add state y: user
end
</follow action>
Replace x with your character's actor ID (their number in the database), and y with the ID of your Fatigue state. What this does is that it check who the current battler who launched the skill is (by their ID), and if it's that particular actor, it adds the state only to her. Since it's a follow action, it will be executed after the damage is dealt. The check is in case you want this also happen on the normal attack as well or on shared skills by other battlers.
Conveniently enough I just bought the whole bundle last night! Thanks, that should make this a lot easier.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
913
Reaction score
576
First Language
English
Primarily Uses
RMMV
Damage formulas are used to determine the amount of damage a skill does (user's attack vs target's defense, stuff like that), they only deal with HP and MP values so you can't add a state through a formula. However, you can use plugins to achieve what you want.
For example, one of the easiest ways is you can install Yanfly's Battle Engine Core and Battle Action Sequences plugins (they're available in this pack), and add the following to the Notebox of her skills:
Code:
<follow action>
if user.actorId() == x
    add state y: user
end
</follow action>
Replace x with your character's actor ID (their number in the database), and y with the ID of your Fatigue state. What this does is that it check who the current battler who launched the skill is (by their ID), and if it's that particular actor, it adds the state only to her. Since it's a follow action, it will be executed after the damage is dealt. The check is in case you want this also happen on the normal attack as well or on shared skills by other battlers.
Even more convenient than an action sequence would be a note tag from SkillCore that plays after a skill has been used.

Code:
<After Eval>
user.addState(x)
</After Eval>
Put the above tag on any skill the actor uses, and it will give them state Id x (replace x with the id number).

If your actor makes use of skills that other actors can use, like a shared magic spell or something, you can instead use a passive state on the actor to inflict the fatigue state after any action is taken by them.

<passive state: x>
Put that tag on the actor, and change the x to the id of the state we'll user for the passive state.

Then make a new state, and put the following notes on it:
Code:
<Custom Conclude Effect>
user.addState(x)
</Custom Conclude Effect>
This tag makes it so that any battler afflicted by this state will be afflicted by state x at the end of their turn if an action was taken. Change the x in the notes here to the fatigue state, and they will be fatigued after any action is taken.

Edit:
This probably isn't super relevant, since you've been given alternative ways to do it already, but you should never apply states or do other battle related mechanics inside the damage formula for a skill. The reason for this is that the damage formula is often evaluated as part of the AI to check if a skill should be used or not.
While in this case it might work fine, you might find that if an enemy has this skill, or the actor is afflicted with a state that makes them auto-battle, they might randomly gain the state without having done anything at all. When the formula is evaluated, it's often checking which available action will cause the largest effect, and to do so, it has to check the formulas of all available skills. When it checks a skill that has a mechanic in the formula, such as causing a fatigue state on the user, it ends up causing that state to the user. Since it's not expecting anything other than damage inside the formula, it doesn't know to remove the state, or otherwise reset the battler after, so the AI controlled battler ends up afflicted by the state.
The same will happen with other functions you could call from a formula as well, such as incrementing a variable, or calling functions from plugins. If you are trying to track how many times a skill has been used, for example, every time the battler has its abilities evaluated, this number would go up, even if they did not end up actually using the skill.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

I've been working on some ABS team A.I. for 'A New Suburbia', and thought I'd share.

I'm generally quite please although the AI is a little grenade heavy right now :rolleyes: - Sneaking and stalking next! Please excuse the terrible map... it was just for ease of viewing!
Voting for the second round of the Map Madness Tournament is now live! Vote for your favorite in each matchup! https://forums.rpgmakerweb.com/index.php?forums/map-madness-2021-polls.187/
Just bought the Visustella All Waves bundle... Time to go IN!!
Oh, I was just confirmed I'll be doing small online classes during june - july, on one side I'm nervous and looking forward it, on the other one: I've became the very thing I swore to destroy. :kaodes:
Work starts today at 2pm. I hate jeans, but the dress code says I have to wear them... That's how I discovered I was a plus size. Shopping for my first pair of jeans.
Anyhow, I'll post a new video on TheDazzlingsAreBack as soon as I'm able to.

Forum statistics

Threads
110,576
Messages
1,054,325
Members
143,689
Latest member
Twin_A
Top