Difference between revisions of "Timed Hits with Action Sequences"

From Yanfly.moe Wiki
Jump to navigation Jump to search
Line 729: Line 729:
 
When the player uses the skill, a barrage of fireballs occur deal multiple hits. When the enemy uses the skill, a single attack occurs with the chance of the player blocking most of the damage.
 
When the player uses the skill, a barrage of fireballs occur deal multiple hits. When the enemy uses the skill, a single attack occurs with the chance of the player blocking most of the damage.
  
Also, this is just an opinion, but this would look great with [[Action Sequence Projectiles VisuStella MZ|Projectiles]]. They were left out of the tutorial in order to keep the simplicity of the tutorial.
+
Also, this is just an opinion, but this would look great with [[Action Sequence Projectiles VisuStella MZ|Projectiles]]. They were left out of the tutorial in order to keep the tutorial simple and easy to digest.
  
  

Revision as of 21:06, 24 January 2024

Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.



Introduction

VisuMZ.142.jpg

Those familiar with Super Mario RPG know about the existence of Timed Hits and the flavor they bring to the battle system. However, we aren't here to talk about what the benefits of Timed Hits are, we are here to explain how to do them in RPG Maker MZ through the usage of Action Sequences.

Keep in mind that this is NOT a beginner's tutorial on Action Sequences. If you want a beginner's tutorial on Action Sequences, read about it in this tutorial article by MirageV.

ArisuAvatar2.png This is an article written by Arisu.

Now, without further ado, let's begin.


What You Need

We will need two plugins:

VisuMZ.002.jpg
The first is the Battle Core.
VisuMZ.142.jpg
The next is QTE and Trigger System.


Tutorial 1: Timed Hits

TimedHitIntro.jpg

Just as a reminder, this is NOT a beginner tutorial on how to do Action Sequences. If you need a tutorial for that, read this tutorial article by MirageV.

We are going to skip right into the Common Event that is going to be used as the Action Sequence for the Timed Hit. Our goal here is to make an attack where if the attacking player presses the Z button at the right timing, the attack will yield a 3x Damage Bonus. Otherwise, it will deal normal damage. If the player is receiving this attack and defends in time by pressing the Z button, then the damage will be reduced to 10%.

Simple enough? Yeah, let's do this.


Timed Hits: Full Action Sequence

TimedHitTut1.png

Here is what the base Action Sequence should look like. The attack we'll be using will be an ice attack using animation 71: Ice I.

◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Setup Action Set
:              :Display Action = true
:              :Immortal: On = true
:              :Battle Step = true
:              :Wait For Movement = true
:              :Cast Animation = true
:              :Wait For Animation = true

◆Plugin Command:VisuMZ_1_BattleCore, MOTION: Motion Type
:              :Targets = ["user"]
:              :Motion Type = spell
:              :Show Weapon? = false

◆Plugin Command:VisuMZ_2_QTE_TriggerSys, QTE: Timed Hit (OK)
:              :Timed Hit Picture = >>>ATTENTION<<<
:              :Coordinate X = Graphics.width / 2
:              :Coordinate Y = Graphics.height / 2
:              :Press in X Frames = 40
:              :Success Switch ID = 1
:              :Timing Variable ID = 0
:              :Success Common Event = 0
:              :Success Sound = {"name:str":"Skill2","volume:num":"90","pit…
:              :Miss Common Event = 0
:              :Miss Sound = {"name:str":"Buzzer1","volume:num":"90","pitch…
:              :Input Start Delay = 0
:              :Wait for QTE? = false

◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Show Animation
:              :Targets = ["all targets"]
:              :Animation ID = 71
:              :Mirror Animation = false
:              :Wait For Animation? = false

◆Wait:40 frames

◆If:Timed Hit Success is ON

  ◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Balloon Animation
  :              :Targets = ["all targets"]
  :              :Balloon Type = Exclamation
  :              :Wait for Completion = false

  ◆If:Script:BattleManager._subject.isActor()

    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 3.00
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆

  :Else

    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 0.10
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆
  :End
  ◆
:End

◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
:              :Targets = ["all targets"]

◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
:              :Critical Hit% = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Critical Damage = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Damage/Healing = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Hit Rate = 
:              :Rate = 1.00
:              :Flat = +0.00

◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Wait For Animation

◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Finish Action
:              :Immortal: Off = true
:              :Wait For New Line = true
:              :Wait For Effects = true
:              :Clear Battle Log = true
:              :Home Reset = true
:              :Wait For Movement = true


Timed Hits: Breakdown

For those who aren't able to follow, let's break down the event commands and Action Sequences used here.

◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Setup Action Set
:              :Display Action = true
:              :Immortal: On = true
:              :Battle Step = true
:              :Wait For Movement = true
:              :Cast Animation = true
:              :Wait For Animation = true

Above is the typical setup action set. Nothing is really changed there. All it does is play the action name, setup immortality flags, play cast animations, and wait for the cast animation to finish.


◆Plugin Command:VisuMZ_1_BattleCore, MOTION: Motion Type
:              :Targets = ["user"]
:              :Motion Type = spell
:              :Show Weapon? = false

Above is just a motion request for the user to perform a spell motion if the user has a Sideview Battler sprite.


◆Plugin Command:VisuMZ_2_QTE_TriggerSys, QTE: Timed Hit (OK)
:              :Timed Hit Picture = >>>ATTENTION<<<
:              :Coordinate X = Graphics.width / 2
:              :Coordinate Y = Graphics.height / 2
:              :Press in X Frames = 40
:              :Success Switch ID = 1
:              :Timing Variable ID = 0
:              :Success Common Event = 0
:              :Success Sound = {"name:str":"Skill2","volume:num":"90","pit…
:              :Miss Common Event = 0
:              :Miss Sound = {"name:str":"Buzzer1","volume:num":"90","pitch…
:              :Input Start Delay = 0
:              :Wait for QTE? = false

A QTE Plugin Command occurs. The QTE Plugin Command doesn't use any special graphics (though it could) and requires the player to press Z in 40 frames. If it succeeds, then Switch 1 is turned on. Wait for QTE is also turned OFF (very important). If you're wondering why 40 frames specifically, that's because for animation 71: Ice I, that we're using for this tutorial, the hit lands at frame 40. If you need help figuring out the duration of animations, read this article here on How to Get Animation Frame Durations.

The same timing is used for both if the target is an enemy or an actor.


◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Show Animation
:              :Targets = ["all targets"]
:              :Animation ID = 71
:              :Mirror Animation = false
:              :Wait For Animation? = false

Next, we just show animation 71, which is the Ice I animation that we're using for this tutorial. Wait for Animation is also turned to OFF.


◆Wait:40 frames

We wait 40 frames because that's when the animation displays a hit on the target. Once again, if you need help figuring out the duration of animations, read this article here on How to Get Animation Frame Durations.


◆If:Timed Hit Success is ON
  ◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Balloon Animation
  :              :Targets = ["all targets"]
  :              :Balloon Type = Exclamation
  :              :Wait for Completion = false
  ◆If:Script:BattleManager._subject.isActor()
    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 3.00
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆
  :Else
    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 0.10
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆
  :End
  ◆
:End

Here's where things change up. We do a Conditional Branch event command to check the status of Switch 1. If Switch 1 is ON, that means the Timed Hit QTE is successful. We play a Balloon Animation Action Sequence to indicate the success.

Next, we do another Conditional Branch event command but with the script call BattleManager._subject.isActor() to check if the user is an actor. If the user is actor, then we use the MECH: Multipliers Action Sequence Plugin Command to increase the damage multiplier to 3x. If the user is NOT an actor (and therefore an enemy), then MECH: Multipliers Action Sequence Plugin Command changes the multiplier to x0.1


◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
:              :Targets = ["all targets"]

Normal MECH: Action Effect stuff to apply the damage and effects.


◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
:              :Critical Hit% = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Critical Damage = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Damage/Healing = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Hit Rate = 
:              :Rate = 1.00
:              :Flat = +0.00

Reset the multipliers.


◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Wait For Animation

Wait for the rest of the animation to finish.


◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Finish Action
:              :Immortal: Off = true
:              :Wait For New Line = true
:              :Wait For Effects = true
:              :Clear Battle Log = true
:              :Home Reset = true
:              :Wait For Movement = true

Finish up the rest of the Action Sequence.


Timed Hits: Test Play

Let's look at how the damage appears without landing any Timed Hits.

TimedHitTut2.gif


Now, let's look at the damage when Timed Hits are landed.

TimedHitTut3.gif

There's a 3x multiplier when used by the player and a 0.1x multiplier when defended.


Tutorial 2: Fireball Button Mash

FireballSpam1.jpg

Just as a reminder, this is NOT a beginner tutorial on how to do Action Sequences. If you need a tutorial for that, read this tutorial article by MirageV.

We are going to skip right into the Common Event that is going to be used as the Action Sequence for the Timed Hit. Our goal here is to make an attack where when it is used by a player character, the player can button mash Z to unload a barrage of fireballs to the enemy at 10% damage per fireball. When the attack is used by an enemy, it will be a single attack that the player can use a Timed Attack to block damage and reduce it to 10%.

Understood? Let's go!


Fireball Button Mash: Full Action Sequence

Here is what the base Action Sequence should look like. The attack we'll be using will be a fire attack using animation 66: Fire I.

◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Setup Action Set
:              :Display Action = true
:              :Immortal: On = true
:              :Battle Step = true
:              :Wait For Movement = true
:              :Cast Animation = true
:              :Wait For Animation = true

◆Plugin Command:VisuMZ_1_BattleCore, MOTION: Motion Type
:              :Targets = ["user"]
:              :Motion Type = spell
:              :Show Weapon? = false

◆If:Script:BattleManager._subject.isActor()

  ◆Plugin Command:VisuMZ_2_QTE_TriggerSys, QTE: Button Mash (OK)
  :              :Trigger Variable ID = 1
  :              :Trigger Common Event = 228
  :              :Trigger Sound = {"name:str":"Skill2","volume:num":"90","pit…
  :              :Input Start Delay = 20
  :              :QTE Duration = 180
  :              :Wait for QTE? = true
  ◆

:Else

  ◆Plugin Command:VisuMZ_2_QTE_TriggerSys, QTE: Timed Hit (OK)
  :              :Timed Hit Picture = >>>ATTENTION<<<
  :              :Coordinate X = Graphics.width / 2
  :              :Coordinate Y = Graphics.height / 2
  :              :Press in X Frames = 80
  :              :Success Switch ID = 1
  :              :Timing Variable ID = 0
  :              :Success Common Event = 0
  :              :Success Sound = {"name:str":"Skill2","volume:num":"90","pit…
  :              :Miss Common Event = 0
  :              :Miss Sound = {"name:str":"Buzzer1","volume:num":"90","pitch…
  :              :Input Start Delay = 0
  :              :Wait for QTE? = false

  ◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Show Animation
  :              :Targets = ["all targets"]
  :              :Animation ID = 66
  :              :Mirror Animation = false
  :              :Wait For Animation? = false

  ◆Wait:80 frames

  ◆If:Timed Hit Success is ON

    ◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Balloon Animation
    :              :Targets = ["all targets"]
    :              :Balloon Type = Exclamation
    :              :Wait for Completion = false

    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 0.10
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆

  :Else

    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆

  :End

  ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
  :              :Targets = ["all targets"]
  ◆

:End

◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Wait For Animation

◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
:              :Critical Hit% = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Critical Damage = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Damage/Healing = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Hit Rate = 
:              :Rate = 1.00
:              :Flat = +0.00

◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Finish Action
:              :Immortal: Off = true
:              :Wait For New Line = true
:              :Wait For Effects = true
:              :Clear Battle Log = true
:              :Home Reset = true
:              :Wait For Movement = true


There is a Once Parallel Action Sequence that is put on a different Common Event and that is called by the Button Mash QTE. Here are its contents.

◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Show Animation
:              :Targets = ["all targets"]
:              :Animation ID = 13
:              :Mirror Animation = false
:              :Wait For Animation? = false

◆Wait:4 frames

◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
:              :Critical Hit% = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Critical Damage = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Damage/Healing = 
:              :Rate = 0.10
:              :Flat = +0.00
:              :Hit Rate = 
:              :Rate = 1.00
:              :Flat = +0.00

◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
:              :Targets = ["all targets"]


Fireball Button Mash: Base Breakdown

For those who aren't able to follow, let's break down the event commands and Action Sequences used here.

◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Setup Action Set
:              :Display Action = true
:              :Immortal: On = true
:              :Battle Step = true
:              :Wait For Movement = true
:              :Cast Animation = true
:              :Wait For Animation = true

Above is the typical setup action set. Nothing is really changed there. All it does is play the action name, setup immortality flags, play cast animations, and wait for the cast animation to finish.


◆Plugin Command:VisuMZ_1_BattleCore, MOTION: Motion Type
:              :Targets = ["user"]
:              :Motion Type = spell
:              :Show Weapon? = false

Above is just a motion request for the user to perform a spell motion if the user has a Sideview Battler sprite.


◆If:Script:BattleManager._subject.isActor()

  ◆Plugin Command:VisuMZ_2_QTE_TriggerSys, QTE: Button Mash (OK)
  :              :Trigger Variable ID = 1
  :              :Trigger Common Event = 228
  :              :Trigger Sound = {"name:str":"Skill2","volume:num":"90","pit…
  :              :Input Start Delay = 20
  :              :QTE Duration = 180
  :              :Wait for QTE? = true
  ◆

:Else

  x

:End

Here is where things change up a bit. A Conditional Branch event command is added in to check for a script call: BattleManager._subject.isActor(). This determines if the user is an actor or not. If the user is an actor, the above Button Mash QTE happens. Whenever the Z button is pressed, the Trigger Common Event will play (in this case, 228). There is an Input Start Delay of 20 frames to let the player quickly start inputting and a total QTE Duration of 180 frames. The plugin command will Wait for QTE and the following event commands won't process until this QTE is done.


◆If:Script:BattleManager._subject.isActor()

  x

:Else

  ◆Plugin Command:VisuMZ_2_QTE_TriggerSys, QTE: Timed Hit (OK)
  :              :Timed Hit Picture = >>>ATTENTION<<<
  :              :Coordinate X = Graphics.width / 2
  :              :Coordinate Y = Graphics.height / 2
  :              :Press in X Frames = 80
  :              :Success Switch ID = 1
  :              :Timing Variable ID = 0
  :              :Success Common Event = 0
  :              :Success Sound = {"name:str":"Skill2","volume:num":"90","pit…
  :              :Miss Common Event = 0
  :              :Miss Sound = {"name:str":"Buzzer1","volume:num":"90","pitch…
  :              :Input Start Delay = 0
  :              :Wait for QTE? = false

  ◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Show Animation
  :              :Targets = ["all targets"]
  :              :Animation ID = 66
  :              :Mirror Animation = false
  :              :Wait For Animation? = false

  ◆Wait:80 frames

  ◆If:Timed Hit Success is ON

    ◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Balloon Animation
    :              :Targets = ["all targets"]
    :              :Balloon Type = Exclamation
    :              :Wait for Completion = false

    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 0.10
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆

  :Else

    ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
    :              :Critical Hit% = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Critical Damage = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Damage/Healing = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    :              :Hit Rate = 
    :              :Rate = 1.00
    :              :Flat = +0.00
    ◆

  :End

  ◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
  :              :Targets = ["all targets"]
  ◆

:End

Now let's look at the else. This is what happens when the enemy uses this skill. A Timed Hit QTE will play and the player has to block a single attack with a timing of around 80 frames. Animation 66: Fire I will be played without a Wait for Animation. After 80 frames, if successfully blocked (Switch 1 ON), the damage multiplier is reduced to 10%. Otherwise, the damage multiplier is set to 100%. The typical Action Effect then occurs.


◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Wait For Animation

Wait for any remaining animations to finish.


◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
:              :Critical Hit% = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Critical Damage = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Damage/Healing = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Hit Rate = 
:              :Rate = 1.00
:              :Flat = +0.00

Reset the multipliers.


◆Plugin Command:VisuMZ_1_BattleCore, ACSET: Finish Action
:              :Immortal: Off = true
:              :Wait For New Line = true
:              :Wait For Effects = true
:              :Clear Battle Log = true
:              :Home Reset = true
:              :Wait For Movement = true

Finish up the rest of the Action Sequence.


Fireball Button Mash: Once Parallel Breakdown

Within the Button Mash QTE, there is a Trigger Common Event that references this Once Parallel Common Event. Here is the breakdown for it.

◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Show Animation
:              :Targets = ["all targets"]
:              :Animation ID = 13
:              :Mirror Animation = false
:              :Wait For Animation? = false

We play a different animation that's shorter. No Wait for Animation though.


◆Wait:4 frames

A 4 frame wait.


◆Plugin Command:VisuMZ_1_BattleCore, MECH: Multipliers
:              :Critical Hit% = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Critical Damage = 
:              :Rate = 1.00
:              :Flat = +0.00
:              :Damage/Healing = 
:              :Rate = 0.10
:              :Flat = +0.00
:              :Hit Rate = 
:              :Rate = 1.00
:              :Flat = +0.00

Damage multiplier is set to 10% due to the huge volume of attacks.


◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
:              :Targets = ["all targets"]

Perform an action effect to deal damage and any other effects.


Fireball Button Mash: Test Play

Let's take a look at the skill in action used by both the player and the enemy.

FireballSpam2.gif

When the player uses the skill, a barrage of fireballs occur deal multiple hits. When the enemy uses the skill, a single attack occurs with the chance of the player blocking most of the damage.

Also, this is just an opinion, but this would look great with Projectiles. They were left out of the tutorial in order to keep the tutorial simple and easy to digest.


End of Article