Timed Hits with Action Sequences

From Yanfly.moe Wiki
Revision as of 20:17, 24 January 2024 by Arisu (talk | contribs) (Created page with "{{TOCright}} {{Hide Sidebar}} {| style="width: 800px;" cellspacing="0" cellpadding="0" | style="width: 100%; vertical-align: top;" | == Introduction == File:TimedHitIntro...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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

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: Base 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.




End of Article