MV How to apply a state to the user of an attack?

I want a skill in my game where the user fires a gun but spends another turn "reloading" (unable to perform another action), but I can't find a way to apply a state to the user of a skill that targets an enemy or ally. I also couldn't make using a secret skill that you can't normally access to work, so does anyone know a solution I can use?
Additionally, how can I make the inverse where a move takes a turn to "charge" and then actually utilise the skill on the next turn? Sort of like Solar Beam in Pokémon. Thank you to anyone for advice!
a.gainstate(x) with x being the state id ofc. ^w^
----
I want a skill in my game where the user fires a gun but spends another turn "reloading" (unable to perform another action), but I can't find a way to apply a state to the user of a skill that targets an enemy or ally. I also couldn't make using a secret skill that you can't normally access to work, so does anyone know a solution I can use?
Additionally, how can I make the inverse where a move takes a turn to "charge" and then actually utilise the skill on the next turn? Sort of like Solar Beam in Pokémon. Thank you to anyone for advice!
I was wrong, actually, here's an example damage formula from an old project of mine.
a.addState(24); a.mdf * 2 - b.def

@Someweirdguy05 , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.


You can use the formula to add the state to the user as shown above, but i recommend using a plugin like yanfly's skill core or yanfly's action sequences to only give it to the user when the skill is used. if you make use of the auto battle flag trait, then that code gets ran as part of the decision making process and youll perma-stun your actor

The charged skill can be done with troop events, but it would be a bit cumbersome as you would need to check to see if the actor(s) in question have that state and force them to use the other skill at the end of the next turn each turn of each fight.

it can be easily done with plugins, however. Yanfly's jump trick handles all of whats needed for something akin to solarbeam
coming back to this thread after a while
it can be easily done with plugins, however. Yanfly's jump trick handles all of whats needed for something akin to solarbeam
i've tried playing with yanfly's jump trick scripts and whatnot, but the enemy just gets stuck in its charging state and never leaves. all i've removed is the action sequence parts to remove the enemy jumping into the air, as that's not part of how the attack works. what did i do wrong? i'll post the notebox scripting in case i somehow messed something up there
Spoiler: Charge skill
Code:
// Action Sequences
// Whole: Ensure nothing happens.
<Whole Action>
</Whole Action>

// Target: Flag the target.
<Target Action>
action effect
</Target Action>

// Follow: Apply Jump state to user.
<Follow Action>
add state 16: user
</Follow Action>
Spoiler: Fire skill
Code:
// Action Sequence
// Target: Ensure nothing happens.
<Target Action>
</Target Action>
Spoiler: Charging state
Code:
// Selection Control
<Cannot Select: All>

// Buffs & States Core
<Custom Leave Effect>
// Get the landing skill.
var skill = 27;
// Get the last targeted index.
var target = -2;
// Queue the forced action.
BattleManager.queueForceAction(user, skill, target);
</Custom Leave Effect>
the slot numbers for each are: Charge skill = 0026, Fire skill = 0027, Charging state = 0016

EDIT: i forgot to mention the order i placed the necessary plugins. here's a screenshot of my plugins list
1773908006182.png
the enemy just gets stuck in its charging state and never leaves
Can you provide a screenshot of the state and all of its info? It sounds like it either doesn't have a duration, or it's set to action end and the the state prevents them from acting.
Can you provide a screenshot of the state and all of its info?
i'll also throw in the two moves if that's helpful
Spoiler: Screenshots
1773942425798.png
1773942468552.png
1773942529651.png
It's what I mentioned earlier
it's set to action end and the the state prevents them from acting
With Yanfly's Battle Engine Core, action end states only have their turns decrease after the batter has taken an action. If any states prevents them from acting, the turn count of their action end states do not decrease.
You need to change it to turn end as shown in the jump video or do something like Yanfly's confusion tip where you change the restriction and replace the action with another skill.
well, it activates the firing skill now, but it doesnt actually target any of the players or deal damage. i've tried changing the scope on both skills to all enemies, but it doesn't do anything still. i haven't changed anything else that wasn't necessary...
Your skill is using <target action> to carry out its effects. Either give it a manual <whole action> to do all the effects, or give it an animation. Skills without an animation default to target effects, even when they target all enemies/allies

Original thread: https://forums.rpgmakerweb.com/threads/how-to-apply-a-state-to-the-user-of-an-attack.180242/