Advertisement
TheSixth

Battle QTE System by Sixth

Sep 2nd, 2015
2,834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 60.17 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Battle QTE System (For Skills and Items)
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.2
  6. # * Updated: 17/02/2015
  7. # * Requires:
  8. #   ~ Scripts: Wanabe's LoadSo
  9. #              FenixFyreX's FyxInput
  10. #              KGC's Bitmap Extension
  11. #   ~ Files: msvcrt-ruby191.dll
  12. #            fyxinput.so
  13. #            TRGSSX.dll
  14. #-------------------------------------------------------------------------------
  15. # * < Change Log >
  16. #-------------------------------------------------------------------------------
  17. # * Version 1.0 (16/02/2015)
  18. #   - Initial release.
  19. # * Version 1.1 (16/02/2015)
  20. #   - Added button settings on a per trigger basis.
  21. #     Now you can specify the available buttons for a button trigger, and one
  22. #     button will be randomly selected from the specified buttons in the array.
  23. #     This will enable the option of making completely static QTEs if you want.
  24. #     Will also enable a new level of difficulty setting for your QTEs.
  25. #   - Removed a left-over sound effect in a method.
  26. #     Now only the specified fail SE will play upon QTE failure.
  27. #   - Added "No touchy-touchy!" comments.
  28. #     Damn, how could I forget these?! :D
  29. # * Version 1.2 (17/02/2015)
  30. #   - Added an option which lets the skills/items to be executed even if a
  31. #     QTE fails for them.
  32. #   - Added occurrence chances for QTEs. Now they can kick in randomly,
  33. #     instead of always happening. The setting for this is skill/item based.
  34. #   - Disable switch option added. Now you can turn OFF the QTE system temporary,
  35. #     whenever you want during the game.
  36. #   - Added QTE variables which will track the following things automatically:
  37. #     - Number of successfully executed QTEs.
  38. #     - Number of failed QTEs.
  39. #     - Number of successfully executed button triggers. This is a temporary
  40. #       variable, which resets on each QTE start-up, and stores the number of
  41. #       successful button presses. Can be used in damage formulas, for example.
  42. #   - Added in QTE after-effects.
  43. #     Several effects can be executed after a QTE at once.
  44. #     Separate effect settings for failed and for successful QTEs!
  45. #     Separate effect settings for the skill's/item's user and for the targets!
  46. #   - The following effects can be altered before the real skill triggers:
  47. #     - Hit Rate and Critical Rate
  48. #     - Evade Rate (no idea why I made this or how it works...)
  49. #     - Damage (includes changing the whole damage formula if desired)
  50. #     - States and Buffs
  51. #     - Switches and Variables
  52. #     - Action Execution (skip or not on failure)
  53. #   - A common event can also be called after all thing is said and done with
  54. #     the skills/items.
  55. #-------------------------------------------------------------------------------
  56. # * < Description >
  57. #-------------------------------------------------------------------------------
  58. # * This script will add quick time button events for your items and skills
  59. #   in battles with a nice visual presentation.
  60. # * You can assign the chances of a QTE appearing for each skill/item!
  61. # * If the player fails the QTE, the skill/item will not be executed.
  62. #   Or maybe it will afterall! From version 1.2 and above, skills and items can
  63. #   have QTE after-effects, which can change the flow of battle greatly!
  64. # * Switch the QTE system OFF and turn it back ON during a scene if needed!
  65. # * There are several scripts like these out there already, but all of them
  66. #   takes a predefined button setting for each actions, so memorizing them is
  67. #   not an issue in due time. This script, however, will take random button
  68. #   triggers, which can appear at random times and the window of opportunity for
  69. #   pressing the required button can be randomized as well. Pure randomness!
  70. #   Yeah, memorize that! This will keep battles interesting during the game.
  71. #   Or frustrating... Depends on your settings.
  72. # * Set your quick time button events up and assign them for skills and items!
  73. #   If no quick time setting is found for a skill/item, it will simply fire the
  74. #   skill/item without the need to do quick time events.
  75. # * Thanks to FyxInput, you can use any keyboard buttons!
  76. #   That's not all! You can even use mouse button triggers!
  77. #   In theory... Haven't tested mouse buttons yet.
  78. # * You can setup log window entries for each skill/item individually.
  79. #   These will appear when the quick time event starts.
  80. #   This way you know who does what and when.
  81. # * You can track the amount of QTEs failed and completed with variables
  82. #   automatically. Another variable is available which will track the number of
  83. #   successful button presses during a QTE, and can be used in damage formulas!
  84. # * Lotsa visual and audio settings, like always! :)
  85. #-------------------------------------------------------------------------------
  86. # * < Script Calls >
  87. #-------------------------------------------------------------------------------
  88. # * None yet...
  89. #-------------------------------------------------------------------------------
  90. # * < Installation >
  91. #-------------------------------------------------------------------------------
  92. # * The following scripts will need to be put below Materials but above Main
  93. #   in this order:
  94. #   - LoadSo (Wanabe)
  95. #   - FyxInput (FenixFyreX)
  96. #   - Bitmap Extension (KGC)
  97. # * The following files will need to be put into your game's main folder:
  98. #   - msvcrt-ruby191.dll
  99. #   - fyxinput.so
  100. #   - TRGSSX.dll
  101. #-------------------------------------------------------------------------------
  102. # * < Compatibility Info >
  103. #-------------------------------------------------------------------------------
  104. # * Will not work with any ABS systems yet, or in any other on-map battle
  105. #   systems (unless they use Scene_Battle as their "battle map").
  106. # * Tested with Yanfly's Battle Engine and Yami's Battle Symphony! It works, yay!
  107. # * Four methods were aliased in Scene_Battle:
  108. #   - create_all_windows
  109. #   - use_item
  110. #   - apply_item_effects
  111. #   - update_basic
  112. # * Five methods were aliased in Game_Battler:
  113. #   - initialize
  114. #   - item_hit
  115. #   - item_eva
  116. #   - item_cri
  117. #   - make_damage_value
  118. # * One method used a super call in Scene_Battle:
  119. #   - dispose_all_windows
  120. # * If you have any scripts which alias or overwrite the methods I aliased in
  121. #   Scene_Battle, you must put this script below them!
  122. #-------------------------------------------------------------------------------
  123. # * < Known Issues >
  124. #-------------------------------------------------------------------------------
  125. # * No known issues so far.
  126. #-------------------------------------------------------------------------------
  127. # * < Terms of Use >
  128. #-------------------------------------------------------------------------------
  129. # * Free to use for whatever purposes you want.
  130. # * Credit me (Sixth) in your game, pretty please! :P
  131. # * Posting modified versions of this script is allowed as long as you notice me
  132. #   about it with a link to it!
  133. #===============================================================================
  134. $imported = {} if $imported.nil?
  135. $imported["SixthBattleQTE"] = true
  136. #===============================================================================
  137. # Settings:
  138. #===============================================================================
  139. module SixthBattleQTE
  140.  
  141.   #-----------------------------------------------------------------------------
  142.   # QTE Switch Settings:
  143.   #-----------------------------------------------------------------------------
  144.   # Enter the ID of the switch here which you want to use for disabling the
  145.   # QTE system.
  146.   # Whenever this switch is turned ON, the QTE system will be disabled.
  147.   #-----------------------------------------------------------------------------
  148.   QTEDisableSwitch = 10
  149.  
  150.   #-----------------------------------------------------------------------------
  151.   # QTE Fail Settings:
  152.   #-----------------------------------------------------------------------------
  153.   # Set this to true if you want failed QTEs to skip the selected action
  154.   # entirely. This means no additional effects will be executed on failures.
  155.   # If you set it to false, the action will be executed regardless if it's
  156.   # QTE is failed or not.
  157.   # The item's/skill's fail effects can be triggered only when this is set to
  158.   # false!
  159.   # Even if this setting is set to false, you can add an additional item/skill
  160.   # effect which will skip the entire action. This can come in handy if you want
  161.   # only specific items/skills to skip the action on failure.
  162.   #-----------------------------------------------------------------------------
  163.   FailSkipTurn = false
  164.  
  165.   #-----------------------------------------------------------------------------
  166.   # QTE Variable Settings:
  167.   #-----------------------------------------------------------------------------
  168.   # These settings will let you assign variables to various things related to
  169.   # the QTE. You can use these variables in the game for eventing or for making
  170.   # QTE related damage formulas.
  171.   #
  172.   #   :success => variable_id,
  173.   # This will save the number of QTEs successfully finished automatically.
  174.   #
  175.   #   :fail => variable_id,
  176.   # This will save the number of QTEs failed during the game.
  177.   #
  178.   #   :temp => variable_id,
  179.   # This will track the successful button triggers during the QTE.
  180.   # At the start of a QTE, this resets to 0, and will start to count the number
  181.   # of successful button presses. You can use this variable in your damage
  182.   # formulas, for example.
  183.   #-----------------------------------------------------------------------------
  184.   QTEVariables = {:success => 10, :fail => 11, :temp => 12}
  185.  
  186.   #-----------------------------------------------------------------------------
  187.   # Wait Settings:
  188.   #-----------------------------------------------------------------------------
  189.   # If the player can't prepare for the QTE due to lack of time, he will surely
  190.   # fail to finish it.
  191.   # These settings will let you set a waiting time frame before the QTE line
  192.   # starts moving, and after the QTE is finished or failed, so that the player
  193.   # can read the log window if needed and prepare for the upcoming QTE.
  194.   #
  195.   # The settings here should be obvious, I think.
  196.   # The time is measured in frames, so entering 60 means it will wait 1 second!
  197.   #-----------------------------------------------------------------------------
  198.   WaitSetup = {:before => 100, :after => 60}
  199.  
  200.   #-----------------------------------------------------------------------------
  201.   # Window Settings:
  202.   #-----------------------------------------------------------------------------
  203.   # This is the window which handles the circle line's movement and other
  204.   # visual things happening while a QTE is active.
  205.   # Will only show up if a QTE is triggered!
  206.   #
  207.   # Settings format:
  208.   #
  209.   #   Window_Setup = {
  210.   #     :circle => {
  211.   #       :pos => [x,y],
  212.   #       :size => [width,height],
  213.   #       :skin => "file name",
  214.   #       :opacity => value,
  215.   #     }
  216.   #   }
  217.   #
  218.   # Detailed explanation:
  219.   #
  220.   #   :pos => [x,y],
  221.   # The window's X and Y position.
  222.   #
  223.   #   :size => [width,height],
  224.   # The window's width and height.
  225.   #
  226.   #   :skin => "file name",
  227.   # The windowskin used for the window.
  228.   # Windowskin files must be in the /Graphics/System/ folder!
  229.   #
  230.   #   :opacity => value,
  231.   # The opacity value for the window. Valid values: 0 - 255.
  232.   # Set it to 0 to hide the window. Useful if you want to use images instead.
  233.   #-----------------------------------------------------------------------------
  234.   WindowSetup = { # <-- No touchy-touchy!
  235.     :circle => {
  236.       :pos => [ 12, 74], :size => [130,130],
  237.       :skin => "Window", :opacity => 0,
  238.     }
  239.   } # <-- No touchy-touchy!
  240.    
  241.   #-----------------------------------------------------------------------------
  242.   # Circle Settings:
  243.   #-----------------------------------------------------------------------------
  244.   # The properties of the circle can be setup here.
  245.   #
  246.   # Settings format:
  247.   #
  248.   #   CircleSetup = {
  249.   #     :graphic => ["file name",opacity],
  250.   #     :background => ["file name",opacity],
  251.   #     :center => [x,y],
  252.   #     :radius => length,
  253.   #     :slices => {
  254.   #       :amount => number,
  255.   #       :size => value,
  256.   #       :color => [R,G,B,A],
  257.   #     },
  258.   #     :line => {
  259.   #       :size => value,
  260.   #       :color => [R,G,B,A],
  261.   #     },
  262.   #   }
  263.   #
  264.   # Detailed explanations:
  265.   #
  266.   #   :graphic => ["file name",opacity],
  267.   # The graphic used for the circle. Will appear above the circle window!
  268.   # The file used must be in the /Graphics/Pictures/ folder!
  269.   # Valid values for the opacity range from 0 to 255.
  270.   #
  271.   #   :background => ["file name",opacity],
  272.   # The background used for the circle. Will appear below the circle window!
  273.   # Same properties as above!
  274.   #
  275.   #   :center => [x,y],
  276.   # The position of the circle's center relative to the circle window's position!
  277.   # The images used will be automatically set to match the correct position too.
  278.   # Meaning that their center position will use the same X and Y values you
  279.   # set up here.
  280.   #
  281.   #   :radius => length,
  282.   # The length of the moving line in the circle.
  283.   #
  284.   #   :slices => { settings },
  285.   #   :line => { settings },
  286.   # These are sub-settings for the slices and the moving line in the circle.
  287.   # You don't need to change the :slices and the :line symbol!
  288.   #
  289.   #   :size => value,
  290.   # The size of the lines and slices in the circle.
  291.   # Measured in pixels!
  292.   #
  293.   #   :color => [R,G,B,A],
  294.   # The color used for the slices and the moving line in the circle.
  295.   # In the case of moving line, this will set it's default color, when no button
  296.   # press triggers are present.
  297.   # Uses RGBA codes! R = Red, G = Green, B = Blue, A = Alpha (opacity).
  298.   #
  299.   #   :amount => number,
  300.   # The amount of slices in the circle window.
  301.   # Set it to 0 if you don't want your circle to be sliced up!
  302.   #-----------------------------------------------------------------------------
  303.   CircleSetup = { # <-- No touchy-touchy!
  304.     :graphic => ["battlecircle1",255],
  305.     :background => ["battlecircleback2",170],
  306.     :center => [53,53], :radius => 54,
  307.     :slices => {:amount => 4, :size => 2, :color => [120,120,120,255]},
  308.     :line => {:size => 2, :color => [255,255,255,255]},
  309.   } # <-- No touchy-touchy!
  310.  
  311.   #-----------------------------------------------------------------------------
  312.   # Sound Settings:
  313.   #-----------------------------------------------------------------------------
  314.   # You can setup various sound effects here.
  315.   #
  316.   # A sound setting looks like this:
  317.   #
  318.   #   RPG::SE.new("file name",volume,pitch),
  319.   #    
  320.   # I guess it is pretty obvious what those things in the brackets above do.
  321.   #
  322.   # Information about the occurrence of these sound effects can be found besides
  323.   # each settings.
  324.   #-----------------------------------------------------------------------------
  325.   SoundSetup = { # <-- No touchy-touchy!
  326.     :start   => RPG::SE.new("Item1",   80, 100), # When the QTE Window appears.
  327.     :fail    => RPG::SE.new("Buzzer1", 80, 100), # When a QTE fails.
  328.     :success => { # When a QTE was successful. Each QTE types need a setup here!
  329.       "Easy"       => RPG::SE.new("Heal7", 80, 120),
  330.       "Normal"     => RPG::SE.new("Heal6", 80, 120),
  331.       "Hard"       => RPG::SE.new("Heal1", 80, 120),
  332.       "Insane"     => RPG::SE.new("Heal2", 80, 120),
  333.       "Impossible" => RPG::SE.new("Heal3", 80, 120),
  334.       "Back-Forth" => RPG::SE.new("Heal5", 80, 120),      
  335.     }
  336.   }  # <-- No touchy-touchy!
  337.  
  338.   #-----------------------------------------------------------------------------
  339.   # Button Settings:
  340.   #-----------------------------------------------------------------------------
  341.   # Set up the used buttons for the QTE system here.
  342.   # Each time a button trigger appears in the circle, a button from this setup
  343.   # will be used randomly.
  344.   # You can use any buttons you want!
  345.   # For the available buttons and their "name", refer to the FyxInput script
  346.   # made by FenixFyreX!
  347.   # You can NOT use regular symbols like :C for ENTER, :B for ESC and such!
  348.   # The buttons must be setup according to the FyxInput script!
  349.   #
  350.   # Don't go haywire with too many buttons or the QTE will be incredibly hard!
  351.   # This is just a personal suggestion...
  352.   #
  353.   # Settings format:
  354.   #
  355.   #   ButtonSetup = {
  356.   #     button_name => {
  357.   #       :color => [R,G,B,A],
  358.   #       :graphic => icon_id,
  359.   #       :se => RPG::SE.new("file name",volume,pitch),
  360.   #     },
  361.   #     # <-- Add more settings here!
  362.   #   }
  363.   #
  364.   # Detailed explanations:
  365.   #
  366.   #   button_name => {
  367.   # The "name" of the button. Must use a valid name from the FyxInput script!
  368.   # Do NOT enter the same button more than 1 time!
  369.   #
  370.   #   :color => [R,G,B,A],
  371.   # The moving line in the circle will change to this color when this button
  372.   # trigger was selected and will stay this color until the player presses the
  373.   # required button or runs out of time for the button press.
  374.   # Uses RGBA values!
  375.   #
  376.   #   :se => RPG::SE.new("file name",volume,pitch),
  377.   # The sound effect used when the player successfully presses the required
  378.   # button on time.
  379.   #-----------------------------------------------------------------------------
  380.   ButtonSetup = { # <-- No touchy-touchy!
  381.     VKeys::UP    => {:color => [255,  0,  0,255], :graphic => 590, :se => RPG::SE.new("Bell3",80, 37)},
  382.     VKeys::DOWN  => {:color => [  0,  0,255,255], :graphic => 591, :se => RPG::SE.new("Bell3",80, 74)},
  383.     VKeys::LEFT  => {:color => [  0,255,  0,255], :graphic => 588, :se => RPG::SE.new("Bell3",80,111)},
  384.     VKeys::RIGHT => {:color => [255,255,  0,255], :graphic => 589, :se => RPG::SE.new("Bell3",80,148)},
  385.   } # <-- No touchy-touchy!
  386.  
  387.   #-----------------------------------------------------------------------------
  388.   # Battle QTE Type Settings:
  389.   #-----------------------------------------------------------------------------
  390.   # The fun part! QTE settings!
  391.   # First of all, every single setting here will be randomized in the game!
  392.   # Keep this in mind when you are making your own settings!
  393.   #
  394.   # Make sure to test your settings several times before you mark them as
  395.   # "working" QTE settings! Due to the absolute randomization of the QTEs,
  396.   # luck becomes a very great factor in finishing them.
  397.   # Well, unless you make them static, that is.
  398.   #
  399.   # Once you are finished with the QTE type settings, you can assign them to
  400.   # your skills and items. You can even make one separate settings for each of
  401.   # your skills or items! Cool!
  402.   #
  403.   # Settings format:
  404.   #
  405.   #   QTESetup = {
  406.   #     "name" => {
  407.   #       id => {
  408.   #         :start => [starting_angle1,starting_angle2],
  409.   #         :end => [ending_angle1, ending_angle2],
  410.   #         :speed => [speed1,speed2,speed3, ... ,speedN],
  411.   #         :buttons => [button1,button2,button3, ... ,buttonN],
  412.   #       }
  413.   #       # <-- Add more button triggers here!
  414.   #     },
  415.   #     # <-- Add more QTE settings here!
  416.   #   }
  417.   #
  418.   # Detailed explanations:
  419.   #
  420.   #   "name" => {
  421.   # The name used for the QTE setting.
  422.   # You can name your settings however you want!
  423.   # Remember to setup a sound setting for each of your QTE settings!
  424.   #
  425.   #   id => {
  426.   # A sequential number starting from 0.
  427.   # The more id you add, the more button triggers will appear in the QTE.
  428.   # No, you can't make infinite long QTE settings, sorry!
  429.   #
  430.   #   :start => [starting_angle1,starting_angle2],
  431.   # The starting point for a button trigger appearing.
  432.   # Once the moving line inside the circle reaches the required angle, it will
  433.   # initiate a button trigger.
  434.   # The starting point itself will be randomized between the first and second
  435.   # angle you enter here.
  436.   # The line will always start at 0 angle pointing towards up and will move
  437.   # clock-wise if you enter positive values for the :speed settings or
  438.   # counter clock-wise if you enter negative values for the :speed settings.
  439.   # It is possible to create QTE events which will make the line move back and
  440.   # forth but be very careful when you are trying to do that!
  441.   # The first value entered here must be lower than the second, ALWAYS!
  442.   # I made an example of this, so make sure to check it out!
  443.   # Making back and forth moving lines can further confuse the player during the
  444.   # QTE! Nice way to make your skills extra hard to finish!
  445.   #
  446.   #   :end => [ending_angle1, ending_angle2],
  447.   # The ending point for the button trigger appeared.
  448.   # Once the moving line reaches the ending angle for a button trigger, the
  449.   # QTE will be failed.
  450.   # The ending point itself will be randomized between the first and second
  451.   # angle you enter here.
  452.   # Same properties as the starting point settings.
  453.   #
  454.   #   :speed => [speed1,speed2,speed3, ... ,speedN],
  455.   # The speed of the moving line in the circle.
  456.   # Due to the lack of proper automatic randomization for float numbers, you must
  457.   # enter the available speed values yourself here.
  458.   # The actual speed of the line will take a random value from this array each
  459.   # time a button has been pressed successfully.
  460.   # You can use float numbers here! The higher the number, the quicker the line
  461.   # will get! At around +/- 2.5 it gets really quick!
  462.   # Do NOT mix positive and negative numbers for a speed setting!
  463.   # Doing that will make it impossible to finish the QTE!
  464.   #
  465.   #   :buttons => [button1,button2,button3, ... ,buttonN],
  466.   # The available buttons for the QTE per button triggers.
  467.   # At each button trigger appearing, a random button will be selected from this
  468.   # array for the button trigger.
  469.   # You can add as many buttons as you want!
  470.   # The buttons used must be setup in the ButtonSetup settings!
  471.   # If you want only one button for the trigger, you can enter only one button
  472.   # in the array. This way you can make completely static QTE setups if you want.
  473.   #-----------------------------------------------------------------------------
  474.   QTESetup = { # <-- No touchy-touchy!
  475.     "Easy" => { # 2 Buttons
  476.       0 => {:start => [100,145], :end => [180,210], :speed => [0.5,1.0,1.5],
  477.             :buttons => [VKeys::UP,VKeys::DOWN]},
  478.       1 => {:start => [240,260], :end => [280,330], :speed => [0.5,1.0,1.5],
  479.             :buttons => [VKeys::LEFT,VKeys::RIGHT]},
  480.     },
  481.     "Normal" => { # 3 Buttons
  482.       0 => {:start => [ 60,100], :end => [130,170], :speed => [0.5,1.0,1.5],
  483.             :buttons => [VKeys::UP,VKeys::DOWN]},
  484.       1 => {:start => [190,220], :end => [240,260], :speed => [0.5,1.0,1.5],
  485.             :buttons => [VKeys::LEFT,VKeys::RIGHT]},
  486.       2 => {:start => [290,310], :end => [330,360], :speed => [0.5,1.0,1.5],
  487.             :buttons => [VKeys::UP,VKeys::DOWN]},
  488.     },
  489.     "Hard" => { # 4 Buttons
  490.       0 => {:start => [ 30, 50], :end => [ 80,100], :speed => [0.5,1.0,1.5,2.0],
  491.             :buttons => [VKeys::UP,VKeys::DOWN]},
  492.       1 => {:start => [130,150], :end => [180,200], :speed => [0.5,1.0,1.5,2.0],
  493.             :buttons => [VKeys::LEFT,VKeys::RIGHT]},
  494.       2 => {:start => [220,250], :end => [280,300], :speed => [0.5,1.0,1.5,2.0],
  495.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT]},
  496.       3 => {:start => [310,330], :end => [350,380], :speed => [0.5,1.0,1.5,2.0],
  497.             :buttons => [VKeys::DOWN,VKeys::RIGHT,VKeys::LEFT]},
  498.     },
  499.     "Insane" => { # 5 Buttons
  500.       0 => {:start => [ 30, 50], :end => [ 80,100], :speed => [0.5,1.0,1.5,2.0],
  501.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  502.       1 => {:start => [130,150], :end => [180,200], :speed => [0.5,1.0,1.5,2.0],
  503.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  504.       2 => {:start => [220,250], :end => [280,300], :speed => [0.5,1.0,1.5,2.0],
  505.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  506.       3 => {:start => [310,330], :end => [350,380], :speed => [0.5,1.0,1.5,2.0],
  507.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  508.       4 => {:start => [420,450], :end => [500,550], :speed => [0.5,1.0,1.5,2.0],
  509.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  510.     },
  511.     "Impossible" => { # 6 Buttons
  512.       0 => {:start => [ 30, 50], :end => [ 80,100], :speed => [1.0,1.5,2.0,2.5],
  513.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  514.       1 => {:start => [130,150], :end => [180,200], :speed => [1.0,1.5,2.0,2.5],
  515.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  516.       2 => {:start => [220,250], :end => [280,300], :speed => [1.0,1.5,2.0,2.5],
  517.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  518.       3 => {:start => [310,330], :end => [350,380], :speed => [1.0,1.5,2.0,2.5],
  519.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  520.       4 => {:start => [420,450], :end => [490,530], :speed => [1.0,1.5,2.0,2.5],
  521.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  522.       5 => {:start => [560,590], :end => [620,655], :speed => [1.0,1.5,2.0,2.5],
  523.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  524.     },
  525.     "Back-Forth" => { # 4 Buttons - Advanced Setup!
  526.       0 => {:start => [ 30, 60], :end => [ 90,120], :speed => [0.5,1.0,1.5],
  527.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  528.       1 => {:start => [170,200], :end => [230,260], :speed => [0.5,1.0,1.5],
  529.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  530.       2 => {:start => [160,180], :end => [100,140], :speed => [-0.5,-1.0],
  531.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  532.       3 => {:start => [ 40, 60], :end => [-30,  0], :speed => [-0.5,-1.0],
  533.             :buttons => [VKeys::UP,VKeys::DOWN,VKeys::LEFT,VKeys::RIGHT]},
  534.     },
  535.   } # <-- No touchy-touchy!
  536.  
  537.   #-----------------------------------------------------------------------------
  538.   # Skill QTE Settings:
  539.   #-----------------------------------------------------------------------------
  540.   # Well, now that you have setup your QTEs, they are ready to be assigned!
  541.   # This is the place where you can do that.
  542.   # Every skill with a QTE assigned will initiate a QTE upon skill usage.
  543.   # Skills without an assigned QTE setting will just fire themselves the
  544.   # default way, without any QTE.
  545.   #
  546.   # Settings format:
  547.   #
  548.   #   SkillSetup = {
  549.   #     skill_id => {
  550.   #       :qte => "QTE name",
  551.   #       :chance => value,
  552.   #       :ctxt => "text",
  553.   #       :stxt => "text",
  554.   #       :ftxt => "text",
  555.   #     },
  556.   #     # <-- Add more skill settings here!
  557.   #   }
  558.   #
  559.   # Detailed explanations:
  560.   #
  561.   #   skill_id => {
  562.   # The ID of the skill. Only enter skill IDs for the skills you want a QTE!
  563.   # Damn, the previous sentence sounds terrible, sorry! :P
  564.   #
  565.   #   :qte => "QTE name",
  566.   # The assigned QTE for the skill.
  567.   # Only use valid QTE names!
  568.   #
  569.   #   :chance => value,
  570.   # The chance in percentages that the QTE will be triggered for the skill.
  571.   # Entering 1 means 1%, 20 = 20%, 100 = 100%.
  572.   #
  573.   #   :ctxt => "text",
  574.   # The text setup here will be shown during the QTE, from the start to the end.
  575.   # It must contain a %s, which will show the name of the user!
  576.   #
  577.   #   :stxt => "text",
  578.   # The text setup here will be shown after a successful QTE.
  579.   # It must contain a %s, which will show the name of the user!
  580.   #
  581.   #   :ftxt => "text",
  582.   # The text setup here will be shown after a failed QTE.
  583.   # It must contain a %s, which will show the name of the user!
  584.   #-----------------------------------------------------------------------------
  585.   SkillSetup = { # <-- No touchy-touchy!
  586.     1  => {
  587.       :qte => "Easy", :chance => 50, :ctxt => "%s aims the attack!",
  588.       :stxt => "%s succesfully aimed the attack!",
  589.       :ftxt => "%s failed to aim the attack!",
  590.     },
  591.     2  => {
  592.       :qte => "Easy", :chance => 50, :ctxt => "%s tries to guard!",
  593.       :stxt => "%s enters guarding pose!",
  594.       :ftxt => "%s failed to guard!",
  595.     },
  596.    
  597.     26 => {
  598.       :qte => "Easy", :chance => 100, :ctxt => "%s channels Heal!",
  599.       :stxt => "%s succesfully channeled Heal!",
  600.       :ftxt => "%s failed to channel Heal!",
  601.     },
  602.     69 => {
  603.       :qte => "Normal", :chance => 100, :ctxt => "%s channels Saint!",
  604.       :stxt => "%s succesfully channeled Saint!",
  605.       :ftxt => "%s failed to channel Saint!",
  606.     },
  607.    
  608.     80 => {
  609.       :qte => "Easy", :chance => 100, :ctxt => "%s aims Strong Attack!",
  610.       :stxt => "%s succesfully aimed Strong Attack!",
  611.       :ftxt => "%s failed to aim Strong Attack!",
  612.     },
  613.     81 => {
  614.       :qte => "Easy", :chance => 100, :ctxt => "%s channels Cleave!",
  615.       :stxt => "%s succesfully channeled Cleave!",
  616.       :ftxt => "%s failed to channel Cleave!",
  617.     },
  618.     82 => {
  619.       :qte => "Normal", :chance => 100, :ctxt => "%s channels Berserker's Roar!",
  620.       :stxt => "%s succesfully channeled Berserker's Roar!",
  621.       :ftxt => "%s failed to channel Berserker's Roar!",
  622.     },
  623.     83 => {
  624.       :qte => "Normal", :chance => 100, :ctxt => "%s channels Berserker's Dance!",
  625.       :stxt => "%s succesfully channeled Berserker's Dance!",
  626.       :ftxt => "%s failed to channel Berserker's Dance!",
  627.     },
  628.     84 => {
  629.       :qte => "Hard", :chance => 100, :ctxt => "%s channels Giant's Rampage!",
  630.       :stxt => "%s succesfully channeled Giants's Rampage!",
  631.       :ftxt => "%s failed to channel Giant's Rampage!",
  632.     },
  633.    
  634.     90 => {
  635.       :qte => "Easy", :chance => 100, :ctxt => "%s prepares for Cover!",
  636.       :stxt => "%s succesfully prepared for Cover!",
  637.       :ftxt => "%s failed to prepare for Cover!",
  638.     },
  639.     91 => {
  640.       :qte => "Easy", :chance => 100, :ctxt => "%s channels Super Guard!",
  641.       :stxt => "%s succesfully channeled Super Guard!",
  642.       :ftxt => "%s failed to channel Super Guard!",
  643.     },
  644.     92 => {
  645.       :qte => "Normal", :chance => 100, :ctxt => "%s channels Restrengthen!",
  646.       :stxt => "%s succesfully channeled Restrengthen!",
  647.       :ftxt => "%s failed to channel Restrengthen!",
  648.     },
  649.     93 => {
  650.       :qte => "Normal", :chance => 100, :ctxt => "%s channels Zero Storm!",
  651.       :stxt => "%s succesfully channeled Zero Storm!",
  652.       :ftxt => "%s failed to channel Zero Storm!",
  653.     },
  654.     94 => {
  655.       :qte => "Hard", :chance => 100, :ctxt => "%s channels Aura Blade!",
  656.       :stxt => "%s succesfully channeled Aura Blade!",
  657.       :ftxt => "%s failed to channel Aura Blade!",
  658.     },
  659.    
  660.     110 => {
  661.       :qte => "Easy", :chance => 100, :ctxt => "%s tries to Vanish!",
  662.       :stxt => "%s succesfully prepared to Vanish!",
  663.       :ftxt => "%s failed to Vanish!",
  664.     },
  665.     111 => {
  666.       :qte => "Easy", :chance => 100, :ctxt => "%s channels Flare!",
  667.       :stxt => "%s succesfully channeled Flare!",
  668.       :ftxt => "%s failed to channel Flare!",
  669.     },
  670.     112 => {
  671.       :qte => "Normal", :chance => 100, :ctxt => "%s channels Thief's Luck!",
  672.       :stxt => "%s succesfully channeled Thief's Luck!",
  673.       :ftxt => "%s failed to channel Thief's Luck!",
  674.     },
  675.     113 => {
  676.       :qte => "Normal", :chance => 100, :ctxt => "%s channels Assassin's Edge!",
  677.       :stxt => "%s succesfully channeled Assassin's Edge!",
  678.       :ftxt => "%s failed to channel Assassin's Edge!",
  679.     },
  680.     114 => {
  681.       :qte => "Hard", :chance => 100, :ctxt => "%s channels Valiant Edge!",
  682.       :stxt => "%s succesfully channeled Valiant Edge!",
  683.       :ftxt => "%s failed to channel Valiant Edge!",
  684.     },
  685.   } # <-- No touchy-touchy!
  686.  
  687.   #-----------------------------------------------------------------------------
  688.   # Item QTE Settings:
  689.   #-----------------------------------------------------------------------------
  690.   # The same as for the skill QTE settings, but for items.
  691.   # The properties for each settings are the same too.
  692.   #-----------------------------------------------------------------------------
  693.   ItemSetup = { # <-- No touchy-touchy!
  694.     1 => {
  695.       :qte => "Normal", :chance => 100,
  696.       :ctxt => "%s searches for a Potion in the inventory!",
  697.       :stxt => "%s found a Potion!",
  698.       :ftxt => "%s failed to find a Potion!",
  699.     },
  700.     4 => {
  701.       :qte => "Easy", :chance => 100,
  702.       :ctxt => "%s searches for a Magic Water in the inventory!",
  703.       :stxt => "%s found a Magic Water!",
  704.       :ftxt => "%s failed to find a Magic Water!",
  705.     },
  706.   } # <-- No touchy-touchy!
  707.  
  708.   #-----------------------------------------------------------------------------
  709.   # Skill QTE Effect Settings:
  710.   #-----------------------------------------------------------------------------
  711.   # These are the settings for any additional effects you want to have for your
  712.   # skills when the player fails a QTE or finishes it.
  713.   #
  714.   # Before you read on, be warned that these are advanced settings for advanced
  715.   # users! You might have to read the instructions a few times to understand
  716.   # what each setting does here, when will they occur and for who.
  717.   #
  718.   # Now that this is outta the way, let's get started!
  719.   #
  720.   # You can setup additional effects for each of your skills here separately.
  721.   # Every setting here is optional, you can omit everything, even leave the
  722.   # whole thing empty, or you can fill up dozens of lines even with only one
  723.   # skill setting, your choice!
  724.   #
  725.   # All of the effects setup here will be executed after the QTE but BEFORE the
  726.   # actual database effects of the item. The only exception is the common event
  727.   # effect! This way you can manipulate the outcome depending on the QTE state
  728.   # of the skill (failed or not).
  729.   #
  730.   # Settings format:
  731.   #
  732.   #   SkillEffects = {
  733.   #     skill_id => {
  734.   #       :success => {
  735.   #         :user => { effects_goes_here },
  736.   #         :target => { effects_goes_here },
  737.   #       },
  738.   #       :fail => {
  739.   #         :user => { effects_goes_here },
  740.   #         :target => { effects_goes_here },
  741.   #       },
  742.   #       :skip => true,
  743.   #     },
  744.   #     # <-- Add more skill IDs here!
  745.   #   }
  746.   #
  747.   # Yeah, this big for one skill only! Although it can be shorter...
  748.   # Let's start with the basics:
  749.   #
  750.   #   skill_id => {
  751.   # Replace this with the skill's ID. Skills without a setting here will not
  752.   # have any additional effects.
  753.   #
  754.   #   :success => {
  755.   # The effects inside this hash will be executed if the player finishes the QTE.
  756.   # If the QTE fails, these won't be executed.
  757.   #
  758.   #   :fail => {
  759.   # The effects inside this hash will be executed if the player fails the QTE.
  760.   # If the player finishes it, these won't be executed.
  761.   #
  762.   #   :user => {
  763.   # The effects inside these hashes will be executed on the user and
  764.   # NOT on the target! Make sure to remember this!
  765.   # Certain effect settings can only be used in this hash, these will be marked.
  766.   # These effects will be executed before the :target effects!
  767.   #
  768.   #   :target => {
  769.   # The effects inside these hashes will be executed on the targets, on all of
  770.   # them! Make sure to remember this!
  771.   # Certain effect settings can only be used in this hash, these will be marked.
  772.   # These effects will be executed after the :user effects!
  773.   #
  774.   #   :skip => true,
  775.   # The skip flag for the QTE upon failure.
  776.   # If you use this in your skill effect setup, the skill will be skipped
  777.   # entirely if the player fails the QTE. This includes the failure effects you
  778.   # have setup for the skill too!
  779.   # This setting will NOT go into the :success or :fail hashes, it is standalone!
  780.   #
  781.   # Alright, these were the basics...
  782.   # Now for the fun part, the effects!
  783.   #
  784.   # ~ User specific effects:
  785.   #
  786.   #   :hit_rate => [type,value],
  787.   # You can change the hit rate before the real action triggers with this effect.
  788.   # With this, you can make sure-hit effects on QTE success or sure-miss effects
  789.   # for QTE fails... or vice verse, but why would you do that? :P
  790.   #   type = The type of the operation for the hit rate.
  791.   #          It can be either :add or :mul.
  792.   #          :add will, well, add the value specified directly to hit rate.
  793.   #          :mul will multiply the default hit rate with the value setup here.
  794.   #  value = The value of change for the hit rate.
  795.   #
  796.   #   :cri_rate => [type,value],
  797.   # Manipulate the critical rate with this effect.
  798.   # Got the same setup properties as the one above.
  799.   #
  800.   #   :eva_rate => [type,value],
  801.   # Manipulate the evade rate with this effect.
  802.   # I am not entirely sure how this affects the outcome.
  803.   # My head was spinning in chaos, and gave up on trying to understand this one.
  804.   # You are better off manipulating the hit rate itself if you want to affect
  805.   # the missing rate instead.
  806.   # Got the same setup properties as above.
  807.   #
  808.   # ~ Target specific effects:
  809.   #
  810.   #   :damage => [type,"formula"],
  811.   # This gave me one of the biggest head-ache in this script...
  812.   # There is simply no good place to alter the damage flow during actions
  813.   # without overwriting methods, which I didn't want.
  814.   # So, instead of overwriting the resulted damage, I made a "branch" on the
  815.   # damage formula of the skills/items, which made it possible to use two
  816.   # entirely different damage formula for the QTE effects (for success and fail).
  817.   #   type = The type of the operation for the damage formula.
  818.   #          It can be either :add or rewrite.
  819.   #          :add will simply add the formula to the end of the default formula.
  820.   #          :rewrite will overwrite the formula setup in the database entirely.
  821.   # formula = The formula used for the damage operation.
  822.   #           You can use the same variables as in the default database, so
  823.   #           use a for attacker, b for the target, etc.
  824.   #           The formula must be a string!
  825.   #
  826.   # ~ Shared effects:
  827.   #
  828.   #   :add_state => [[state_id,chance],[state_id,chance], ... ],
  829.   # Like the name suggests, this is used to add states after a QTE.
  830.   # You can add as many states as you want!
  831.   #   state_id = The ID of the state for the effect.
  832.   #     chance = The success chance for the state to be applied.
  833.   #              Entering 1 means 1%, 20 = 20%, 100 = 100%.
  834.   #
  835.   #   :rem_state => [[state_id,chance],[state_id,chance], ... ],
  836.   # Same as above, but this will remove states instead.
  837.   # Got the same properties as the above one!
  838.   #
  839.   #   :add_buff => [[param_id,turns,chance],[param_id,turns,chance], ... ],
  840.   # This will add buffs after a QTE. Add as many buffs as you want!
  841.   #   param_id = The buffed parameter's ID.
  842.   #              0 = HP,1 = MP,2 = ATK,3 = DEF,4 = MAT,5 = MDF,6 = AGI,7 = LUK.
  843.   #      turns = The number of turns for the buff to be effective.
  844.   #     chance = The success chance for the buff to be applied.
  845.   #              Entering 1 means 1%, 20 = 20%, 100 = 100%.
  846.   #
  847.   #   :add_debuff => [[param_id,turns,chance],[param_id,turns,chance], ... ],
  848.   # Same as above, but this will add debuffs instead.
  849.   # Got the same properties as the above one!
  850.   #
  851.   #   :rem_buff => [[param_id,chance],[param_id,chance], ... ],
  852.   # This will remove buffs AND debuffs after a QTE. Add as many as you want!
  853.   # Same properties as above, but without turn setups, those are not needed here.
  854.   #
  855.   #   :switch => [switch_id,true/false,chance],
  856.   # This can be used to turn switches ON or OFF after a QTE.
  857.   #   switch_id = The ID of the switch used for the effect.
  858.   #  true/false = The operation for the switch used.
  859.   #                true will turn ON the switch, false will turn it OFF.
  860.   #      chance = The success chance for the switch to be operated.
  861.   #               Entering 1 means 1%, 20 = 20%, 100 = 100%.
  862.   #
  863.   #   :variable => [var_id,operation,value,chance],
  864.   # This will operate a variable after a QTE.
  865.   #    var_id = The ID of the variable used for the effect.
  866.   # operation = The type of operation for the variable.
  867.   #             Available options: :set, :add, :mul, :mod.
  868.   #             :set = Will set the variable to the value specified.
  869.   #             :add = Will add the value specified to the variable.
  870.   #             :mul = Will multiple the current value of the variable.
  871.   #             :mod = Will divide the variable with the specified value and
  872.   #                    stores the remainder afterwards.
  873.   #     value = The value used for the variable operation.
  874.   #    chance = The success chance for the variable to be operated.
  875.   #             Okay, I won't write the percentage info again! :D
  876.   #
  877.   #   :cmn_event => [event_id,chance],
  878.   # This will call a common event AFTER the execution of the skill.
  879.   # Note that this will happen only after everything is done with the skill
  880.   # itself, including effects, damage and such things!
  881.   #  event_id = The ID of the common event used for the effect.
  882.   #    chance = The success chance for the common event to be triggered.
  883.   #
  884.   # Notes:
  885.   # If a skill's scope is set to "User" or if it affects "One Ally" and the user
  886.   # targets himself, the :user and :target becomes the same actor, so both the
  887.   # :user and :target effects will be executed on the actor who used the skill!
  888.   #
  889.   # The hit, critical and evade rates are using float values.
  890.   # 1.0 means 100%, 0.5% means 50%, etc.
  891.   #
  892.   # Huhh, this settles this section for now...
  893.   # I haven't tested every effect option, so if you find an error/bug in any of
  894.   # them, make sure to report to me!
  895.   #
  896.   # Before you report any issues, make sure your settings are correct!
  897.   # Double check the commas and brackets used, every bracket must be closed,
  898.   # and every hash and effect must be separated with a comma!
  899.   #
  900.   # Sample Skill Effect Explanation:
  901.   #
  902.   #   Skill 1 - Attack:
  903.   # - On success:
  904.   #   The user gets a boost of 50% for hit and critical rate.
  905.   #   The target(s) will receive the damage from the new damage formula instead
  906.   #   of the default damage setup in the database. The damage formula uses the
  907.   #   temporary variable for successful button presses, so the damage will
  908.   #   depend on the number of successful button presses.
  909.   #   The skill gets 5% chance of inflicting stun on the target(s).
  910.   # - On fail:
  911.   #   The user's hit and critical rate will be halved.
  912.   #   The user can get a LUK debuff and a Provoke state, both got 10% chance.
  913.   #   The damage will depend on the new damage formula.
  914.   #
  915.   #   Skill 2 - Guard:
  916.   # - On success:
  917.   #   The user will get 10% chance to remove Poison, Blind and Silence states.
  918.   #   The user got 20% chance to get the Ironbody state.
  919.   # - On fail:
  920.   #   The user gets 20% chance for a DEF debuff, and 20% chance to remove the
  921.   #   Ironbody state if present.
  922.   #
  923.   #   Skill 26 - Heal:
  924.   # - On success:
  925.   #   The user has 50% chance to get the Provoke state.
  926.   #   The target(s) got 30% chance to get the HP Regen state.
  927.   #
  928.   #   Skill 81 - Cleave
  929.   # - On success:
  930.   #   The user's critical rate will be multiplied by 1.5.
  931.   #   The target(s) will have 50% chance to get the Bleed state (custom state!)
  932.   #
  933.   #   Skill 113 - Assassin's Edge:
  934.   # - On success:
  935.   #   The damage formula will get additional contents, so the damage will be
  936.   #   increased based on the number of successful button presses during the QTE.
  937.   #   The target(s) will have 70% chance to get the Poison state.
  938.   # - On fail:
  939.   #   The user's hit rate will be decreased dramatically (default * 10%)!
  940.   #-----------------------------------------------------------------------------
  941.   SkillEffects = { # <-- No touchy-touchy!
  942.     1 => { # Start of Skill 1 - Attack
  943.       :success => {
  944.         :user => {:hit_rate => [:add,0.5],:cri_rate => [:add,0.5]},
  945.         :target => {:damage => [:rewrite,"[v[12] * a.atk * 3 - b.def,9999].min"],
  946.                     :add_state => [[8,5]]}
  947.       },
  948.       :fail => {
  949.         :user => {:hit_rate => [:mul,0.5],:cri_rate => [:mul,0.5],
  950.                   :add_debuff => [[7,3,10]],:add_state => [[12,10]]},
  951.         :target => {:damage => [:rewrite,"[v[12] * a.atk - b.def,1].max"]}
  952.       }
  953.     }, # End of Skill 1
  954.     2 => { # Start of Skill 2 - Guard
  955.       :success => {
  956.         :user => {:rem_state => [[2,10],[3,10],[4,10]],:add_state => [[17,20]]}
  957.       },
  958.       :fail => {
  959.         :user => {:add_debuff => [[3,4,20]],:rem_state => [[17,20]]}
  960.       }
  961.     }, # End of Skill 2
  962.     26 => { # Start of Skill 26 - Heal
  963.       :success => {
  964.         :user => {:add_state => [[12,50]]},
  965.         :target => {:add_state => [[14,30]]}
  966.       },
  967.     }, # End of Skill 26
  968.     81 => { # Start of Skill 81 - Cleave
  969.       :success => {
  970.         :user => {:cri_rate => [:mul,1.5]},
  971.         :target => {:add_state => [[26,50]]}
  972.       },
  973.     }, # End of Skill 81
  974.     113 => { # Start of Skill 113 - Assassin's Edge
  975.       :success => {
  976.         :target => {:damage => [:add," + (v[12] * (a.luk / 2))"],
  977.                     :add_state => [[2,70]]}
  978.       },
  979.       :fail => {
  980.         :user => {:hit_rate => [:mul,0.1]}
  981.       }
  982.     }, # End of Skill 113
  983.   } # <-- No touchy-touchy!
  984.  
  985.   #-----------------------------------------------------------------------------
  986.   # Item QTE Effect Settings:
  987.   #-----------------------------------------------------------------------------
  988.   # This is the same as above but for items instead.
  989.   # Everything is the same, so I will spare myself from writing all of it again.
  990.   #
  991.   # Sample Item Effect Explanation:
  992.   #
  993.   #   Item 1 - Potion:
  994.   # - On success:
  995.   #   The user have 50% chance to get the Provoke state.
  996.   # - On fail:
  997.   #   The whole action will be skipped.
  998.   #-----------------------------------------------------------------------------
  999.   ItemEffects = { # <-- No touchy-touchy!
  1000.     1 => { # Start of Item 1 - Potion
  1001.       :success => {
  1002.         :user => {:add_state => [[12,50]]},
  1003.       },
  1004.       :skip => true,
  1005.     }, # End of Item 1
  1006.   } # <-- No touchy-touchy!
  1007.  
  1008. #===============================================================================
  1009. # End of Settings! Editing anything below may lead to... You know what, right?
  1010. #===============================================================================
  1011.  
  1012.   def self.random(min=0, max)
  1013.     min + rand(max - min + 1)
  1014.   end
  1015.  
  1016. end
  1017.  
  1018. module Input::Keys
  1019.  
  1020.   MINES = {
  1021.     CANCEL:   0x03,      BACKSPACE: 0x08,      TAB:         0x09,
  1022.     CLEAR:    0x0C,      ENTER:     0x0D,      SHIFT:       0x10,
  1023.     CONTROL:  0x11,      ALT:       0x12,      PAUSE:       0x13,
  1024.     CAPSLOCK: 0x14,      ESCAPE:    0x1B,      SPACE:       0x20,
  1025.     PAGEUP:   0x21,      PAGEDOWN:  0x22,      ENDL:        0x23,
  1026.     HOME:     0x24,      LEFT:      0x25,      UP:          0x26,
  1027.     RIGHT:    0x27,      DOWN:      0x28,      SELECT:      0x29,
  1028.     PRINT:    0x2A,      EXECUTE:   0x2B,     # PRINTSCREEN: 0x2C,
  1029.     INSERT:   0x2D,      DELETE:    0x2E,      HELP:        0x2F,
  1030.     WINDOWSL: 0x5B,      WINDOWSR:  0x5C,      APPS:        0x5D,
  1031.     MULTIPLY: 0x6A,      ADD:       0x6B,      SEPARATOR:   0x6C,
  1032.     SUBTRACT: 0x6D,      DECIMAL:   0x6E,      DIVIDE:      0x6F,
  1033.     NUMLOCK:  0x90,      SCRLOCK:   0x91,      LSHIFT:      0xA0,
  1034.     RSHIFT:   0xA1,      LCONTROL:  0xA2,      RCONTROL:    0xA3,
  1035.     LALT:     0xA4,      RALT:      0xA5,      PACKET:      0xE7
  1036.   }
  1037.  
  1038. end
  1039.  
  1040. class RPG::BaseItem
  1041.   include SixthBattleQTE
  1042.  
  1043.   def battle_qte
  1044.     if self.is_a?(RPG::Item) && ItemSetup.include?(@id)
  1045.       return ItemSetup[@id]
  1046.     elsif self.is_a?(RPG::Skill) && SkillSetup.include?(@id)
  1047.       return SkillSetup[@id]
  1048.     else
  1049.       return nil
  1050.     end
  1051.   end
  1052.  
  1053.   def qte_effects
  1054.     if self.is_a?(RPG::Item) && ItemEffects.include?(@id)
  1055.       return ItemEffects[@id]
  1056.     elsif self.is_a?(RPG::Skill) && SkillEffects.include?(@id)
  1057.       return SkillEffects[@id]
  1058.     else
  1059.       return nil
  1060.     end
  1061.   end
  1062.  
  1063. end
  1064.  
  1065. class Game_Battler < Game_BattlerBase
  1066.  
  1067.   attr_accessor  :qte_success
  1068.  
  1069.   alias sixth_qte_success7653 initialize
  1070.   def initialize
  1071.     @qte_success = :none
  1072.     sixth_qte_success7653
  1073.   end
  1074.    
  1075.   alias sixth_qte_damage2254 make_damage_value
  1076.   def make_damage_value(user, item)
  1077.     if user.is_a?(Game_Actor) && !item.qte_effects.nil?
  1078.       saved_damage = item.damage.formula
  1079.       if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:target].nil?
  1080.         if item.qte_effects[user.qte_success][:target].include?(:damage)
  1081.           if item.qte_effects[user.qte_success][:target][:damage][0] == :add
  1082.             item.damage.formula += item.qte_effects[user.qte_success][:target][:damage][1]
  1083.           elsif item.qte_effects[user.qte_success][:target][:damage][0] == :rewrite
  1084.             item.damage.formula = item.qte_effects[user.qte_success][:target][:damage][1]
  1085.           end
  1086.         end
  1087.       end
  1088.     end
  1089.     sixth_qte_damage2254(user,item)
  1090.     item.damage.formula = saved_damage if !saved_damage.nil?
  1091.   end
  1092.  
  1093.   alias sixth_qte_hit3355 item_hit
  1094.   def item_hit(user, item)
  1095.     result = sixth_qte_hit3355(user,item)
  1096.     return result if user.is_a?(Game_Enemy) || item.qte_effects.nil?
  1097.     if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:user].nil?
  1098.       if item.qte_effects[user.qte_success][:user].include?(:hit_rate)
  1099.         if item.qte_effects[user.qte_success][:user][:hit_rate][0] == :mul
  1100.           result *= item.qte_effects[user.qte_success][:user][:hit_rate][1]
  1101.         elsif item.qte_effects[user.qte_success][:user][:hit_rate][0] == :add
  1102.           result += item.qte_effects[user.qte_success][:user][:hit_rate][1]
  1103.         end
  1104.       end
  1105.     end
  1106.     return result
  1107.   end
  1108.  
  1109.   alias sixth_qte_eva2677 item_eva
  1110.   def item_eva(user, item)
  1111.     result = sixth_qte_eva2677(user,item)
  1112.     return result if user.is_a?(Game_Enemy) || item.qte_effects.nil?
  1113.     if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:user].nil?
  1114.       if item.qte_effects[user.qte_success][:user].include?(:eva_rate)
  1115.         if item.qte_effects[user.qte_success][:user][:eva_rate][0] == :mul
  1116.           result *= item.qte_effects[user.qte_success][:user][:eva_rate][1]
  1117.         elsif item.qte_effects[user.qte_success][:user][:eva_rate][0] == :add
  1118.           result += item.qte_effects[user.qte_success][:user][:eva_rate][1]
  1119.         end
  1120.       end
  1121.     end
  1122.     return result
  1123.   end
  1124.  
  1125.   alias sixth_qte_cri1224 item_cri
  1126.   def item_cri(user, item)
  1127.     result = sixth_qte_cri1224(user,item)
  1128.     return result if user.is_a?(Game_Enemy) || item.qte_effects.nil?
  1129.     if !item.qte_effects[user.qte_success].nil? && !item.qte_effects[user.qte_success][:user].nil?
  1130.       if item.qte_effects[user.qte_success][:user].include?(:cri_rate)
  1131.         if item.qte_effects[user.qte_success][:user][:cri_rate][0] == :mul
  1132.           result *= item.qte_effects[user.qte_success][:user][:cri_rate][1]
  1133.         elsif item.qte_effects[user.qte_success][:user][:cri_rate][0] == :add
  1134.           result += item.qte_effects[user.qte_success][:user][:cri_rate][1]
  1135.         end
  1136.       end
  1137.     end
  1138.     return result
  1139.   end
  1140.  
  1141. end
  1142.  
  1143. class CircleWindowBattle < Window_Base
  1144.   include SixthBattleQTE
  1145.  
  1146.   def initialize
  1147.     x = WindowSetup[:circle][:pos][0]; y = WindowSetup[:circle][:pos][1]
  1148.     w = WindowSetup[:circle][:size][0]; h = WindowSetup[:circle][:size][1]
  1149.     super(x,y,w,h)
  1150.     self.opacity = WindowSetup[:circle][:opacity]
  1151.     self.windowskin = Cache.system(WindowSetup[:circle][:skin])
  1152.     @sx = CircleSetup[:center][0]; @sy = CircleSetup[:center][1]
  1153.     @sr = CircleSetup[:radius]; @slc = Color.new(*CircleSetup[:slices][:color])
  1154.     @sln = CircleSetup[:slices][:amount]; @slw = CircleSetup[:slices][:size]
  1155.     @cw = CircleSetup[:line][:size]
  1156.     refresh(@sx,@sy-@sr,0,Color.new(*CircleSetup[:line][:color]),nil)
  1157.   end
  1158.  
  1159.   def refresh(x,y,chb,color,button=nil)
  1160.     contents.clear
  1161.     contents.draw_spoke(@sx,@sy,@sr,@sln,@slc,@slw)
  1162.     points = [[@sx,@sy],[x,y]]
  1163.     contents.draw_polygon(points,color,@cw)
  1164.     if !button.nil?
  1165.       draw_icon(ButtonSetup[button][:graphic],@sx-12,@sy-12)
  1166.     end
  1167.   end
  1168.  
  1169. end
  1170.  
  1171. class Scene_Battle < Scene_Base
  1172.   include SixthBattleQTE
  1173.  
  1174.   alias sixth_qte_ini1224 create_all_windows
  1175.   def create_all_windows
  1176.     sixth_qte_ini1224
  1177.     create_qte_variables
  1178.     create_qte_stuffs
  1179.   end
  1180.  
  1181.   def create_qte_variables
  1182.     @keys = VKeys::LETTERS.values+VKeys::OEM.values+VKeys::NUMBERS.values+VKeys::MINES.values
  1183.     @c = 0; @t_id = 0; @canceled = 0
  1184.     @x = @old_x = CircleSetup[:center][0]
  1185.     @y = @old_y = CircleSetup[:center][1] - CircleSetup[:radius]
  1186.     @spinning = false
  1187.     @started = false
  1188.   end
  1189.  
  1190.   def create_qte_stuffs
  1191.     @circlewin = CircleWindowBattle.new
  1192.     @circlewin.hide.close
  1193.     @circle = Sprite.new
  1194.     @circle.bitmap = Cache.picture(CircleSetup[:graphic][0])
  1195.     @circleback = Sprite.new
  1196.     @circleback.bitmap = Cache.picture(CircleSetup[:background][0])
  1197.     @circle.ox = @circle.bitmap.width/2
  1198.     @circleback.ox = @circleback.bitmap.width/2
  1199.     @circle.oy = @circle.bitmap.height/2
  1200.     @circleback.oy = @circleback.bitmap.height/2
  1201.     @circle.x = @circleback.x = @circlewin.x+CircleSetup[:center][0]+12
  1202.     @circle.y = @circleback.y = @circlewin.y+CircleSetup[:center][0]+12
  1203.     @circle.z = 200; @circleback.z = @circlewin.z - 1
  1204.     @circle.opacity = 0; @circleback.opacity = 0
  1205.   end
  1206.  
  1207.   alias sixth_qte_use_item3355 use_item
  1208.   def use_item
  1209.     item = @subject.current_action.item
  1210.     if $game_switches[QTEDisableSwitch] == false && @subject.is_a?(Game_Actor) &&
  1211.        !item.battle_qte.nil? && item.battle_qte[:chance] > rand(100)
  1212.       text1 = sprintf(item.battle_qte[:ctxt],@subject.name)
  1213.       @log_window.add_text(text1)
  1214.       start_the_test(item.battle_qte)
  1215.       @log_window.wait while @spinning == true
  1216.       update_for_wait while @spinning == true
  1217.       if @success == true
  1218.         @subject.qte_success = :success
  1219.         text2 = sprintf(item.battle_qte[:stxt],@subject.name)
  1220.         @log_window.add_text(text2)
  1221.         abs_wait(WaitSetup[:after])
  1222.         2.times {@log_window.back_one}
  1223.         sixth_qte_use_item3355
  1224.       else
  1225.         @subject.qte_success = :fail
  1226.         text2 = sprintf(item.battle_qte[:ftxt],@subject.name)
  1227.         @log_window.add_text(text2)
  1228.         abs_wait(WaitSetup[:after])
  1229.         2.times {@log_window.back_one}
  1230.         if FailSkipTurn == false
  1231.           return if (!item.qte_effects.nil? && !item.qte_effects[:skip].nil?)
  1232.           sixth_qte_use_item3355
  1233.         end
  1234.       end
  1235.     else
  1236.       @success = nil
  1237.       @subject.qte_success = :none
  1238.       sixth_qte_use_item3355
  1239.     end    
  1240.   end
  1241.  
  1242.   alias sixth_qte_effects4466 apply_item_effects
  1243.   def apply_item_effects(target, item)
  1244.     if @subject.is_a?(Game_Actor) && !item.qte_effects.nil?
  1245.       if @success != nil
  1246.         apply_qte_effects(@subject,item,@subject.qte_success,:user)
  1247.         apply_qte_effects(target,item,@subject.qte_success,:target)
  1248.       end
  1249.     end
  1250.     sixth_qte_effects4466(target, item)    
  1251.   end
  1252.  
  1253.   def apply_qte_effects(target,item,type1,type2)
  1254.     if !item.qte_effects[type1].nil? && !item.qte_effects[type1][type2].nil?
  1255.       item.qte_effects[type1][type2].each do |effect,data|
  1256.         case effect
  1257.         when :add_state
  1258.           data.each do |dt|
  1259.             target.add_state(dt[0]) if dt[1] > rand(100)
  1260.           end
  1261.         when :rem_state
  1262.           data.each do |dt|
  1263.             target.remove_state(dt[0]) if dt[1] > rand(100)
  1264.           end
  1265.         when :add_buff
  1266.           data.each do |dt|
  1267.             target.add_buff(dt[0],dt[1]) if dt[2] > rand(100)
  1268.           end
  1269.         when :add_debuff
  1270.           data.each do |dt|
  1271.             target.add_debuff(dt[0],dt[1]) if dt[2] > rand(100)
  1272.           end
  1273.         when :rem_buff
  1274.           data.each do |dt|
  1275.             target.remove_buff(dt[0]) if dt[1] > rand(100)
  1276.           end
  1277.         when :cmn_event
  1278.           $game_temp.reserve_common_event(data[0]) if data[1] > rand(100)
  1279.         when :switch
  1280.           $game_switches[data[0]] = data[1] if data[2] > rand(100)
  1281.         when :variable
  1282.           case data[1]
  1283.           when :set
  1284.             $game_variables[data[0]] = data[2] if data[3] > rand(100)
  1285.           when :add
  1286.             $game_variables[data[0]] += data[2] if data[3] > rand(100)
  1287.           when :mul
  1288.             $game_variables[data[0]] *= data[2] if data[3] > rand(100)
  1289.           when :mod
  1290.             $game_variables[data[0]] %= data[2] if data[3] > rand(100)
  1291.           end
  1292.         end
  1293.       end
  1294.     end
  1295.   end
  1296.    
  1297.   def start_the_test(qte)
  1298.     @qte = qte
  1299.     $game_variables[QTEVariables[:temp]] = 0
  1300.     SoundSetup[:start].play
  1301.     b_id = rand(QTESetup[qte[:qte]][@t_id][:buttons].size)
  1302.     @button = QTESetup[qte[:qte]][@t_id][:buttons][b_id]
  1303.     s_id = rand(QTESetup[qte[:qte]][@t_id][:speed].size)
  1304.     @speed = QTESetup[qte[:qte]][@t_id][:speed][s_id]
  1305.     if @speed > 0
  1306.       @start = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:start])
  1307.       @end = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:end])
  1308.     else
  1309.       @end = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:start])
  1310.       @start = SixthBattleQTE.random(*QTESetup[qte[:qte]][@t_id][:end])
  1311.     end
  1312.     @circle.opacity = CircleSetup[:graphic][1]
  1313.     @circleback.opacity = CircleSetup[:background][1]
  1314.     @circlewin.show.open
  1315.     update_for_wait until @circlewin.openness >= 255
  1316.     abs_wait(WaitSetup[:before])
  1317.     @spinning = true
  1318.     @started = true
  1319.   end
  1320.  
  1321.   alias sixth_qte_update2244 update_basic
  1322.   def update_basic
  1323.     sixth_qte_update2244
  1324.     if BattleManager.in_turn? && @circlewin.visible == true
  1325.       changing_things_update if @spinning == true && @started == false && @canceled <= 0
  1326.       @started = false if @started == true
  1327.       @canceled -= 1 if @canceled > 0
  1328.     end
  1329.   end
  1330.  
  1331.   def changing_things_update
  1332.     spin_the_line
  1333.     refresh_the_line
  1334.     check_triggers
  1335.   end
  1336.  
  1337.   def check_triggers
  1338.     if @c.between?(@start,@end)
  1339.       if Input.trigger?(@button)
  1340.         ButtonSetup[@button][:se].play
  1341.         @t_id += 1
  1342.         check_the_end
  1343.       else
  1344.         if Input.trigger_any?(*(@keys-[@button]))
  1345.           reset_test_trigger(true)
  1346.         end
  1347.       end
  1348.     else
  1349.       if Input.trigger_any?(*@keys)
  1350.         reset_test_trigger(true)
  1351.       end
  1352.     end
  1353.     if @speed > 0
  1354.       if @c+@speed > @end
  1355.         reset_test_trigger(true)
  1356.       end    
  1357.     else
  1358.       if @c+@speed < @start
  1359.         reset_test_trigger(true)
  1360.       end
  1361.     end
  1362.   end
  1363.    
  1364.   def reset_test_trigger(fail=false)
  1365.     if fail == true
  1366.       $game_variables[QTEVariables[:fail]] += 1
  1367.       @success = false
  1368.       SoundSetup[:fail].play
  1369.     end
  1370.     @spinning = false; @c = 0; @t_id = 0
  1371.     @circlewin.refresh(CircleSetup[:center][0],
  1372.                    CircleSetup[:center][1] - CircleSetup[:radius],
  1373.                    0,
  1374.                    Color.new(*CircleSetup[:color]),
  1375.                    nil)
  1376.     @circlewin.close
  1377.     @circle.opacity = @circleback.opacity = 0
  1378.     @canceled = 10
  1379.   end
  1380.  
  1381.   def check_the_end
  1382.     $game_variables[QTEVariables[:temp]] += 1
  1383.     if @t_id > QTESetup[@qte[:qte]].size-1
  1384.       SoundSetup[:success][@qte[:qte]].play
  1385.       $game_variables[QTEVariables[:success]] += 1
  1386.       @success = true
  1387.       reset_test_trigger
  1388.     else
  1389.       b_id = rand(QTESetup[@qte[:qte]][@t_id][:buttons].size)
  1390.       @button = QTESetup[@qte[:qte]][@t_id][:buttons][b_id]
  1391.       s_id = rand(QTESetup[@qte[:qte]][@t_id][:speed].size)
  1392.       @speed = QTESetup[@qte[:qte]][@t_id][:speed][s_id]
  1393.       if @speed > 0
  1394.         @start = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:start])
  1395.         @end = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:end])
  1396.       else
  1397.         @end = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:start])
  1398.         @start = SixthBattleQTE.random(*QTESetup[@qte[:qte]][@t_id][:end])
  1399.       end
  1400.     end
  1401.   end
  1402.      
  1403.   def spin_the_line
  1404.     @c += @speed
  1405.     radians = @c * Math::PI / 180
  1406.     x2 = 0
  1407.     y2 = (CircleSetup[:center][1]-CircleSetup[:radius])-CircleSetup[:center][1]
  1408.     cos = Math.cos(radians)
  1409.     sin = Math.sin(radians)
  1410.     @x = x2*cos - y2*sin + CircleSetup[:center][0]
  1411.     @y = x2*sin + y2*cos + CircleSetup[:center][1]
  1412.   end
  1413.  
  1414.   def refresh_the_line
  1415.     if @old_x != @x || @old_y != @y
  1416.       if @c.between?(@start,@end)
  1417.         col = Color.new(*ButtonSetup[@button][:color])
  1418.         button = @button
  1419.       else
  1420.         col = Color.new(*CircleSetup[:line][:color])
  1421.         button = nil
  1422.       end
  1423.       @circlewin.refresh(@x,@y,@c,col,button)
  1424.       @old_x = @x; @old_y = @y
  1425.     end
  1426.   end
  1427.  
  1428.   def dispose_all_windows
  1429.     @circle.bitmap.dispose
  1430.     @circle.dispose
  1431.     @circleback.bitmap.dispose
  1432.     @circleback.dispose
  1433.     super
  1434.   end
  1435.  
  1436. end
  1437. #==============================================================================
  1438. # !!END OF SCRIPT - OHH, NOES!!
  1439. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement