Tsukihime

Skill casting time

51 posts in this topic

Skill casting time

-Tsukihime

 

This script adds cast times for your skills.

Time is measured in turns.

 

When you use a skill, it checks how many turns you must wait. All skills have a cast time of 0 by default, which means you can use it immediately.

 

If the casting time is greater than 0, you will be put into a "casting" state, which should prevent you from inputting any actions.

 

When enough time has passed, the battler will come out of casting state and execute the skill.

 

If for some reason the casting state was removed, it will break the skill preparation and the battler can choose an action.

 

Usage

 

Create a new state for the "casting" state.

Set the ID at the top of the script.

Ideally, you should also set the state restriction to "cannot move" to make it realistic. I don't know what will happen if you choose not to though.

 

Then tag any skills that should have a casting time > 0 with

 

 

 

<cast-time: n>
For some integer n

 

Then when you (or the enemy) uses the skill, you will find yourself waiting that many turns before you execute the skill.

 

Download

 

Script: Download here

 

Notes

 

I have overwritten one method in Scene_Battle.

 

If your battle system is incompatible, you will need to figure out where to insert the line with the "#new line" beside it.

 

def process_action
  return if scene_changing?
  if !@subject || !@subject.current_action
    @subject = BattleManager.next_subject
  end
  return turn_end unless @subject
  
  @subject.check_cast_time # new line
  
  if @subject.current_action
    @subject.current_action.prepare
    if @subject.current_action.valid?
      @status_window.open
      execute_action
    end
    @subject.remove_current_action 
  end
  process_action_end unless @subject.current_action
end
Edited by Tsukihime
Wren, Nekotori, Lazzamore and 2 others like this

Share this post


Link to post
Share on other sites

Nice one! Just a suggestion: Add an easy modification option to activate the popular Jump skill and users have an easy script for that one at last ;)

 

I immediately thought of the famous jump when I read that the actor cannot use skills while the turns count down. Now just add a Float state with the usual earth-elemental resistance and wind-elemental weakness and there you go.

Share this post


Link to post
Share on other sites

It would probably be best to provide multiple "casting" states. One for the generic "stand there and wait" while the other is for jump. Of course, any other state with any other use.

 

Then an add-on script can be written for the jump state, which uses the same cast time logic to determine when to come back down or something.

 

However, that would require some changes to how the states are handled, since it's no longer assuming a hardcoded state.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

One could use it in combination with Victor's Auto State Apply script, which offers a variety of conditions and triggers. An option to directly add a Jump command to the commands list for the actors who learned it would be additional beauty, of course, although that would probably tackle too many different corners of individual scripts you have already done (straying from the one-script-for-one-purpose approach you seem to follow, I mean.)

Edited by Caveras

Share this post


Link to post
Share on other sites

Someone found some bugs.

 

I have added a new state called "suspended casting" which is basically casting, except the countdown doesn't go down (for example, if you're stunned or something).

 

If the casting state is explicitly removed, the reserved casting skill will be cleared out (was not done before so weird things happened)

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Thanks a lot for this script Tsuki:3

It was a pain to have my healer monsters being able to cast

an OP healing spell within 1 turn(making it pretty much impossible

to lose(>_< ;) Also,is there any way to display some kind of casting

animation during the waitOwO??

Share this post


Link to post
Share on other sites

I think yanfly or victor has a script for "state animations" which basically allows you to play an animation while a state is active. So you can try to use that for your animations, because casting is just a state.

Share this post


Link to post
Share on other sites

Say, how would you add a short wait, e.g. 2 seconds, after executing a skill that has cast time?

 

I believe it is intended that way or because I modified YF's script to not display all state messages, but whenever I use a cast-time skill, the enemy immediately reacts with his action. A short time buffer would be nice, but I don't see where I could add one to a state or how to include it in the code.

Share this post


Link to post
Share on other sites

I can see that, but I meant that I wanted to include a short wait when a character enters the casting state, so that the next action in the battle flow (the enemy's attack mostly, in my case) doesn't happen almost immediately after the actor enters the casting state.

Share this post


Link to post
Share on other sites

Nevermind, inserting a "wait(30)" after the state infliction already did the trick. Tried it before but then it didn't, guess I fixed it now, though. That was all I was looking for. Thanks anyway, but I didn't want to include his whole State Animations script just to include a little pause ;)

Share this post


Link to post
Share on other sites

This script is pretty sweet. One thing, I agree about the timing problem. Characters are executing their delayed skills at the same time as enemies and other characters. That should be fixed up. Other than that, works like a charm.

Share this post


Link to post
Share on other sites

This script is pretty sweet. One thing, I agree about the timing problem. Characters are executing their delayed skills at the same time as enemies and other characters. That should be fixed up. Other than that, works like a charm.

 

Wait, what?

So if you had two actors using the same skill, both skills would be executed at the same time and you have multiple animations and battle log messages all conflicting with each other?

 

I can't reproduce the issue. Eric and Natalie along with two slimes all use dual attack with a cast time of 3 turns. A bee uses attack with no cast time. The bee attacks 3 times, and then finally natalie attacks, eric attacks, slime A attacks, slime B attacks.

 

All in sequence, which is what I expect since it follows the turn order that the battle manager generates at the beginning of each turn. Once a battler's turn to execute an action comes along, it checks whether it can execute or not by checking if the battler has a cast skill queued up and no cast state.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

In my case, I made a jump-style skill with cast-time 1. So, the battle begins, four actors, one enemy, actor 1 attacks, actor 2 attacks, actor 3 attacks, now actor 4 launches his cast-time skill, enters the casting state, and immediately - as soon as the actor enters the state - the enemy does his attack without a slight delay. Since no message appears in the log for the actor either launching the skill or the state being applied, it looked as if the actor did nothing in my case. Then actor 1 - 3 attack, actor 4 "returns from above" and executes his skill like he should, everything fine there. It was just the end-of-turn-entering-state-immediate-attack-by-enemy issue I had, but like I said, the wait insert fixed it.

 

Not too sure why it wouldn't display anything in the battle message window when either the skill is chosen or the state applied, but the only thing that appears is the regular "Actor uses XXX skill!" line that I've added to the skill, which appears correctly when the actor actually executes the skill after the set rounds. And yes, I have given the state a message that should appear when it is applied.

 

Anyway, works for me now the way it is.

Share this post


Link to post
Share on other sites

The visual discrepancy is probably just a side-effect of Animated Battle 1.14, then.

 

On the following turn (assuming there's a 1 turn wait), the actor will execute his ability but ignore the pose wait settings (i.e. the next actor or enemy will act simultaneously).

Share this post


Link to post
Share on other sites

Pose wait settings? I'm assuming that's specific to the animation script. There is no guarantee that the cast state would tell the script that the battler is waiting.

 

I've added some code to show the "entered state" message, however there is an issue with the current battle log.

 

It assumes every skill either does damage, recovers damage, or does no damage.

If a skill does no damage, you will always get the message " .... took no damage!"

 

Which is wrong. If you're casting something, you shouldn't get that message.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

That's right...and alright, I can see where this is not the best solution, but thanks for making that clear and adding the state message display!

 

I'll try to create a workaround by inserting a switch check or state check in Game_ActionResult before the ActorNoDamage line, even though that's probably not the best way either.

Share this post


Link to post
Share on other sites

Tsukihime,

 

You have such varied and precise ideas for scripts.

 

I know many people appreciate your continued support of the scripting of RPGMaker and I am definitely one of them.

 

Thank you so much for all of your time and talents in making these scripts!

 

I'll be fiddling with this script for sure.

Share this post


Link to post
Share on other sites

Omg, I love this.

Wonder how you can make it so that a skill can wait actions instead of just turns, for a system of timing, like, you use the skill then right after, you get a state that modifies something, 2 slimes attack, then you cast the skill.

Or you could have it so that the skill used, then activates at the end of that same turn, or the beginning of next turn.

Because you could have it so that the character jumps up for 2 moves, dodging any low attacks, then after that they're back on their feet, or you could have it like on dissidia where moves have different effects on you, like, you null all low-priority damage while charging up your attack/etc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.