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?
i handled this with yanfly action sequences by having
<setup action>
add state X: user
</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)
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.
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;
}
a.addState(20)
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?
if you want the state to be applied to the user, I add this to the beginning of damage formulas:
a.addState(104);
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.
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.
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>
user.addState(X)
</Custom Action Start Effect>
the X state would be the cancel instant actions state
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?
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.