[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
55
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
920
Reaction score
579
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 Profile Posts

Last week I was resting and working mainly on the game!
The current progress of the character.
OxWQ7zO.gif

Pre-programmed character :
-Cleaning
-Magic Book(include blood mode)
-Kettle pot stirring
-Other specimens(flower/bug...etc)
I found a huge spider in my house but it has disappeared and now I'm living in fear and paranoia
It's funny, the only reason I haven't actually released a prototype or demo is not that I don't have one. Hahahahahaha I do, I've had a prototype for months. I'm really just concerned with someone taking it, and putting it up on Steam or something first, then saying it's theirs. I should probably look into setting all that up or something... Then again, I have no ETA on the full game so not sure it's worth it yet.
Pixel Grass Sprites, Questing & Fast Traveling w/ Items, Sci-fi & Distorted Music | RPG Maker News #35

Is it me or while modifying RTP style SV Actor sets to make them taller, the idle animation is the hardest to get right? I think it's because that's the one that you see most so seeing pixels that look wrong make you constantly seek to correct that.

Forum statistics

Threads
111,225
Messages
1,059,397
Members
144,489
Latest member
andreskywalker
Top