Jump to content


Photo

Skill casting time


  • Please log in to reply
50 replies to this topic

#1 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 24 August 2012 - 11:11 PM

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, 07 September 2015 - 11:16 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#2 Caveras

Caveras

    Advanced Member

  • Member
  • 565 posts
  • RM Skill - Designer

Posted 25 August 2012 - 12:20 AM

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.

Hello there!

Here are some of my icon resources » http://www.rpgmakerv...apons-and-more/

Posted a new set on 16 June!


#3 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 25 August 2012 - 12:33 AM

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, 25 August 2012 - 12:36 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#4 Caveras

Caveras

    Advanced Member

  • Member
  • 565 posts
  • RM Skill - Designer

Posted 25 August 2012 - 01:18 AM

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, 25 August 2012 - 01:20 AM.

Hello there!

Here are some of my icon resources » http://www.rpgmakerv...apons-and-more/

Posted a new set on 16 June!


#5 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 26 August 2012 - 01:46 PM

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, 26 August 2012 - 01:47 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#6 Elise-chan

Elise-chan

    Hello^_^

  • Member
  • 62 posts
  • LocationTokyo, Taitō
  • RM Skill - Writer

Posted 26 August 2012 - 02:18 PM

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??
Currently Working on:

Rebirth Fantasy
Alice

#7 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 26 August 2012 - 04:56 PM

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.
All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#8 Caveras

Caveras

    Advanced Member

  • Member
  • 565 posts
  • RM Skill - Designer

Posted 22 September 2012 - 09:12 AM

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.

Hello there!

Here are some of my icon resources » http://www.rpgmakerv...apons-and-more/

Posted a new set on 16 June!


#9 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 22 September 2012 - 09:37 AM

It isn't based on time, it's based on number of turns required to execute a skill.
All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#10 Caveras

Caveras

    Advanced Member

  • Member
  • 565 posts
  • RM Skill - Designer

Posted 22 September 2012 - 09:47 AM

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.

Hello there!

Here are some of my icon resources » http://www.rpgmakerv...apons-and-more/

Posted a new set on 16 June!


#11 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 22 September 2012 - 09:56 AM

Maybe you can give it an animation sequence to force a wait? I don't know how his battle system works.
All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#12 Caveras

Caveras

    Advanced Member

  • Member
  • 565 posts
  • RM Skill - Designer

Posted 22 September 2012 - 10:05 AM

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 ;)

Hello there!

Here are some of my icon resources » http://www.rpgmakerv...apons-and-more/

Posted a new set on 16 June!


#13 WCouillard

WCouillard

    Sanubian Menace

  • Member
  • 1188 posts
  • RM Skill - Jack of All Trades

Posted 22 September 2012 - 02:36 PM

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.

My Completed Scripts: http://pastebin.com/u/WCouillard

Final Fantasy Discovery: http://www.rpgmaker.net/games/4071/


#14 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 22 September 2012 - 03:09 PM

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, 22 September 2012 - 03:11 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#15 Caveras

Caveras

    Advanced Member

  • Member
  • 565 posts
  • RM Skill - Designer

Posted 22 September 2012 - 04:30 PM

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.

Hello there!

Here are some of my icon resources » http://www.rpgmakerv...apons-and-more/

Posted a new set on 16 June!


#16 WCouillard

WCouillard

    Sanubian Menace

  • Member
  • 1188 posts
  • RM Skill - Jack of All Trades

Posted 22 September 2012 - 04:42 PM

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).

My Completed Scripts: http://pastebin.com/u/WCouillard

Final Fantasy Discovery: http://www.rpgmaker.net/games/4071/


#17 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 22 September 2012 - 04:56 PM

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, 22 September 2012 - 05:17 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#18 Caveras

Caveras

    Advanced Member

  • Member
  • 565 posts
  • RM Skill - Designer

Posted 22 September 2012 - 06:07 PM

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.

Hello there!

Here are some of my icon resources » http://www.rpgmakerv...apons-and-more/

Posted a new set on 16 June!


#19 WCouillard

WCouillard

    Sanubian Menace

  • Member
  • 1188 posts
  • RM Skill - Jack of All Trades

Posted 23 September 2012 - 07:28 AM

Could always use VE Skip Battle Log to kill any unwanted messages such as "took no damage."

My Completed Scripts: http://pastebin.com/u/WCouillard

Final Fantasy Discovery: http://www.rpgmaker.net/games/4071/


#20 AriArk

AriArk

    Member

  • Member
  • 11 posts

Posted 21 April 2013 - 03:26 AM

sorry for a nicro bump, but when I put <cast-time: 1> it takes 2 turns.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users