[XP] Cut-In Improvements

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
187
Reaction score
6
First Language
English
Primarily Uses
RMXP
i found this script called Critical Animations made by MobiusXVI
Ruby:
#===============================================================================
# Mobius' Critical Animations
# Author: Mobius XVI
# Version: 1.0
# Date: 3 JAN 2019
#===============================================================================
#
# Introduction:
#
#   This script allows you to add custom animations that trigger on critical hits.
#
# Instructions:
#
#  - Place this script below all the default scripts but above main.
#
#  - The customization section below has additional instructions on
#    how to set up.
#
# Issues/Bugs/Possible Bugs:
#
#   - None
#
#  Credits/Thanks:
#    - Mobius XVI, author
#    - MollyAvast, for requesting it
#
#  License
#   
#    This script is available in its entirety for commercial and non-commercial
#    use. View the specific license terms below.   
#
#    The portions of this script written by me is licensed under the MIT License:
#
#    The MIT License (MIT)
#
#      Copyright (c) 2018 darmes
#
#       Permission is hereby granted, free of charge, to any person obtaining a copy
#       of this software and associated documentation files (the "Software"), to deal
#       in the Software without restriction, including without limitation the rights
#       to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#       copies of the Software, and to permit persons to whom the Software is
#       furnished to do so, subject to the following conditions:
#
#       The above copyright notice and this permission notice shall be included in all
#       copies or substantial portions of the Software.
#
#       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#       IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#       FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#       AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#       LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#       OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#       SOFTWARE.
#   
#      Further, if you do decide to use this script in a commercial product,
#      I'd ask that you let me know via a forum post or a PM. Thanks.
#
#==============================================================================
# ** CUSTOMIZATION START
#==============================================================================
module Mobius
    module Critical_Animations
        # ACTOR ANIMATION IDs #
        ACTOR_ANIMATION_IDS = {
        # Actor 1 => [ Possible animation IDs in the database],
        1 => [98,99,100],
        # Actor # => [ID1,ID2,ID3],
        2 => [100],
        # Start with actor_id then make this symbol '=>' then put an opening
        # square bracket '[' then all the IDs for animations that you want
        # separate IDs with commas ','. Finish with a closing square bracket ']'
        # Lastly, place another comma after the square bracket.
        }
        ACTOR_ANIMATION_IDS.default = 0
    end
end
#==============================================================================
# ** CUSTOMIZATION END
#------------------------------------------------------------------------------
# ** EDIT BELOW THIS LINE AT OWN RISK!!!
#==============================================================================   
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle

    # Create Alias
    alias mobius_update_phase4_step4 update_phase4_step4
  
    #--------------------------------------------------------------------------
    # * Frame Update (main phase step 4 : animation for target)
    #--------------------------------------------------------------------------
    def update_phase4_step4
        # init critical flag to false
        crit_flag = false
        # check all possible targets for critical hits
        for target in @target_battlers
            # if critical hit occurred
            if target.critical
                # set flag and exit loop early
                crit_flag = true
                break
            end
        end
        # if critical hit occurred
        if crit_flag and @active_battler.is_a?(Game_Actor)
            # Set animation id
            animation_id_array = Mobius::Critical_Animations::ACTOR_ANIMATION_IDS[@active_battler.id]
            @active_battler.animation_id = animation_id_array[rand(animation_id_array.size)]
            @active_battler.animation_hit = true
        end
        # call original method
        mobius_update_phase4_step4
    end

end
and i think it needs some improvements
first, the animation will play when the actor is GOING to land a crit.
like in Persona 3/4/5 where the cut-in plays where they all like: A-HA! *cut-in plays* and then *lands a crit*

second, make this script have a seperate customization where
curtain enemies have a cut-in animation when landing a crit.

third, when an actor (or an enemy) exploits a weakness, there will be a 25% or 33% chance that the cut-in will play.

again, I DID NOT made this script i found it within the forums and it's actually made by @MobiusXVI
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
It's been a while since I wrote this so let me make sure I know what you're asking.

For #1, does it not currently play before the attack animation? When does it play right now?

For #2, you just want enemies to have cut-ins as well. Got it. Should be easy enough to do.

For #3, you want it so that the cut-in doesn't play every time a critical hit is scored, correct? You want it to randomly trigger only 25% or 33% of the time.
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
187
Reaction score
6
First Language
English
Primarily Uses
RMXP
@MobiusXVI
For #1, does it not currently play before the attack animation? When does it play right now?
i want the actors to go all like: TAKE THIS! *cut-in plays* where they land a crit with a physical attack
like in Persona 3/4/5 here is the video example.

For #2, you just want enemies to have cut-ins as well. Got it. Should be easy enough to do.
and make sure that you have a seperate config for that.

For #3, you want it so that the cut-in doesn't play every time a critical hit is scored, correct? You want it to randomly trigger only 25% or 33% of the time.
not a crit, but an exploited weakness. where the actor goes all like:
A-HA! *(chance of) cut-in plays* and the *hits the enemy's weakness*
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
#1. So you want to be able to play a sound effect before the animation so that you can add a voice line. Is that right?

#3. If a battler (player or enemy) causes extra damage because they used a type of damage that the target is vulnerable to (for example using fire damage on a grass type like in Pokemon), then randomly determine with a set percentage whether to show the cut-in animation (and sound effect from #1). Is that right?
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
187
Reaction score
6
First Language
English
Primarily Uses
RMXP
#1. So you want to be able to play a sound effect before the animation so that you can add a voice line. Is that right?
for the sound effect, yeah!
but for the voice line, uhh...i guess. probably.

#3. If a battler (player or enemy) causes extra damage because they used a type of damage that the target is vulnerable to (for example using fire damage on a grass type like in Pokemon), then randomly determine with a set percentage whether to show the cut-in animation (and sound effect from #1). Is that right?
yeah, exactly!
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
Ok so as I went to work on this I realized that the built in animation system already supports the use of sound effects. So I don't think you'll need any modifications to my script in order to play voice lines or sound effects (or really any sound you want) before the rest of the animation plays.

But for the other two requests... May I present to you version 1.5! Now with support for enemies and triggering on weaknesses.
Ruby:
#===============================================================================
# Mobius' Critical Animations
# Author: Mobius XVI
# Version: 1.5
# Date: 30 AUG 2020
#===============================================================================
#
# Introduction:
#
#   This script allows you to add custom animations that trigger on critical hits.
#
# Instructions:
#
#  - Place this script below all the default scripts but above main.
#
#  - The customization section below has additional instructions on
#    how to set up.
#
# Issues/Bugs/Possible Bugs:
#
#   - None
#
#  Credits/Thanks:
#    - Mobius XVI, author
#    - MollyAvast, for requesting it
#    - MarioWidjaya123, for suggesting additional features
#
#  License
#   
#    This script is available in its entirety for commercial and non-commercial
#    use. View the specific license terms below.   
#
#    The portions of this script written by me is licensed under the MIT License:
#
#    The MIT License (MIT)
#
#      Copyright (c) 2020 darmes
#
#       Permission is hereby granted, free of charge, to any person obtaining a copy
#       of this software and associated documentation files (the "Software"), to deal
#       in the Software without restriction, including without limitation the rights
#       to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#       copies of the Software, and to permit persons to whom the Software is
#       furnished to do so, subject to the following conditions:
#
#       The above copyright notice and this permission notice shall be included in all
#       copies or substantial portions of the Software.
#
#       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#       IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#       FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#       AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#       LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#       OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#       SOFTWARE.
#   
#      Further, if you do decide to use this script in a commercial product,
#      I'd ask that you let me know via a forum post or a PM. Thanks.
#
#==============================================================================
# ** CUSTOMIZATION START
#==============================================================================
module Mobius
    module Critical_Animations
        # ACTOR ANIMATION IDs #
        ACTOR_ANIMATION_IDS = {
        # Actor 1 => [ Possible animation IDs in the database],
        1 => [98,99,100],
        # Actor # => [ID1,ID2,ID3],
        2 => [100],
        # Start with actor_id then make this symbol '=>' then put an opening
        # square bracket '[' then all the IDs for animations that you want.
        # Separate IDs with commas ','. Finish with a closing square bracket ']'
        # Lastly, place another comma after the square bracket.
        }
    # You can set a default animation here if you want to,
    # but if you leave it at 0 then no animation will show
        ACTOR_ANIMATION_IDS.default = 0
    #
    # ENEMY ANIMATION IDs #
        ENEMY_ANIMATION_IDS = {
        # Enemy 33 => [ Possible animation IDs in the database],
        33 => [98,99,100],
        # Enemy # => [ID1,ID2,ID3],
        # Start with enemy_id then make this symbol '=>' then put an opening
        # square bracket '[' then all the IDs for animations that you want.
        # Separate IDs with commas ','. Finish with a closing square bracket ']'
        # Lastly, place another comma after the square bracket.
        }
    # You can set a default animation here if you want to,
    # but if you leave it at 0 then no animation will show
        ENEMY_ANIMATION_IDS.default = 0
    #
    # If a battler (player or enemy) causes extra damage because
    # they used a type of damage that the target is vulnerable to
    # (for example using fire damage on a grass type like in Pokemon),
    # then we randomly determine with a set percentage whether to show
    # the above set up animations.
    # NOTE: If a critical was already scored then this won't trigger.
    # Set this to 'true' to use this feature.
    # Set this to 'false' to not use it.
    USE_WEAKNESS_TRIGGER = true
    #
    # Set this value to 100 to ALWAYS trigger the animation.
    # Set this value to 0 to NEVER trigger the animation.
    # Set this value between 1-99 to trigger it between 1-99% of the time.
    WEAKNESS_TRIGGER_CHANCE = 100
    end
end
#==============================================================================
# ** CUSTOMIZATION END
#------------------------------------------------------------------------------
# ** EDIT BELOW THIS LINE AT OWN RISK!!!
#==============================================================================   
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler

    # Create Aliases and Attributes
  alias mobius_crit_initialize initialize
    alias mobius_crit_elements_correct elements_correct
  attr_reader   :element_correction
    #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    mobius_crit_initialize
    @element_correction = 100
  end
    #--------------------------------------------------------------------------
  # * Calculating Element Correction
  #     element_set : element
  #--------------------------------------------------------------------------
    def elements_correct(element_set)
    @element_correction = mobius_crit_elements_correct(element_set)
    return @element_correction
  end

end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle

    # Create Alias
    alias mobius_update_phase4_step4 update_phase4_step4
    
    #--------------------------------------------------------------------------
    # * Frame Update (main phase step 4 : animation for target)
    #--------------------------------------------------------------------------
    def update_phase4_step4
    # Set up flags
        crit_flag = check_for_crit
    weak_flag = check_for_weakness
        # if critical hit occurred
        if crit_flag
      show_critical_animation(@active_battler)
        elsif weak_flag and
      Mobius::Critical_Animations::USE_WEAKNESS_TRIGGER and
      rand(100) < Mobius::Critical_Animations::WEAKNESS_TRIGGER_CHANCE
        show_critical_animation(@active_battler)
    end
        # call original method
        mobius_update_phase4_step4
    end
 
  #--------------------------------------------------------------------------
    # * Check for Critical
    #--------------------------------------------------------------------------
    def check_for_crit
    # init critical flag to false
        crit_flag = false
        # check all possible targets for critical hits
        for target in @target_battlers
            # if critical hit occurred
            if target.critical
                # set flag and exit loop early
                crit_flag = true
                break
            end
        end
    return crit_flag
  end
 
  #--------------------------------------------------------------------------
    # * Check for Weakness
    #--------------------------------------------------------------------------
    def check_for_weakness
    weakest = -100
    for target in @target_battlers
      weakest = [weakest, target.element_correction].max
    end
    return weakest > 100
  end
 
  #--------------------------------------------------------------------------
    # * Show Critical Animation
    #--------------------------------------------------------------------------
  def show_critical_animation(battler)
    if battler.is_a?(Game_Actor)
      animation_id_array = Mobius::Critical_Animations::ACTOR_ANIMATION_IDS[battler.id]
    else
      animation_id_array = Mobius::Critical_Animations::ENEMY_ANIMATION_IDS[battler.id]
    end
    # Set animation id
    battler.animation_id = animation_id_array[rand(animation_id_array.size)]
    battler.animation_hit = true
  end
    
end

Let me know if you run into any problems or bugs! :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top