Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] Battle QTE System (For Skills and Items)
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.2
- # * Updated: 17/02/2015
- # * Requires:
- # ~ Scripts: Wanabe's LoadSo
- # FenixFyreX's FyxInput
- # KGC's Bitmap Extension
- # ~ Files: msvcrt-ruby191.dll
- # fyxinput.so
- # TRGSSX.dll
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (16/02/2015)
- # - Initial release.
- # * Version 1.1 (16/02/2015)
- # - Added button settings on a per trigger basis.
- # Now you can specify the available buttons for a button trigger, and one
- # button will be randomly selected from the specified buttons in the array.
- # This will enable the option of making completely static QTEs if you want.
- # Will also enable a new level of difficulty setting for your QTEs.
- # - Removed a left-over sound effect in a method.
- # Now only the specified fail SE will play upon QTE failure.
- # - Added "No touchy-touchy!" comments.
- # Damn, how could I forget these?! :D
- # * Version 1.2 (17/02/2015)
- # - Added an option which lets the skills/items to be executed even if a
- # QTE fails for them.
- # - Added occurrence chances for QTEs. Now they can kick in randomly,
- # instead of always happening. The setting for this is skill/item based.
- # - Disable switch option added. Now you can turn OFF the QTE system temporary,
- # whenever you want during the game.
- # - Added QTE variables which will track the following things automatically:
- # - Number of successfully executed QTEs.
- # - Number of failed QTEs.
- # - Number of successfully executed button triggers. This is a temporary
- # variable, which resets on each QTE start-up, and stores the number of
- # successful button presses. Can be used in damage formulas, for example.
- # - Added in QTE after-effects.
- # Several effects can be executed after a QTE at once.
- # Separate effect settings for failed and for successful QTEs!
- # Separate effect settings for the skill's/item's user and for the targets!
- # - The following effects can be altered before the real skill triggers:
- # - Hit Rate and Critical Rate
- # - Evade Rate (no idea why I made this or how it works...)
- # - Damage (includes changing the whole damage formula if desired)
- # - States and Buffs
- # - Switches and Variables
- # - Action Execution (skip or not on failure)
- # - A common event can also be called after all thing is said and done with
- # the skills/items.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * This script will add quick time button events for your items and skills
- # in battles with a nice visual presentation.
- # * You can assign the chances of a QTE appearing for each skill/item!
- # * If the player fails the QTE, the skill/item will not be executed.
- # Or maybe it will afterall! From version 1.2 and above, skills and items can
- # have QTE after-effects, which can change the flow of battle greatly!
- # * Switch the QTE system OFF and turn it back ON during a scene if needed!
- # * There are several scripts like these out there already, but all of them
- # takes a predefined button setting for each actions, so memorizing them is
- # not an issue in due time. This script, however, will take random button
- # triggers, which can appear at random times and the window of opportunity for
- # pressing the required button can be randomized as well. Pure randomness!
- # Yeah, memorize that! This will keep battles interesting during the game.
- # Or frustrating... Depends on your settings.
- # * Set your quick time button events up and assign them for skills and items!
- # If no quick time setting is found for a skill/item, it will simply fire the
- # skill/item without the need to do quick time events.
- # * Thanks to FyxInput, you can use any keyboard buttons!
- # That's not all! You can even use mouse button triggers!
- # In theory... Haven't tested mouse buttons yet.
- # * You can setup log window entries for each skill/item individually.
- # These will appear when the quick time event starts.
- # This way you know who does what and when.
- # * You can track the amount of QTEs failed and completed with variables
- # automatically. Another variable is available which will track the number of
- # successful button presses during a QTE, and can be used in damage formulas!
- # * Lotsa visual and audio settings, like always! :)
- #-------------------------------------------------------------------------------
- # * < Script Calls >
- #-------------------------------------------------------------------------------
- # * None yet...
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * The following scripts will need to be put below Materials but above Main
- # in this order:
- # - LoadSo (Wanabe)
- # - FyxInput (FenixFyreX)
- # - Bitmap Extension (KGC)
- # * The following files will need to be put into your game's main folder:
- # - msvcrt-ruby191.dll
- # - fyxinput.so
- # - TRGSSX.dll
- #-------------------------------------------------------------------------------
- # * < Compatibility Info >
- #-------------------------------------------------------------------------------
- # * Will not work with any ABS systems yet, or in any other on-map battle
- # systems (unless they use Scene_Battle as their "battle map").
- # * Tested with Yanfly's Battle Engine and Yami's Battle Symphony! It works, yay!
- # * Four methods were aliased in Scene_Battle:
- # - create_all_windows
- # - use_item
- # - apply_item_effects
- # - update_basic
- # * Five methods were aliased in Game_Battler:
- # - initialize
- # - item_hit
- # - item_eva
- # - item_cri
- # - make_damage_value
- # * One method used a super call in Scene_Battle:
- # - dispose_all_windows
- # * If you have any scripts which alias or overwrite the methods I aliased in
- # Scene_Battle, you must put this script below them!
- #-------------------------------------------------------------------------------
- # * < Known Issues >
- #-------------------------------------------------------------------------------
- # * No known issues so far.
- #-------------------------------------------------------------------------------
- # * < Terms of Use >
- #-------------------------------------------------------------------------------
- # * Free to use for whatever purposes you want.
- # * Credit me (Sixth) in your game, pretty please! :P
- # * Posting modified versions of this script is allowed as long as you notice me
- # about it with a link to it!
- #===============================================================================
- $imported = {} if $imported.nil?
- $imported["SixthBattleQTE"] = true
- #===============================================================================
- # Settings:
- #===============================================================================
- module SixthBattleQTE
- #-----------------------------------------------------------------------------
- # QTE Switch Settings:
- #-----------------------------------------------------------------------------
- # Enter the ID of the switch here which you want to use for disabling the
- # QTE system.
- # Whenever this switch is turned ON, the QTE system will be disabled.
- #-----------------------------------------------------------------------------
- QTEDisableSwitch = 10
- #-----------------------------------------------------------------------------
- # QTE Fail Settings:
- #-----------------------------------------------------------------------------
- # Set this to true if you want failed QTEs to skip the selected action
- # entirely. This means no additional effects will be executed on failures.
- # If you set it to false, the action will be executed regardless if it's
- # QTE is failed or not.
- # The item's/skill's fail effects can be triggered only when this is set to
- # false!
- # Even if this setting is set to false, you can add an additional item/skill
- # effect which will skip the entire action. This can come in handy if you want
- # only specific items/skills to skip the action on failure.
- #-----------------------------------------------------------------------------
- FailSkipTurn = false
- #-----------------------------------------------------------------------------
- # QTE Variable Settings:
- #-----------------------------------------------------------------------------
- # These settings will let you assign variables to various things related to
- # the QTE. You can use these variables in the game for eventing or for making
- # QTE related damage formulas.
- #
- # :success => variable_id,
- # This will save the number of QTEs successfully finished automatically.
- #
- # :fail => variable_id,
- # This will save the number of QTEs failed during the game.
- #
- # :temp => variable_id,
- # This will track the successful button triggers during the QTE.
- # At the start of a QTE, this resets to 0, and will start to count the number
- # of successful button presses. You can use this variable in your damage
- # formulas, for example.
- #-----------------------------------------------------------------------------
- QTEVariables = {:success => 10, :fail => 11, :temp => 12}
- #-----------------------------------------------------------------------------
- # Wait Settings:
- #-----------------------------------------------------------------------------
- # If the player can't prepare for the QTE due to lack of time, he will surely
- # fail to finish it.
- # These settings will let you set a waiting time frame before the QTE line
- # starts moving, and after the QTE is finished or failed, so that the player
- # can read the log window if needed and prepare for the upcoming QTE.
- #
- # The settings here should be obvious, I think.
- # The time is measured in frames, so entering 60 means it will wait 1 second!
- #-----------------------------------------------------------------------------
- WaitSetup = {:before => 100, :after => 60}
- #-----------------------------------------------------------------------------
- # Window Settings:
- #-----------------------------------------------------------------------------
- # This is the window which handles the circle line's movement and other
- # visual things happening while a QTE is active.
- # Will only show up if a QTE is triggered!
- #
- # Settings format:
- #
- # Window_Setup = {
- # :circle => {
- # :pos => [x,y],
- # :size => [width,height],
- # :skin => "file name",
- # :opacity => value,
- # }
- # }
- #
- # Detailed explanation:
- #
- # :pos => [x,y],
- # The window's X and Y position.
- #
- # :size => [width,height],
- # The window's width and height.
- #
- # :skin => "file name",
- # The windowskin used for the window.
- # Windowskin files must be in the /Graphics/System/ folder!
- #
- # :opacity => value,
- # The opacity value for the window. Valid values: 0 - 255.
- # Set it to 0 to hide the window. Useful if you want to use images instead.
- #-----------------------------------------------------------------------------
- WindowSetup = { # <-- No touchy-touchy!
- :circle => {
- :pos => [ 12, 74], :size => [130,130],
- :skin => "Window", :opacity => 0,
- }
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Circle Settings:
- #-----------------------------------------------------------------------------
- # The properties of the circle can be setup here.
- #
- # Settings format:
- #
- # CircleSetup = {
- # :graphic => ["file name",opacity],
- # :background => ["file name",opacity],
- # :center => [x,y],
- # :radius => length,
- # :slices => {
- # :amount => number,
- # :size => value,
- # :color => [R,G,B,A],
- # },
- # :line => {
- # :size => value,
- # :color => [R,G,B,A],
- # },
- # }
- #
- # Detailed explanations:
- #
- # :graphic => ["file name",opacity],
- # The graphic used for the circle. Will appear above the circle window!
- # The file used must be in the /Graphics/Pictures/ folder!
- # Valid values for the opacity range from 0 to 255.
- #
- # :background => ["file name",opacity],
- # The background used for the circle. Will appear below the circle window!
- # Same properties as above!
- #
- # :center => [x,y],
- # The position of the circle's center relative to the circle window's position!
- # The images used will be automatically set to match the correct position too.
- # Meaning that their center position will use the same X and Y values you
- # set up here.
- #
- # :radius => length,
- # The length of the moving line in the circle.
- #
- # :slices => { settings },
- # :line => { settings },
- # These are sub-settings for the slices and the moving line in the circle.
- # You don't need to change the :slices and the :line symbol!
- #
- # :size => value,
- # The size of the lines and slices in the circle.
- # Measured in pixels!
- #
- # :color => [R,G,B,A],
- # The color used for the slices and the moving line in the circle.
- # In the case of moving line, this will set it's default color, when no button
- # press triggers are present.
- # Uses RGBA codes! R = Red, G = Green, B = Blue, A = Alpha (opacity).
- #
- # :amount => number,
- # The amount of slices in the circle window.
- # Set it to 0 if you don't want your circle to be sliced up!
- #-----------------------------------------------------------------------------
- CircleSetup = { # <-- No touchy-touchy!
- :graphic => ["battlecircle1",255],
- :background => ["battlecircleback2",170],
- :center => [53,53], :radius => 54,
- :slices => {:amount => 4, :size => 2, :color => [120,120,120,255]},
- :line => {:size => 2, :color => [255,255,255,255]},
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Sound Settings:
- #-----------------------------------------------------------------------------
- # You can setup various sound effects here.
- #
- # A sound setting looks like this:
- #
- # RPG::SE.new("file name",volume,pitch),
- #
- # I guess it is pretty obvious what those things in the brackets above do.
- #
- # Information about the occurrence of these sound effects can be found besides
- # each settings.
- #-----------------------------------------------------------------------------
- SoundSetup = { # <-- No touchy-touchy!
- :start => RPG::SE.new("Item1", 80, 100), # When the QTE Window appears.
- :fail => RPG::SE.new("Buzzer1", 80, 100), # When a QTE fails.
- :success => { # When a QTE was successful. Each QTE types need a setup here!
- "Easy" => RPG::SE.new("Heal7", 80, 120),
- "Normal" => RPG::SE.new("Heal6", 80, 120),
- "Hard" => RPG::SE.new("Heal1", 80, 120),
- "Insane" => RPG::SE.new("Heal2", 80, 120),
- "Impossible" => RPG::SE.new("Heal3", 80, 120),
- "Back-Forth" => RPG::SE.new("Heal5", 80, 120),
- }
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Button Settings:
- #-----------------------------------------------------------------------------
- # Set up the used buttons for the QTE system here.
- # Each time a button trigger appears in the circle, a button from this setup
- # will be used randomly.
- # You can use any buttons you want!
- # For the available buttons and their "name", refer to the FyxInput script
- # made by FenixFyreX!
- # You can NOT use regular symbols like :C for ENTER, :B for ESC and such!
- # The buttons must be setup according to the FyxInput script!
- #
- # Don't go haywire with too many buttons or the QTE will be incredibly hard!
- # This is just a personal suggestion...
- #
- # Settings format:
- #
- # ButtonSetup = {
- # button_name => {
- # :color => [R,G,B,A],
- # :graphic => icon_id,
- # :se => RPG::SE.new("file name",volume,pitch),
- # },
- # # <-- Add more settings here!
- # }
- #
- # Detailed explanations:
- #
- # button_name => {
- # The "name" of the button. Must use a valid name from the FyxInput script!
- # Do NOT enter the same button more than 1 time!
- #
- # :color => [R,G,B,A],
- # The moving line in the circle will change to this color when this button
- # trigger was selected and will stay this color until the player presses the
- # required button or runs out of time for the button press.
- # Uses RGBA values!
- #
- # :se => RPG::SE.new("file name",volume,pitch),
- # The sound effect used when the player successfully presses the required
- # button on time.
- #-----------------------------------------------------------------------------
- ButtonSetup = { # <-- No touchy-touchy!
- VKeys::UP => {:color => [255, 0, 0,255], :graphic => 590, :se => RPG::SE.new("Bell3",80, 37)},
- VKeys::DOWN => {:color => [ 0, 0,255,255], :graphic => 591, :se => RPG::SE.new("Bell3",80, 74)},
- VKeys::LEFT => {:color => [ 0,255, 0,255], :graphic => 588, :se => RPG::SE.new("Bell3",80,111)},
- VKeys::RIGHT => {:color => [255,255, 0,255], :graphic => 589, :se => RPG::SE.new("Bell3",80,148)},
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Battle QTE Type Settings:
- #-----------------------------------------------------------------------------
- # The fun part! QTE settings!
- # First of all, every single setting here will be randomized in the game!
- # Keep this in mind when you are making your own settings!
- #
- # Make sure to test your settings several times before you mark them as
- # "working" QTE settings! Due to the absolute randomization of the QTEs,
- # luck becomes a very great factor in finishing them.
- # Well, unless you make them static, that is.
- #
- # Once you are finished with the QTE type settings, you can assign them to
- # your skills and items. You can even make one separate settings for each of
- # your skills or items! Cool!
- #
- # Settings format:
- #
- # QTESetup = {
- # "name" => {
- # id => {
- # :start => [starting_angle1,starting_angle2],
- # :end => [ending_angle1, ending_angle2],
- # :speed => [speed1,speed2,speed3, ... ,speedN],
- # :buttons => [button1,button2,button3, ... ,buttonN],
- # }
- # # <-- Add more button triggers here!
- # },
- # # <-- Add more QTE settings here!
- # }
- #
- # Detailed explanations:
- #
- # "name" => {
- # The name used for the QTE setting.
- # You can name your settings however you want!
- # Remember to setup a sound setting for each of your QTE settings!
- #
- # id => {
- # A sequential number starting from 0.
- # The more id you add, the more button triggers will appear in the QTE.
- # No, you can't make infinite long QTE settings, sorry!
- #
- # :start => [starting_angle1,starting_angle2],
- # The starting point for a button trigger appearing.
- # Once the moving line inside the circle reaches the required angle, it will
- # initiate a button trigger.
- # The starting point itself will be randomized between the first and second
- # angle you enter here.
- # The line will always start at 0 angle pointing towards up and will move
- # clock-wise if you enter positive values for the :speed settings or
- # counter clock-wise if you enter negative values for the :speed settings.
- # It is possible to create QTE events which will make the line move back and
- # forth but be very careful when you are trying to do that!
- # The first value entered here must be lower than the second, ALWAYS!
- # I made an example of this, so make sure to check it out!
- # Making back and forth moving lines can further confuse the player during the
- # QTE! Nice way to make your skills extra hard to finish!
- #
- # :end => [ending_angle1, ending_angle2],
- # The ending point for the button trigger appeared.
- # Once the moving line reaches the ending angle for a button trigger, the
- # QTE will be failed.
- # The ending point itself will be randomized between the first and second
- # angle you enter here.
- # Same properties as the starting point settings.
- #
- # :speed => [speed1,speed2,speed3, ... ,speedN],
- # The speed of the moving line in the circle.
- # Due to the lack of proper automatic randomization for float numbers, you must
- # enter the available speed values yourself here.
- # The actual speed of the line will take a random value from this array each
- # time a button has been pressed successfully.
- # You can use float numbers here! The higher the number, the quicker the line
- # will get! At around +/- 2.5 it gets really quick!
- # Do NOT mix positive and negative numbers for a speed setting!
- # Doing that will make it impossible to finish the QTE!
- #
- # :buttons => [button1,button2,button3, ... ,buttonN],
- # The available buttons for the QTE per button triggers.
- # At each button trigger appearing, a random button will be selected from this
- # array for the button trigger.
- # You can add as many buttons as you want!
- # The buttons used must be setup in the ButtonSetup settings!
- # If you want only one button for the trigger, you can enter only one button
- # in the array. This way you can make completely static QTE setups if you want.
- #-----------------------------------------------------------------------------
- QTESetup = { # <-- No touchy-touchy!
- "Easy" => { # 2 Buttons
- 0 => {:start => [100,145], :end => [180,210], :speed => [0.5,1.0,1.5],
- :buttons => [VKeys::UP,VKeys::DOWN]},
- 1 => {:start => [240,260], :end => [280,330], :speed => [0.5,1.0,1.5],
- :buttons => [VKeys::LEFT,VKeys::RIGHT]},
- },
- "Normal" => { # 3 Buttons
- 0 => {:start => [ 60,100], :end => [130,170], :speed => [0.5,1.0,1.5],
- :buttons => [VKeys::UP,VKeys::DOWN]},
- 1 => {:start => [190,220], :end => [240,260], :speed => [0.5,1.0,1.5],
- :buttons => [VKeys::LEFT,VKeys::RIGHT]},
- 2 => {:start => [290,310], :end => [330,360], :speed => [0.5,1.0,1.5],
- :buttons => [VKeys::UP,VKeys::DOWN]},
- },
- "Hard" => { # 4 Buttons
- 0 => {:start => [ 30, 50], :end => [ 80,100], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::UP,VKeys::DOWN]},
- 1 => {:start => [130,150], :end => [180,200], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::LEFT,VKeys::RIGHT]},
- 2 => {:start => [220,250], :end => [280,300], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT]},
- 3 => {:start => [310,330], :end => [350,380], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::DOWN,VKeys::RIGHT,VKeys::LEFT]},
- },
- "Insane" => { # 5 Buttons
- 0 => {:start => [ 30, 50], :end => [ 80,100], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 1 => {:start => [130,150], :end => [180,200], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 2 => {:start => [220,250], :end => [280,300], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 3 => {:start => [310,330], :end => [350,380], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 4 => {:start => [420,450], :end => [500,550], :speed => [0.5,1.0,1.5,2.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- },
- "Impossible" => { # 6 Buttons
- 0 => {:start => [ 30, 50], :end => [ 80,100], :speed => [1.0,1.5,2.0,2.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 1 => {:start => [130,150], :end => [180,200], :speed => [1.0,1.5,2.0,2.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 2 => {:start => [220,250], :end => [280,300], :speed => [1.0,1.5,2.0,2.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 3 => {:start => [310,330], :end => [350,380], :speed => [1.0,1.5,2.0,2.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 4 => {:start => [420,450], :end => [490,530], :speed => [1.0,1.5,2.0,2.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 5 => {:start => [560,590], :end => [620,655], :speed => [1.0,1.5,2.0,2.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- },
- "Back-Forth" => { # 4 Buttons - Advanced Setup!
- 0 => {:start => [ 30, 60], :end => [ 90,120], :speed => [0.5,1.0,1.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 1 => {:start => [170,200], :end => [230,260], :speed => [0.5,1.0,1.5],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 2 => {:start => [160,180], :end => [100,140], :speed => [-0.5,-1.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- 3 => {:start => [ 40, 60], :end => [-30, 0], :speed => [-0.5,-1.0],
- :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
- },
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Skill QTE Settings:
- #-----------------------------------------------------------------------------
- # Well, now that you have setup your QTEs, they are ready to be assigned!
- # This is the place where you can do that.
- # Every skill with a QTE assigned will initiate a QTE upon skill usage.
- # Skills without an assigned QTE setting will just fire themselves the
- # default way, without any QTE.
- #
- # Settings format:
- #
- # SkillSetup = {
- # skill_id => {
- # :qte => "QTE name",
- # :chance => value,
- # :ctxt => "text",
- # :stxt => "text",
- # :ftxt => "text",
- # },
- # # <-- Add more skill settings here!
- # }
- #
- # Detailed explanations:
- #
- # skill_id => {
- # The ID of the skill. Only enter skill IDs for the skills you want a QTE!
- # Damn, the previous sentence sounds terrible, sorry! :P
- #
- # :qte => "QTE name",
- # The assigned QTE for the skill.
- # Only use valid QTE names!
- #
- # :chance => value,
- # The chance in percentages that the QTE will be triggered for the skill.
- # Entering 1 means 1%, 20 = 20%, 100 = 100%.
- #
- # :ctxt => "text",
- # The text setup here will be shown during the QTE, from the start to the end.
- # It must contain a %s, which will show the name of the user!
- #
- # :stxt => "text",
- # The text setup here will be shown after a successful QTE.
- # It must contain a %s, which will show the name of the user!
- #
- # :ftxt => "text",
- # The text setup here will be shown after a failed QTE.
- # It must contain a %s, which will show the name of the user!
- #-----------------------------------------------------------------------------
- SkillSetup = { # <-- No touchy-touchy!
- 1 => {
- :qte => "Easy", :chance => 50, :ctxt => "%s aims the attack!",
- :stxt => "%s succesfully aimed the attack!",
- :ftxt => "%s failed to aim the attack!",
- },
- 2 => {
- :qte => "Easy", :chance => 50, :ctxt => "%s tries to guard!",
- :stxt => "%s enters guarding pose!",
- :ftxt => "%s failed to guard!",
- },
- 26 => {
- :qte => "Easy", :chance => 100, :ctxt => "%s channels Heal!",
- :stxt => "%s succesfully channeled Heal!",
- :ftxt => "%s failed to channel Heal!",
- },
- 69 => {
- :qte => "Normal", :chance => 100, :ctxt => "%s channels Saint!",
- :stxt => "%s succesfully channeled Saint!",
- :ftxt => "%s failed to channel Saint!",
- },
- 80 => {
- :qte => "Easy", :chance => 100, :ctxt => "%s aims Strong Attack!",
- :stxt => "%s succesfully aimed Strong Attack!",
- :ftxt => "%s failed to aim Strong Attack!",
- },
- 81 => {
- :qte => "Easy", :chance => 100, :ctxt => "%s channels Cleave!",
- :stxt => "%s succesfully channeled Cleave!",
- :ftxt => "%s failed to channel Cleave!",
- },
- 82 => {
- :qte => "Normal", :chance => 100, :ctxt => "%s channels Berserker's Roar!",
- :stxt => "%s succesfully channeled Berserker's Roar!",
- :ftxt => "%s failed to channel Berserker's Roar!",
- },
- 83 => {
- :qte => "Normal", :chance => 100, :ctxt => "%s channels Berserker's Dance!",
- :stxt => "%s succesfully channeled Berserker's Dance!",
- :ftxt => "%s failed to channel Berserker's Dance!",
- },
- 84 => {
- :qte => "Hard", :chance => 100, :ctxt => "%s channels Giant's Rampage!",
- :stxt => "%s succesfully channeled Giants's Rampage!",
- :ftxt => "%s failed to channel Giant's Rampage!",
- },
- 90 => {
- :qte => "Easy", :chance => 100, :ctxt => "%s prepares for Cover!",
- :stxt => "%s succesfully prepared for Cover!",
- :ftxt => "%s failed to prepare for Cover!",
- },
- 91 => {
- :qte => "Easy", :chance => 100, :ctxt => "%s channels Super Guard!",
- :stxt => "%s succesfully channeled Super Guard!",
- :ftxt => "%s failed to channel Super Guard!",
- },
- 92 => {
- :qte => "Normal", :chance => 100, :ctxt => "%s channels Restrengthen!",
- :stxt => "%s succesfully channeled Restrengthen!",
- :ftxt => "%s failed to channel Restrengthen!",
- },
- 93 => {
- :qte => "Normal", :chance => 100, :ctxt => "%s channels Zero Storm!",
- :stxt => "%s succesfully channeled Zero Storm!",
- :ftxt => "%s failed to channel Zero Storm!",
- },
- 94 => {
- :qte => "Hard", :chance => 100, :ctxt => "%s channels Aura Blade!",
- :stxt => "%s succesfully channeled Aura Blade!",
- :ftxt => "%s failed to channel Aura Blade!",
- },
- 110 => {
- :qte => "Easy", :chance => 100, :ctxt => "%s tries to Vanish!",
- :stxt => "%s succesfully prepared to Vanish!",
- :ftxt => "%s failed to Vanish!",
- },
- 111 => {
- :qte => "Easy", :chance => 100, :ctxt => "%s channels Flare!",
- :stxt => "%s succesfully channeled Flare!",
- :ftxt => "%s failed to channel Flare!",
- },
- 112 => {
- :qte => "Normal", :chance => 100, :ctxt => "%s channels Thief's Luck!",
- :stxt => "%s succesfully channeled Thief's Luck!",
- :ftxt => "%s failed to channel Thief's Luck!",
- },
- 113 => {
- :qte => "Normal", :chance => 100, :ctxt => "%s channels Assassin's Edge!",
- :stxt => "%s succesfully channeled Assassin's Edge!",
- :ftxt => "%s failed to channel Assassin's Edge!",
- },
- 114 => {
- :qte => "Hard", :chance => 100, :ctxt => "%s channels Valiant Edge!",
- :stxt => "%s succesfully channeled Valiant Edge!",
- :ftxt => "%s failed to channel Valiant Edge!",
- },
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Item QTE Settings:
- #-----------------------------------------------------------------------------
- # The same as for the skill QTE settings, but for items.
- # The properties for each settings are the same too.
- #-----------------------------------------------------------------------------
- ItemSetup = { # <-- No touchy-touchy!
- 1 => {
- :qte => "Normal", :chance => 100,
- :ctxt => "%s searches for a Potion in the inventory!",
- :stxt => "%s found a Potion!",
- :ftxt => "%s failed to find a Potion!",
- },
- 4 => {
- :qte => "Easy", :chance => 100,
- :ctxt => "%s searches for a Magic Water in the inventory!",
- :stxt => "%s found a Magic Water!",
- :ftxt => "%s failed to find a Magic Water!",
- },
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Skill QTE Effect Settings:
- #-----------------------------------------------------------------------------
- # These are the settings for any additional effects you want to have for your
- # skills when the player fails a QTE or finishes it.
- #
- # Before you read on, be warned that these are advanced settings for advanced
- # users! You might have to read the instructions a few times to understand
- # what each setting does here, when will they occur and for who.
- #
- # Now that this is outta the way, let's get started!
- #
- # You can setup additional effects for each of your skills here separately.
- # Every setting here is optional, you can omit everything, even leave the
- # whole thing empty, or you can fill up dozens of lines even with only one
- # skill setting, your choice!
- #
- # All of the effects setup here will be executed after the QTE but BEFORE the
- # actual database effects of the item. The only exception is the common event
- # effect! This way you can manipulate the outcome depending on the QTE state
- # of the skill (failed or not).
- #
- # Settings format:
- #
- # SkillEffects = {
- # skill_id => {
- # :success => {
- # :user => { effects_goes_here },
- # :target => { effects_goes_here },
- # },
- # :fail => {
- # :user => { effects_goes_here },
- # :target => { effects_goes_here },
- # },
- # :skip => true,
- # },
- # # <-- Add more skill IDs here!
- # }
- #
- # Yeah, this big for one skill only! Although it can be shorter...
- # Let's start with the basics:
- #
- # skill_id => {
- # Replace this with the skill's ID. Skills without a setting here will not
- # have any additional effects.
- #
- # :success => {
- # The effects inside this hash will be executed if the player finishes the QTE.
- # If the QTE fails, these won't be executed.
- #
- # :fail => {
- # The effects inside this hash will be executed if the player fails the QTE.
- # If the player finishes it, these won't be executed.
- #
- # :user => {
- # The effects inside these hashes will be executed on the user and
- # NOT on the target! Make sure to remember this!
- # Certain effect settings can only be used in this hash, these will be marked.
- # These effects will be executed before the :target effects!
- #
- # :target => {
- # The effects inside these hashes will be executed on the targets, on all of
- # them! Make sure to remember this!
- # Certain effect settings can only be used in this hash, these will be marked.
- # These effects will be executed after the :user effects!
- #
- # :skip => true,
- # The skip flag for the QTE upon failure.
- # If you use this in your skill effect setup, the skill will be skipped
- # entirely if the player fails the QTE. This includes the failure effects you
- # have setup for the skill too!
- # This setting will NOT go into the :success or :fail hashes, it is standalone!
- #
- # Alright, these were the basics...
- # Now for the fun part, the effects!
- #
- # ~ User specific effects:
- #
- # :hit_rate => [type,value],
- # You can change the hit rate before the real action triggers with this effect.
- # With this, you can make sure-hit effects on QTE success or sure-miss effects
- # for QTE fails... or vice verse, but why would you do that? :P
- # type = The type of the operation for the hit rate.
- # It can be either :add or :mul.
- # :add will, well, add the value specified directly to hit rate.
- # :mul will multiply the default hit rate with the value setup here.
- # value = The value of change for the hit rate.
- #
- # :cri_rate => [type,value],
- # Manipulate the critical rate with this effect.
- # Got the same setup properties as the one above.
- #
- # :eva_rate => [type,value],
- # Manipulate the evade rate with this effect.
- # I am not entirely sure how this affects the outcome.
- # My head was spinning in chaos, and gave up on trying to understand this one.
- # You are better off manipulating the hit rate itself if you want to affect
- # the missing rate instead.
- # Got the same setup properties as above.
- #
- # ~ Target specific effects:
- #
- # :damage => [type,"formula"],
- # This gave me one of the biggest head-ache in this script...
- # There is simply no good place to alter the damage flow during actions
- # without overwriting methods, which I didn't want.
- # So, instead of overwriting the resulted damage, I made a "branch" on the
- # damage formula of the skills/items, which made it possible to use two
- # entirely different damage formula for the QTE effects (for success and fail).
- # type = The type of the operation for the damage formula.
- # It can be either :add or rewrite.
- # :add will simply add the formula to the end of the default formula.
- # :rewrite will overwrite the formula setup in the database entirely.
- # formula = The formula used for the damage operation.
- # You can use the same variables as in the default database, so
- # use a for attacker, b for the target, etc.
- # The formula must be a string!
- #
- # ~ Shared effects:
- #
- # :add_state => [[state_id,chance],[state_id,chance], ... ],
- # Like the name suggests, this is used to add states after a QTE.
- # You can add as many states as you want!
- # state_id = The ID of the state for the effect.
- # chance = The success chance for the state to be applied.
- # Entering 1 means 1%, 20 = 20%, 100 = 100%.
- #
- # :rem_state => [[state_id,chance],[state_id,chance], ... ],
- # Same as above, but this will remove states instead.
- # Got the same properties as the above one!
- #
- # :add_buff => [[param_id,turns,chance],[param_id,turns,chance], ... ],
- # This will add buffs after a QTE. Add as many buffs as you want!
- # param_id = The buffed parameter's ID.
- # 0 = HP,1 = MP,2 = ATK,3 = DEF,4 = MAT,5 = MDF,6 = AGI,7 = LUK.
- # turns = The number of turns for the buff to be effective.
- # chance = The success chance for the buff to be applied.
- # Entering 1 means 1%, 20 = 20%, 100 = 100%.
- #
- # :add_debuff => [[param_id,turns,chance],[param_id,turns,chance], ... ],
- # Same as above, but this will add debuffs instead.
- # Got the same properties as the above one!
- #
- # :rem_buff => [[param_id,chance],[param_id,chance], ... ],
- # This will remove buffs AND debuffs after a QTE. Add as many as you want!
- # Same properties as above, but without turn setups, those are not needed here.
- #
- # :switch => [switch_id,true/false,chance],
- # This can be used to turn switches ON or OFF after a QTE.
- # switch_id = The ID of the switch used for the effect.
- # true/false = The operation for the switch used.
- # true will turn ON the switch, false will turn it OFF.
- # chance = The success chance for the switch to be operated.
- # Entering 1 means 1%, 20 = 20%, 100 = 100%.
- #
- # :variable => [var_id,operation,value,chance],
- # This will operate a variable after a QTE.
- # var_id = The ID of the variable used for the effect.
- # operation = The type of operation for the variable.
- # Available options: :set, :add, :mul, :mod.
- # :set = Will set the variable to the value specified.
- # :add = Will add the value specified to the variable.
- # :mul = Will multiple the current value of the variable.
- # :mod = Will divide the variable with the specified value and
- # stores the remainder afterwards.
- # value = The value used for the variable operation.
- # chance = The success chance for the variable to be operated.
- # Okay, I won't write the percentage info again! :D
- #
- # :cmn_event => [event_id,chance],
- # This will call a common event AFTER the execution of the skill.
- # Note that this will happen only after everything is done with the skill
- # itself, including effects, damage and such things!
- # event_id = The ID of the common event used for the effect.
- # chance = The success chance for the common event to be triggered.
- #
- # Notes:
- # If a skill's scope is set to "User" or if it affects "One Ally" and the user
- # targets himself, the :user and :target becomes the same actor, so both the
- # :user and :target effects will be executed on the actor who used the skill!
- #
- # The hit, critical and evade rates are using float values.
- # 1.0 means 100%, 0.5% means 50%, etc.
- #
- # Huhh, this settles this section for now...
- # I haven't tested every effect option, so if you find an error/bug in any of
- # them, make sure to report to me!
- #
- # Before you report any issues, make sure your settings are correct!
- # Double check the commas and brackets used, every bracket must be closed,
- # and every hash and effect must be separated with a comma!
- #
- # Sample Skill Effect Explanation:
- #
- # Skill 1 - Attack:
- # - On success:
- # The user gets a boost of 50% for hit and critical rate.
- # The target(s) will receive the damage from the new damage formula instead
- # of the default damage setup in the database. The damage formula uses the
- # temporary variable for successful button presses, so the damage will
- # depend on the number of successful button presses.
- # The skill gets 5% chance of inflicting stun on the target(s).
- # - On fail:
- # The user's hit and critical rate will be halved.
- # The user can get a LUK debuff and a Provoke state, both got 10% chance.
- # The damage will depend on the new damage formula.
- #
- # Skill 2 - Guard:
- # - On success:
- # The user will get 10% chance to remove Poison, Blind and Silence states.
- # The user got 20% chance to get the Ironbody state.
- # - On fail:
- # The user gets 20% chance for a DEF debuff, and 20% chance to remove the
- # Ironbody state if present.
- #
- # Skill 26 - Heal:
- # - On success:
- # The user has 50% chance to get the Provoke state.
- # The target(s) got 30% chance to get the HP Regen state.
- #
- # Skill 81 - Cleave
- # - On success:
- # The user's critical rate will be multiplied by 1.5.
- # The target(s) will have 50% chance to get the Bleed state (custom state!)
- #
- # Skill 113 - Assassin's Edge:
- # - On success:
- # The damage formula will get additional contents, so the damage will be
- # increased based on the number of successful button presses during the QTE.
- # The target(s) will have 70% chance to get the Poison state.
- # - On fail:
- # The user's hit rate will be decreased dramatically (default * 10%)!
- #-----------------------------------------------------------------------------
- SkillEffects = { # <-- No touchy-touchy!
- 1 => { # Start of Skill 1 - Attack
- :success => {
- :user => {:hit_rate => [:add,0.5],:cri_rate => [:add,0.5]},
- :target => {:damage => [:rewrite,"[v[12] * a.atk * 3 - b.def,9999].min"],
- :add_state => [[8,5]]}
- },
- :fail => {
- :user => {:hit_rate => [:mul,0.5],:cri_rate => [:mul,0.5],
- :add_debuff => [[7,3,10]],:add_state => [[12,10]]},
- :target => {:damage => [:rewrite,"[v[12] * a.atk - b.def,1].max"]}
- }
- }, # End of Skill 1
- 2 => { # Start of Skill 2 - Guard
- :success => {
- :user => {:rem_state => [[2,10],[3,10],[4,10]],:add_state => [[17,20]]}
- },
- :fail => {
- :user => {:add_debuff => [[3,4,20]],:rem_state => [[17,20]]}
- }
- }, # End of Skill 2
- 26 => { # Start of Skill 26 - Heal
- :success => {
- :user => {:add_state => [[12,50]]},
- :target => {:add_state => [[14,30]]}
- },
- }, # End of Skill 26
- 81 => { # Start of Skill 81 - Cleave
- :success => {
- :user => {:cri_rate => [:mul,1.5]},
- :target => {:add_state => [[26,50]]}
- },
- }, # End of Skill 81
- 113 => { # Start of Skill 113 - Assassin's Edge
- :success => {
- :target => {:damage => [:add," + (v[12] * (a.luk / 2))"],
- :add_state => [[2,70]]}
- },
- :fail => {
- :user => {:hit_rate => [:mul,0.1]}
- }
- }, # End of Skill 113
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Item QTE Effect Settings:
- #-----------------------------------------------------------------------------
- # This is the same as above but for items instead.
- # Everything is the same, so I will spare myself from writing all of it again.
- #
- # Sample Item Effect Explanation:
- #
- # Item 1 - Potion:
- # - On success:
- # The user have 50% chance to get the Provoke state.
- # - On fail:
- # The whole action will be skipped.
- #-----------------------------------------------------------------------------
- ItemEffects = { # <-- No touchy-touchy!
- 1 => { # Start of Item 1 - Potion
- :success => {
- :user => {:add_state => [[12,50]]},
- },
- :skip => true,
- }, # End of Item 1
- } # <-- No touchy-touchy!
- #===============================================================================
- # End of Settings! Editing anything below may lead to... You know what, right?
- #===============================================================================
- def self.random(min=0, max)
- min + rand(max - min + 1)
- end
- end
- module Input::Keys
- MINES = {
- CANCEL: 0x03, BACKSPACE: 0x08, TAB: 0x09,
- CLEAR: 0x0C, ENTER: 0x0D, SHIFT: 0x10,
- CONTROL: 0x11, ALT: 0x12, PAUSE: 0x13,
- CAPSLOCK: 0x14, ESCAPE: 0x1B, SPACE: 0x20,
- PAGEUP: 0x21, PAGEDOWN: 0x22, ENDL: 0x23,
- HOME: 0x24, LEFT: 0x25, UP: 0x26,
- RIGHT: 0x27, DOWN: 0x28, SELECT: 0x29,
- PRINT: 0x2A, EXECUTE: 0x2B, # PRINTSCREEN: 0x2C,
- INSERT: 0x2D, DELETE: 0x2E, HELP: 0x2F,
- WINDOWSL: 0x5B, WINDOWSR: 0x5C, APPS: 0x5D,
- MULTIPLY: 0x6A, ADD: 0x6B, SEPARATOR: 0x6C,
- SUBTRACT: 0x6D, DECIMAL: 0x6E, DIVIDE: 0x6F,
- NUMLOCK: 0x90, SCRLOCK: 0x91, LSHIFT: 0xA0,
- RSHIFT: 0xA1, LCONTROL: 0xA2, RCONTROL: 0xA3,
- LALT: 0xA4, RALT: 0xA5, PACKET: 0xE7
- }
- end
- class RPG::BaseItem
- include SixthBattleQTE
- def battle_qte
- if self.is_a?(RPG::Item) && ItemSetup.include?(@id)
- return ItemSetup[@id]
- elsif self.is_a?(RPG::Skill) && SkillSetup.include?(@id)
- return SkillSetup[@id]
- else
- return nil
- end
- end
- def qte_effects
- if self.is_a?(RPG::Item) && ItemEffects.include?(@id)
- return ItemEffects[@id]
- elsif self.is_a?(RPG::Skill) && SkillEffects.include?(@id)
- return SkillEffects[@id]
- else
- return nil
- end
- end
- end
- class Game_Battler < Game_BattlerBase
- attr_accessor :qte_success
- alias sixth_qte_success7653 initialize
- def initialize
- @qte_success = :none
- sixth_qte_success7653
- end
- alias sixth_qte_damage2254 make_damage_value
- def make_damage_value(user, item)
- if user.is_a?(Game_Actor) && !item.qte_effects.nil?
- saved_damage = item.damage.formula
- if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:target].nil?
- if item.qte_effects[user.qte_success][:target].include?(:damage)
- if item.qte_effects[user.qte_success][:target][:damage][0] == :add
- item.damage.formula += item.qte_effects[user.qte_success][:target][:damage][1]
- elsif item.qte_effects[user.qte_success][:target][:damage][0] == :rewrite
- item.damage.formula = item.qte_effects[user.qte_success][:target][:damage][1]
- end
- end
- end
- end
- sixth_qte_damage2254(user,item)
- item.damage.formula = saved_damage if !saved_damage.nil?
- end
- alias sixth_qte_hit3355 item_hit
- def item_hit(user, item)
- result = sixth_qte_hit3355(user,item)
- return result if user.is_a?(Game_Enemy) || item.qte_effects.nil?
- if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:user].nil?
- if item.qte_effects[user.qte_success][:user].include?(:hit_rate)
- if item.qte_effects[user.qte_success][:user][:hit_rate][0] == :mul
- result *= item.qte_effects[user.qte_success][:user][:hit_rate][1]
- elsif item.qte_effects[user.qte_success][:user][:hit_rate][0] == :add
- result += item.qte_effects[user.qte_success][:user][:hit_rate][1]
- end
- end
- end
- return result
- end
- alias sixth_qte_eva2677 item_eva
- def item_eva(user, item)
- result = sixth_qte_eva2677(user,item)
- return result if user.is_a?(Game_Enemy) || item.qte_effects.nil?
- if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:user].nil?
- if item.qte_effects[user.qte_success][:user].include?(:eva_rate)
- if item.qte_effects[user.qte_success][:user][:eva_rate][0] == :mul
- result *= item.qte_effects[user.qte_success][:user][:eva_rate][1]
- elsif item.qte_effects[user.qte_success][:user][:eva_rate][0] == :add
- result += item.qte_effects[user.qte_success][:user][:eva_rate][1]
- end
- end
- end
- return result
- end
- alias sixth_qte_cri1224 item_cri
- def item_cri(user, item)
- result = sixth_qte_cri1224(user,item)
- return result if user.is_a?(Game_Enemy) || item.qte_effects.nil?
- if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:user].nil?
- if item.qte_effects[user.qte_success][:user].include?(:cri_rate)
- if item.qte_effects[user.qte_success][:user][:cri_rate][0] == :mul
- result *= item.qte_effects[user.qte_success][:user][:cri_rate][1]
- elsif item.qte_effects[user.qte_success][:user][:cri_rate][0] == :add
- result += item.qte_effects[user.qte_success][:user][:cri_rate][1]
- end
- end
- end
- return result
- end
- end
- class CircleWindowBattle < Window_Base
- include SixthBattleQTE
- def initialize
- x = WindowSetup[:circle][:pos][0]; y = WindowSetup[:circle][:pos][1]
- w = WindowSetup[:circle][:size][0]; h = WindowSetup[:circle][:size][1]
- super(x,y,w,h)
- self.opacity = WindowSetup[:circle][:opacity]
- self.windowskin = Cache.system(WindowSetup[:circle][:skin])
- @sx = CircleSetup[:center][0]; @sy = CircleSetup[:center][1]
- @sr = CircleSetup[:radius]; @slc = Color.new(*CircleSetup[:slices][:color])
- @sln = CircleSetup[:slices][:amount]; @slw = CircleSetup[:slices][:size]
- @cw = CircleSetup[:line][:size]
- refresh(@sx,@sy-@sr,0,Color.new(*CircleSetup[:line][:color]),nil)
- end
- def refresh(x,y,chb,color,button=nil)
- contents.clear
- contents.draw_spoke(@sx,@sy,@sr,@sln,@slc,@slw)
- points = [[@sx,@sy],[x,y]]
- contents.draw_polygon(points,color,@cw)
- if !button.nil?
- draw_icon(ButtonSetup[button][:graphic],@sx-12,@sy-12)
- end
- end
- end
- class Scene_Battle < Scene_Base
- include SixthBattleQTE
- alias sixth_qte_ini1224 create_all_windows
- def create_all_windows
- sixth_qte_ini1224
- create_qte_variables
- create_qte_stuffs
- end
- def create_qte_variables
- @keys = VKeys::LETTERS.values+VKeys::OEM.values+VKeys::NUMBERS.values+VKeys::MINES.values
- @c = 0; @t_id = 0; @canceled = 0
- @x = @old_x = CircleSetup[:center][0]
- @y = @old_y = CircleSetup[:center][1] - CircleSetup[:radius]
- @spinning = false
- @started = false
- end
- def create_qte_stuffs
- @circlewin = CircleWindowBattle.new
- @circlewin.hide.close
- @circle = Sprite.new
- @circle.bitmap = Cache.picture(CircleSetup[:graphic][0])
- @circleback = Sprite.new
- @circleback.bitmap = Cache.picture(CircleSetup[:background][0])
- @circle.ox = @circle.bitmap.width/2
- @circleback.ox = @circleback.bitmap.width/2
- @circle.oy = @circle.bitmap.height/2
- @circleback.oy = @circleback.bitmap.height/2
- @circle.x = @circleback.x = @circlewin.x+CircleSetup[:center][0]+12
- @circle.y = @circleback.y = @circlewin.y+CircleSetup[:center][0]+12
- @circle.z = 200; @circleback.z = @circlewin.z - 1
- @circle.opacity = 0; @circleback.opacity = 0
- end
- alias sixth_qte_use_item3355 use_item
- def use_item
- item = @subject.current_action.item
- if $game_switches[QTEDisableSwitch] == false && @subject.is_a?(Game_Actor) &&
- !item.battle_qte.nil? && item.battle_qte[:chance] > rand(100)
- text1 = sprintf(item.battle_qte[:ctxt],@subject.name)
- @log_window.add_text(text1)
- start_the_test(item.battle_qte)
- @log_window.wait while @spinning == true
- update_for_wait while @spinning == true
- if @success == true
- @subject.qte_success = :success
- text2 = sprintf(item.battle_qte[:stxt],@subject.name)
- @log_window.add_text(text2)
- abs_wait(WaitSetup[:after])
- 2.times {@log_window.back_one}
- sixth_qte_use_item3355
- else
- @subject.qte_success = :fail
- text2 = sprintf(item.battle_qte[:ftxt],@subject.name)
- @log_window.add_text(text2)
- abs_wait(WaitSetup[:after])
- 2.times {@log_window.back_one}
- if FailSkipTurn == false
- return if (!item.qte_effects.nil? && !item.qte_effects[:skip].nil?)
- sixth_qte_use_item3355
- end
- end
- else
- @success = nil
- @subject.qte_success = :none
- sixth_qte_use_item3355
- end
- end
- alias sixth_qte_effects4466 apply_item_effects
- def apply_item_effects(target, item)
- if @subject.is_a?(Game_Actor) && !item.qte_effects.nil?
- if @success != nil
- apply_qte_effects(@subject,item,@subject.qte_success,:user)
- apply_qte_effects(target,item,@subject.qte_success,:target)
- end
- end
- sixth_qte_effects4466(target, item)
- end
- def apply_qte_effects(target,item,type1,type2)
- if !item.qte_effects[type1].nil? && !item.qte_effects[type1][type2].nil?
- item.qte_effects[type1][type2].each do |effect,data|
- case effect
- when :add_state
- data.each do |dt|
- target.add_state(dt[0]) if dt[1] > rand(100)
- end
- when :rem_state
- data.each do |dt|
- target.remove_state(dt[0]) if dt[1] > rand(100)
- end
- when :add_buff
- data.each do |dt|
- target.add_buff(dt[0],dt[1]) if dt[2] > rand(100)
- end
- when :add_debuff
- data.each do |dt|
- target.add_debuff(dt[0],dt[1]) if dt[2] > rand(100)
- end
- when :rem_buff
- data.each do |dt|
- target.remove_buff(dt[0]) if dt[1] > rand(100)
- end
- when :cmn_event
- $game_temp.reserve_common_event(data[0]) if data[1] > rand(100)
- when :switch
- $game_switches[data[0]] = data[1] if data[2] > rand(100)
- when :variable
- case data[1]
- when :set
- $game_variables[data[0]] = data[2] if data[3] > rand(100)
- when :add
- $game_variables[data[0]] += data[2] if data[3] > rand(100)
- when :mul
- $game_variables[data[0]] *= data[2] if data[3] > rand(100)
- when :mod
- $game_variables[data[0]] %= data[2] if data[3] > rand(100)
- end
- end
- end
- end
- end
- def start_the_test(qte)
- @qte = qte
- $game_variables[QTEVariables[:temp]] = 0
- SoundSetup[:start].play
- b_id = rand(QTESetup[qte[:qte]][@t_id][:buttons].size)
- @button = QTESetup[qte[:qte]][@t_id][:buttons][b_id]
- s_id = rand(QTESetup[qte[:qte]][@t_id][:speed].size)
- @speed = QTESetup[qte[:qte]][@t_id][:speed][s_id]
- if @speed > 0
- @start = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:start])
- @end = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:end])
- else
- @end = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:start])
- @start = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:end])
- end
- @circle.opacity = CircleSetup[:graphic][1]
- @circleback.opacity = CircleSetup[:background][1]
- @circlewin.show.open
- update_for_wait until @circlewin.openness >= 255
- abs_wait(WaitSetup[:before])
- @spinning = true
- @started = true
- end
- alias sixth_qte_update2244 update_basic
- def update_basic
- sixth_qte_update2244
- if BattleManager.in_turn? && @circlewin.visible == true
- changing_things_update if @spinning == true && @started == false && @canceled <= 0
- @started = false if @started == true
- @canceled -= 1 if @canceled > 0
- end
- end
- def changing_things_update
- spin_the_line
- refresh_the_line
- check_triggers
- end
- def check_triggers
- if @c.between?(@start,@end)
- if Input.trigger?(@button)
- ButtonSetup[@button][:se].play
- @t_id += 1
- check_the_end
- else
- if Input.trigger_any?(*(@keys-[@button]))
- reset_test_trigger(true)
- end
- end
- else
- if Input.trigger_any?(*@keys)
- reset_test_trigger(true)
- end
- end
- if @speed > 0
- if @c+@speed > @end
- reset_test_trigger(true)
- end
- else
- if @c+@speed < @start
- reset_test_trigger(true)
- end
- end
- end
- def reset_test_trigger(fail=false)
- if fail == true
- $game_variables[QTEVariables[:fail]] += 1
- @success = false
- SoundSetup[:fail].play
- end
- @spinning = false; @c = 0; @t_id = 0
- @circlewin.refresh(CircleSetup[:center][0],
- CircleSetup[:center][1] - CircleSetup[:radius],
- 0,
- Color.new(*CircleSetup[:color]),
- nil)
- @circlewin.close
- @circle.opacity = @circleback.opacity = 0
- @canceled = 10
- end
- def check_the_end
- $game_variables[QTEVariables[:temp]] += 1
- if @t_id > QTESetup[@qte[:qte]].size-1
- SoundSetup[:success][@qte[:qte]].play
- $game_variables[QTEVariables[:success]] += 1
- @success = true
- reset_test_trigger
- else
- b_id = rand(QTESetup[@qte[:qte]][@t_id][:buttons].size)
- @button = QTESetup[@qte[:qte]][@t_id][:buttons][b_id]
- s_id = rand(QTESetup[@qte[:qte]][@t_id][:speed].size)
- @speed = QTESetup[@qte[:qte]][@t_id][:speed][s_id]
- if @speed > 0
- @start = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:start])
- @end = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:end])
- else
- @end = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:start])
- @start = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:end])
- end
- end
- end
- def spin_the_line
- @c += @speed
- radians = @c * Math::PI / 180
- x2 = 0
- y2 = (CircleSetup[:center][1]-CircleSetup[:radius])-CircleSetup[:center][1]
- cos = Math.cos(radians)
- sin = Math.sin(radians)
- @x = x2*cos - y2*sin + CircleSetup[:center][0]
- @y = x2*sin + y2*cos + CircleSetup[:center][1]
- end
- def refresh_the_line
- if @old_x != @x || @old_y != @y
- if @c.between?(@start,@end)
- col = Color.new(*ButtonSetup[@button][:color])
- button = @button
- else
- col = Color.new(*CircleSetup[:line][:color])
- button = nil
- end
- @circlewin.refresh(@x,@y,@c,col,button)
- @old_x = @x; @old_y = @y
- end
- end
- def dispose_all_windows
- @circle.bitmap.dispose
- @circle.dispose
- @circleback.bitmap.dispose
- @circleback.dispose
- super
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement