Advertisement
Dekita

$D13x Weapon Attacks v1.1

May 30th, 2013
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.33 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Weapon Attacks
  5. # -- Author : Dekita
  6. # -- Version : 1.1
  7. # -- Level : Easy
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Wep_Attacks]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 17/o5/2o13 - Small Update,
  21. # 23/o3/2o13 - Started, Finished,
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This script will allow you to give each weapon its own default attack skill.
  27. # You can also define the chance of the skill being used.
  28. # eg.
  29. # Axe has skill 65, it will use skill 65 50% of the time and the default skill
  30. # the other 50% of the time.
  31. #
  32. # You can also do the same for the guard skill :)
  33. #
  34. #===============================================================================
  35. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  36. #===============================================================================
  37. # 1. You MUST give credit to "Dekita" !!
  38. # 2. You are NOT allowed to repost this script.(or modified versions)
  39. # 3. You are NOT allowed to convert this script.
  40. # 4. You are NOT allowed to use this script for Commercial games.
  41. # 5. ENJOY!
  42. #
  43. # "FINE PRINT"
  44. # By using this script you hereby agree to the above terms and conditions,
  45. # if any violation of the above terms occurs "legal action" may be taken.
  46. # Not understanding the above terms and conditions does NOT mean that
  47. # they do not apply to you.
  48. # If you wish to discuss the terms and conditions in further detail you can
  49. # contact me at http://dekitarpg.wordpress.com/
  50. #
  51. #===============================================================================
  52. # ☆ Instructions
  53. #-------------------------------------------------------------------------------
  54. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  55. #
  56. #===============================================================================
  57. # ☆ Notetags ( default )
  58. #-------------------------------------------------------------------------------
  59. # <atk skill: skill_id, chance>
  60. # <grd skill: skill_id, chance>
  61. #
  62. # skill_id = the skill id from the database
  63. # chance = a value from 0-100, 0 = 0% chance, 100 = 100% chance
  64. #
  65. # <atk skill: skill_id>
  66. # <grd skill: skill_id>
  67. # Use this notetag for weapons that Always use skill_id as the default attack.
  68. #
  69. #===============================================================================
  70. # ☆ Additional Credit
  71. #-------------------------------------------------------------------------------
  72. # ' Takemypassword ' - For giving me the inspiration to write this :)
  73. #
  74. #===============================================================================
  75. module Weapon_Attacks
  76. #===============================================================================
  77. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  78. # ☆ General Settings
  79. #--------------------------------------------------------------------------
  80. # Turn This Script Off Here.
  81. Use_Script = true
  82.  
  83. # Set The Default Attack and Guard Skills Here.
  84. Default_Skills={
  85. :attack => 1 ,
  86. :guard => 2 ,
  87. } # << Keep
  88.  
  89. # Modify The Notetag You Use Here.
  90. Notes={
  91. :attack => [ /<atk skill:(.*)>/i , /<atk skill:(.*),(.*)>/i ] ,
  92. :guard => [ /<grd skill:(.*)>/i , /<grd skill:(.*),(.*)>/i ] ,
  93. } # << Keep
  94.  
  95. end #####################
  96. # CUSTOMISATION END #
  97. #####################
  98. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  99. # #
  100. # http://dekitarpg.wordpress.com/ #
  101. # #
  102. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  103. #===============================================================================#
  104. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  105. # YES?\.\. #
  106. # OMG, REALLY? \| #
  107. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  108. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  109. #===============================================================================#
  110. module DataManager
  111. #===============================================================================
  112. #---------------------------------------------------------------------------
  113. # Alias List
  114. #---------------------------------------------------------------------------
  115. class << self
  116. alias :lbd_unique_wepatk :load_database
  117. end
  118. #---------------------------------------------------------------------------
  119. # Load Database (alias)
  120. #---------------------------------------------------------------------------
  121. def self.load_database
  122. lbd_unique_wepatk
  123. loa_unique_wepatk
  124. end
  125. #---------------------------------------------------------------------------
  126. # Load Unique Shit
  127. #---------------------------------------------------------------------------
  128. def self.loa_unique_wepatk
  129. for wep in $data_weapons
  130. next if wep == nil
  131. wep.load_unique_defatk
  132. end
  133. end
  134.  
  135. end # DataManager
  136.  
  137. #===============================================================================
  138. class RPG::EquipItem < RPG::BaseItem
  139. #===============================================================================
  140. #---------------------------------------------------------------------------
  141. # Pi Variables
  142. #---------------------------------------------------------------------------
  143. attr_accessor :atk_skill_id
  144. attr_accessor :grd_skill_id
  145. #---------------------------------------------------------------------------
  146. # Load Unique Notes
  147. #---------------------------------------------------------------------------
  148. def load_unique_defatk
  149. @atk_skill_id = nil
  150. @grd_skill_id = nil
  151. load_weapon_defatks
  152. end
  153. #---------------------------------------------------------------------------
  154. # Load Weapon Default Attacks
  155. #---------------------------------------------------------------------------
  156. def load_weapon_defatks
  157. return unless self.is_a?(RPG::Weapon)
  158. self.note.split(/[\r\n]+/).each do |line|
  159. case line
  160. when Weapon_Attacks::Notes[:attack][0] ; @atk_skill_id = [$1.to_i , 100]
  161. when Weapon_Attacks::Notes[:guard][0] ; @grd_skill_id = [$1.to_i , 100]
  162. when Weapon_Attacks::Notes[:attack][1] ; @atk_skill_id = [$1.to_i,$2.to_i]
  163. when Weapon_Attacks::Notes[:guard][1] ; @grd_skill_id = [$1.to_i,$2.to_i]
  164. end
  165. end
  166. end
  167.  
  168. end
  169.  
  170. #===============================================================================
  171. class Game_Actor < Game_Battler
  172. #===============================================================================
  173. #--------------------------------------------------------------------------
  174. # Alias List
  175. #--------------------------------------------------------------------------
  176. alias :atksklid :attack_skill_id
  177. alias :grdsklid :guard_skill_id
  178. #--------------------------------------------------------------------------
  179. # Get Skill ID of Normal Attack
  180. #--------------------------------------------------------------------------
  181. def attack_skill_id
  182. return atksklid if Weapon_Attacks::Use_Script == false
  183. self.weapons.each do |e|
  184. next if e == nil
  185. next if e.atk_skill_id == nil
  186. if e.atk_skill_id[0] != nil && e.atk_skill_id[1] > rand(100)
  187. return e.atk_skill_id[0]
  188. end
  189. end
  190. return Weapon_Attacks::Default_Skills[:attack]
  191. end
  192. #--------------------------------------------------------------------------
  193. # Get Skill ID of Guard
  194. #--------------------------------------------------------------------------
  195. def guard_skill_id
  196. return grdsklid if Weapon_Attacks::Use_Script == false
  197. self.weapons.each do |e|
  198. next if e == nil
  199. next if e.grd_skill_id == nil
  200. if e.grd_skill_id[0] != nil && e.grd_skill_id[1] > rand(100)
  201. return e.grd_skill_id[0] if e.grd_skill_id[0] != nil
  202. end
  203. end
  204. return Weapon_Attacks::Default_Skills[:guard]
  205. end
  206.  
  207. end
  208.  
  209. #==============================================================================#
  210. # http://dekitarpg.wordpress.com/ #
  211. #==============================================================================#
  212. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement