Advertisement
Dekita

$D13x Weapon Attacks

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