Feature for Yanfly's CTB

I'm working on a game where spells have casting times.  While the CTB Has a built in delay function, it's based around the user's AGI.  A mages AGI would have nothing to do with their casting time.

I'd like to be able to make casting time formulas.  There are formulas for delaying the opponent in lunatic mode, but there's really nothing for altering Pre-Cast delay.
Ideally, I'd like to be able to delay by turns instead of by speed, and augment that by the user's MAT.


<Charge Turns: Formula>


And just to show what I want to do with said formula


<Charge Turns: Math.Max(0, x - Math.floor(user.mat/10)) >


Where x is the number of turns to send the user back before the skill is cast.



This creates a system where spells have innate casting time in CTB Turns, which could be augmented by being a skilled mage with a high MAT stat.


<Charge Turns: Math.Max(0, 3 - Math.floor(7/10)) > = 3 Turn Delay.


<Charge Turns: Math.Max(0, 3 - Math.floor(27/10)) > = 1 Turn Delay


<Charge Turns: Math.Max(0, 3 - Math.floor(107/10)) > = 0 Turn Delay

And changing the mat divisor or the base turn delay would give the user full control over how much delay a spell should have and how well it would scale to the user's MAT.
Shameless bump
So, I was quite intrigued by your dilemma, and was curious if I could find a way to solve it within the Plug-In's built-in capabilities, and I finally figured out how.


In order to set a battler's turn order in a specific position we have to know two things: Who we're putting the battler behind, and how much AGI that battler has. This is because the CTB system (by default) is setup to run its ticks based on individual battlers' AGIs.


To place a Battler back a specific and exact number of turns you can use this formula in an <After CTB Eval> notetag in the skill:


"speed = max - (a.agi * BattleManager.ctbTurnOrder()[X].ctbTicksToReady()) - (a.agi * a.minorCTBOffset());"


Where X is the number of "turns" you want to push the character back (in your case, you could place your formula there).


This does, however, raise the question of how to cause your skill to occur at that moment. I have figured that out as well.


I simply created the skill to be used, a skill to prep it, and a state that says a skill is being prepped.


In the skill to be used, I made it a type called "Cast" that no classes inherently have, this way we can add it (via state) to the character when the charge is up.


In the preparatory skill, I made it have the target of "User" and the effects of adding the state and learning the skill above.


In the state, I have made it seal all skill types as well as the "Attack", "Escape", and "Guard" skills and added the Cast skill type so that "Cast" is their only option (unless they choose to skip the turn, a sort of cancel effect). The state has a one turn, "Turn End" removal as well as a <Custom Leave Effect> (from Yanfly's Buffs & States Core) that removes the skill we added.


If only one character will ever be "Casting" then you can setup some more Lunatic Mode Code that will make it so you only have to have one state by using variables, as the current setup would require (if more than one character would "Cast") an individual state for each "Cast" skill.


While this process is obviously a little obfuscated in appearance, it works, quite well actually.
So, I was quite intrigued by your dilemma, and was curious if I could find a way to solve it within the Plug-In's built-in capabilities, and I finally figured out how.


In order to set a battler's turn order in a specific position we have to know two things: Who we're putting the battler behind, and how much AGI that battler has. This is because the CTB system (by default) is setup to run its ticks based on individual battlers' AGIs.


To place a Battler back a specific and exact number of turns you can use this formula in an <After CTB Eval> notetag in the skill:


"speed = max - (a.agi * BattleManager.ctbTurnOrder()[X].ctbTicksToReady()) - (a.agi * a.minorCTBOffset());"


Where X is the number of "turns" you want to push the character back (in your case, you could place your formula there).


This does, however, raise the question of how to cause your skill to occur at that moment. I have figured that out as well.


I simply created the skill to be used, a skill to prep it, and a state that says a skill is being prepped.


In the skill to be used, I made it a type called "Cast" that no classes inherently have, this way we can add it (via state) to the character when the charge is up.


In the preparatory skill, I made it have the target of "User" and the effects of adding the state and learning the skill above.


In the state, I have made it seal all skill types as well as the "Attack", "Escape", and "Guard" skills and added the Cast skill type so that "Cast" is their only option (unless they choose to skip the turn, a sort of cancel effect). The state has a one turn, "Turn End" removal as well as a <Custom Leave Effect> (from Yanfly's Buffs & States Core) that removes the skill we added.


If only one character will ever be "Casting" then you can setup some more Lunatic Mode Code that will make it so you only have to have one state by using variables, as the current setup would require (if more than one character would "Cast") an individual state for each "Cast" skill.


While this process is obviously a little obfuscated in appearance, it works, quite well actually.

Your formula did work, along with your state method! 🙂
The only issue I'm having as of now is removing all skills from the skill type added

Original thread: https://forums.rpgmakerweb.com/threads/feature-for-yanflys-ctb.63671/