# Having Misses still apply a state

#### AbstractMan

##### Forever lost in the Tea Room of Despair
Good evening!

I have a combat system in my game that allows you to use more than one move per turn. I balance this in several different ways, but one, in particular, was to allow only one skill from the skill category “Free Action” per turn. I have made this happen by adding a state applied to those skills that disable usage once you use the move built into the damage formula.

Now this works, but early on I stumbled across a problem is that if you miss, the state is not applied. I changed this by adding zero’s to the formula to simulate misses, but it is not the cleanest. I am wondering if there was a way to add a state in using a move, even if you miss?

#### Tiamat-86

##### old jrpg gamer
i handled this with yanfly action sequences by having
<setup action>
</setup action>
in every instant action's action sequence
state X has
<Cancel Instant Skill: 1 to 500>
<Cancel Instant Item: 1 to 500>
(dont even have anywhere near 500 battle useable items lol)

#### Zerothedarklord

##### Veteran
if what he gave you above isn't what you're looking for, you can also add a bit into the damage formula for the skills in question that can apply the state to the user.

#### AbstractMan

##### Forever lost in the Tea Room of Despair
Yeah, the first bit is not working with the action sequences.

My damage formulas look something like this.

<damage formula>

/* declare variables */

var roll = Math.floor((Math.random() * 10) + 1)

var dodge = Math.floor(Math.random() * 4) + 1

var hit = 0

if(roll === 2){

hit = 3;

}

else if(roll === 3){

hit = 3;

}

else if (roll === 4){

hit = 4;

}

else if (roll === 5){

hit = 5;

}

else if (roll === 6){

hit = 4;

}

else if (roll === 7){

hit = 4;

}

else if(roll === 8){

hit = 3;

}

else if(roll === 9){

hit = 4;

}

else if(roll === 10){

hit = 6;

}

else if(roll === 1){

hit = 5;

}

if (dodge === 1 && b.isStateAffected(115)){

a.removeState(34)

value = 0;

}

else if(a.isStateAffected(34)){

a.removeState(34)

value = 6 + (a.atk ) + (b.mdf -1) - (b.def -1) - (a.mat - 1);

}

else if(roll !=0){

value = hit + (a.atk ) + (b.mdf -1) - (b.def -1) - (a.mat-1);

}

else{

value = 0;

}

</damage formula>

Now the trouble lies in when it misses the State 20 that I want to always be applied simply does not apply unless it hits. Any other way i can modify the script?

#### Zerothedarklord

##### Veteran
if you want the state to be applied to the user, I add this to the beginning of damage formulas:

Change the 104 to whatever state you need. I use this to create "Cooldowns" on enemy abilities, allowing bosses to have very powerful abilities while preventing them from being spammed. The corresponding state applies a "skill seal" on the skill used, preventing it's use again until the state falls off.

Now, I don't know how this will work with a miss, because I don't know if the damage formula is executed if a miss occurs, but if it does, then that should work for you, I'd like to hope.

I haven't tested it this way before, but I'd be curious if changing the a to b might apply the state to the target.

#### AbstractMan

##### Forever lost in the Tea Room of Despair
It is indeed a lovely way to add cooldowns, but yes the game does not appear to look at the damage formula at all in the event of a miss.

I might just stick with Zero's representing misses for now. Combat systems take so much time! Especially when you are doing a plugin-based one like Lecodes.

#### Tiamat-86

##### old jrpg gamer
what plugin are you using for the damage formula thing?
if the action sequence is a no go you could try a combo work around with yanfly's buff/state core and auto passive states.
have actors get the passive state from actors notetag. this state would have
<Custom Action Start Effect>
</Custom Action Start Effect>
the X state would be the cancel instant actions state

#### AbstractMan

##### Forever lost in the Tea Room of Despair
Yanfly's damage formulas is the plugin I am currently using. So the state i have stops you from using any more actions from that skill type if one is used. If i start with it, would they not already be default blocked?

#### Tiamat-86

##### old jrpg gamer
both method i suggested apply the sealing state after the action was initiated so it does that action that was already started but it seals it for the rest of that turn.
the action sequence thing should still work since they are both yanfly plugin.
the passive state option, the passive state itself is completly blank aside from the notetag adding a different state any time an action is used

edit: is it yanfly instant cast skills plugin your using for this?
thats what i use for similar thing
allows for each actor to get 1 instant + 1 standard action per turn,
even if the standard action was 1 that had the instant cast notetag.

Last edited:

### Latest Profile Posts

Less than a week and I can move into my new apartment and out of this bad situation. I'm so excited! Then game making power will increase.
Enter the password in letters. (English subtitles)
I really tried to pull off something for halloween, but I don't feel like going on. I feel like the plot I was building was too generic, and I couldn't connect to it as I do with other projects. On the bright side, I've been working on my cosmic-puzzle project, so far I think the core mechanics are working properly, so I'll be creating some large test maps to see how it works out.

--- X Costume ---

M.Healer: I'm wearing M.Mage's Costume.
M.Mage: I'm wearing M.Healer's Costume.
M.Knight: Why not using the Scary Costume like me,The Scary Frankenstein?
M.Healer: Err…Because we have low of Budget.
M.Mage: Yeah,right.