Advertisement
Dekita

Skill Lvls 1.0

Mar 20th, 2013
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.08 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # ☆ $D13x - Skill Levels
  4. # -- Author : Dekita
  5. # -- Version : 1.0
  6. # -- Level : Easy / Normal
  7. # -- Requires : $D13x - Statistic Control
  8. # -- Engine : RPG Maker VX Ace.
  9. #
  10. #===============================================================================
  11. # ☆ Import
  12. #-------------------------------------------------------------------------------
  13. $D13x={}if$D13x==nil
  14. $D13x[:Skill_Lv]=true
  15. #===============================================================================
  16. # ☆ Updates
  17. #-------------------------------------------------------------------------------
  18. # D /M /Y
  19. # 2o/o3/2o13 - Finished,
  20. # 1o/o3/2o13 - Started
  21. #
  22. #===============================================================================
  23. # ☆ Introduction
  24. #-------------------------------------------------------------------------------
  25. # This script gives skills - levels.
  26. # You can have different growth types, exp requirements, max level,
  27. # level name and damage multiplier for each skill.
  28. # Simple notetag usage.
  29. # Plug-N-Play.
  30. #
  31. #===============================================================================
  32. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  33. #===============================================================================
  34. # 1. You MUST give credit to "Dekita" !!
  35. # 2. You are NOT allowed to repost this script.(or modified versions)
  36. # 3. You are NOT allowed to convert this script.
  37. # 4. You are NOT allowed to use this script for Commercial games.
  38. # 5. ENJOY!
  39. #
  40. # "FINE PRINT"
  41. # By using this script you hereby agree to the above terms and conditions,
  42. # if any violation of the above terms occurs "legal action" may be taken.
  43. # Not understanding the above terms and conditions does NOT mean that
  44. # they do not apply to you.
  45. # If you wish to discuss the terms and conditions in further detail you can
  46. # contact me at http://dekitarpg.wordpress.com/
  47. #
  48. #===============================================================================
  49. # ☆ Instructions
  50. #-------------------------------------------------------------------------------
  51. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  52. # Place Under My $D13x - Statistic Control Script.
  53. #
  54. #===============================================================================
  55. # ☆ Notetags ( default )
  56. # For use with Class Skill Learn noteboxes only !
  57. #-------------------------------------------------------------------------------
  58. # <exp set: id>
  59. # replace id with the id of the Exp_Set (defined below) that you wish to use.
  60. #
  61. # <growth type: id>
  62. # replace id with the id of the Growth_Type (defined below) that you wish to use.
  63. #
  64. # <max level: value>
  65. # replace value with the maximum level for that skill
  66. #
  67. #===============================================================================
  68. # ☆ HELP
  69. #-------------------------------------------------------------------------------
  70. # The default max level is the size of its Exp_Set[id] hash.
  71. #
  72. #===============================================================================
  73. module Skill_Levels
  74. #===============================================================================
  75. Exp_Set=[];Growth_Type=[]# << Keep
  76. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  77. # ☆ General Settings
  78. #--------------------------------------------------------------------------
  79. # reset exp after level ?
  80. Exp_Reset_On_Lv_Up = false # true
  81.  
  82. # if these are true, skill costs will be multiplied by the DMG Multi
  83. Dmg_Multi_Skill_Cost = { :mp => true , :tp => false }
  84.  
  85. # Default Exp Set given to skills (unless notetagged)
  86. Default_Exp_Set_ID = 0
  87.  
  88. # Default Growth Type given to skills (unless notetagged)
  89. Default_GrowthT_ID = 0
  90.  
  91. # Default Notetags
  92. Notes={
  93. :exp_set => /<exp set:(.*)>/i ,
  94. :max_lev => /<max level:(.*)>/i ,
  95. :gro_typ => /<growth type:(.*)>/i ,
  96. }# << end Notes={}
  97.  
  98. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  99. # ☆ Exp Setup - Settings
  100. #--------------------------------------------------------------------------
  101. # here is where you define the required exp for each level
  102. # as well as the level name and damage multiplier.
  103. # DMG Multi will also increase any statistics gained by
  104. # using the Statistic Control scripts notetags
  105. # you can add to this array as you please.
  106. Exp_Set[0]={#<< Exp Settings : 0 Begin
  107. # Level => [Exp Req, "Name", DMG Multi] ,
  108. 1 => [ 0, "Lv 1", 1.0 ] , # << Default level
  109. 2 => [ 25, "Lv 2", 1.1 ] ,
  110. 3 => [ 50, "Lv 3", 1.2 ] ,
  111. 4 => [ 100, "Lv 4", 1.4 ] ,
  112. 5 => [ 200, "Lv 5", 1.6 ] ,
  113. 6 => [ 400, "Lv 6", 1.8 ] ,
  114. 7 => [ 800, "Lv 7", 2.0 ] ,
  115. 8 => [ 1600, "Lv 8", 2.4 ] ,
  116. 9 => [ 3200, "Lv 9", 3.0 ] ,
  117. }# << Keep
  118.  
  119. Exp_Set[1]={#<< Exp Settings : 1 Begin
  120. # Level => [Exp Req, "Name", DMG Multi] ,
  121. 1 => [ 0, "Lv 1", 1.0 ] , # << Default level
  122. 2 => [ 50, "Lv 2", 1.1 ] ,
  123. 3 => [ 100, "Lv 3", 1.2 ] ,
  124. 4 => [ 200, "Lv 4", 1.4 ] ,
  125. 5 => [ 400, "Lv 5", 1.6 ] ,
  126. 6 => [ 800, "Lv 6", 1.8 ] ,
  127. 7 => [ 1600, "Lv 7", 2.0 ] ,
  128. 8 => [ 3200, "Lv 8", 2.4 ] ,
  129. 9 => [ 6400, "Lv 9", 3.0 ] ,
  130. }# << Keep
  131.  
  132. Exp_Set[2]={#<< Exp Settings : 2 Begin
  133. # Level => [Exp Req, "Name", DMG Multi] ,
  134. 1 => [ 0, "Lv 1", 1.0 ] , # << Default level
  135. 2 => [ 15, "Lv 2", 1.1 ] ,
  136. 3 => [ 45, "Lv 3", 1.2 ] ,
  137. 4 => [ 135, "Lv 4", 1.4 ] ,
  138. 5 => [ 405, "Lv 5", 1.6 ] ,
  139. 6 => [ 1215, "Lv 6", 1.8 ] ,
  140. 7 => [ 3645, "Lv 7", 2.0 ] ,
  141. 8 => [ 10935, "Lv 8", 2.4 ] ,
  142. 9 => [ 32805, "Lv 9", 3.0 ] ,
  143. }# << Keep
  144.  
  145. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  146. # ☆ Growth Type - Settings
  147. #--------------------------------------------------------------------------
  148. # Here is where you can define the exp gained for various conditions
  149. # you can add to this array as you please.
  150. # :per_use = exp gained per use of the skill
  151. # :per_dmg = per (100 * skill level) damage dealt
  152. # :per_bat = exp gained per battle (while you know the skill)
  153. # :per_esc = exp gained when actor escapes battle (for the skill)
  154. # :per_die = exp gained when actor dies ( for the skill )
  155. Growth_Type[0]={
  156. :per_use => 19,
  157. :per_dmg => 0,
  158. :per_bat => 25,
  159. :per_die => 0,
  160. :per_esc => 0,
  161. } # << Keep
  162.  
  163. Growth_Type[1]={
  164. :per_use => 0,
  165. :per_dmg => 1,
  166. :per_bat => 0,
  167. :per_die => 0,
  168. :per_esc => 0,
  169. } # << Keep
  170.  
  171. Growth_Type[2]={
  172. :per_use => 1,
  173. :per_dmg => 0,
  174. :per_bat => 0,
  175. :per_die => 0,
  176. :per_esc => 0,
  177. } # << Keep
  178.  
  179. #####################
  180. # CUSTOMISATION END #
  181. end #####################
  182. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  183. # #
  184. # http://dekitarpg.wordpress.com/ #
  185. # #
  186. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  187. #===============================================================================#
  188. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  189. # YES?\.\. #
  190. # OMG, REALLY? \| #
  191. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  192. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  193. #===============================================================================#
  194. module BattleManager
  195. #===============================================================================
  196. #--------------------------------------------------------------------------
  197. # Alias List
  198. #--------------------------------------------------------------------------
  199. class << self
  200. alias :gain_skill_exp :gain_exp
  201. end
  202. #--------------------------------------------------------------------------
  203. # EXP Acquisition and Level Up Display
  204. #--------------------------------------------------------------------------
  205. def self.gain_exp
  206. gain_skill_exp
  207. skills_gain_exp
  208. end
  209. #--------------------------------------------------------------------------
  210. # EXP Acquisition and Level Up Display (Skills)
  211. #--------------------------------------------------------------------------
  212. def self.skills_gain_exp
  213. $game_party.battle_members.each do |actor|
  214. actor.skills.each do |skill|
  215. next if skill == nil
  216. value = Skill_Levels::Growth_Type[skill.growth_type][:per_bat]
  217. actor.increase_skill_exp(skill, value)
  218. end
  219. end
  220. wait_for_message
  221. end
  222.  
  223. end
  224.  
  225. #==============================================================================
  226. class RPG::Skill < RPG::UsableItem
  227. #==============================================================================
  228. #---------------------------------------------------------------------------
  229. # Alias List
  230. #---------------------------------------------------------------------------
  231. alias :deki_skill_levz :load_stat_control
  232. #---------------------------------------------------------------------------
  233. # Pi Variables
  234. #---------------------------------------------------------------------------
  235. attr_accessor :exp_set
  236. attr_accessor :growth_type
  237. attr_accessor :max_lv
  238. #---------------------------------------------------------------------------
  239. # Load Stat Control
  240. #---------------------------------------------------------------------------
  241. def load_stat_control
  242. deki_skill_levz
  243. @exp_set = Skill_Levels::Default_Exp_Set_ID
  244. @growth_type = Skill_Levels::Default_GrowthT_ID
  245. @max_lv = Skill_Levels::Exp_Set[@exp_set].size
  246. self.note.split(/[\r\n]+/).each do |line|
  247. case line
  248. when Skill_Levels::Notes[:max_lev] then @max_lv = $1.to_i
  249. when Skill_Levels::Notes[:exp_set] then @exp_set = $1.to_i
  250. when Skill_Levels::Notes[:gro_typ] then @growth_type = $1.to_i
  251. end
  252. end
  253. end
  254.  
  255. end
  256.  
  257. #==============================================================================
  258. class Game_Battler < Game_BattlerBase
  259. #==============================================================================
  260. #--------------------------------------------------------------------------
  261. # Alias List
  262. #--------------------------------------------------------------------------
  263. alias :_MDV__skillev :make_damage_value
  264. alias :_APV__skillev :apply_variance
  265. #--------------------------------------------------------------------------
  266. # M.D.V
  267. #--------------------------------------------------------------------------
  268. def make_damage_value(user, item)
  269. @skillev_user = user
  270. @skillev_item = item
  271. _MDV__skillev(user, item)
  272. end
  273. #--------------------------------------------------------------------------
  274. # Apply Variance Mod ( HEAVY ALIAS )
  275. #--------------------------------------------------------------------------
  276. def apply_variance(damage, variance)
  277. user = @skillev_user
  278. item = @skillev_item
  279. orii = _APV__skillev(damage, variance)
  280. orig = apply_skill_variance(user,item,orii)
  281. orig
  282. end
  283. #--------------------------------------------------------------------------
  284. # Apply Skill Variance
  285. #--------------------------------------------------------------------------
  286. def apply_skill_variance(user,item,orig)
  287. return 0 if user.is_a?(Game_Enemy)
  288. return 0 if item.id == (attack_skill_id || guard_skill_id)
  289. lvdmgmul = Skill_Levels::Exp_Set[item.exp_set][user.skills_lv(item.id)][2]
  290. valu = orig * lvdmgmul
  291. ex = ((valu/100)*user.skills_lv(item.id)*
  292. Skill_Levels::Growth_Type[item.growth_type][:per_dmg]).to_i
  293. user.increase_skill_exp(item, ex)
  294. valu
  295. end
  296.  
  297. end
  298.  
  299. #==============================================================================
  300. class Game_Actor < Game_Battler
  301. #==============================================================================
  302. #--------------------------------------------------------------------------
  303. # Alias List
  304. #--------------------------------------------------------------------------
  305. alias :ls_alias_SD13x :learn_skill
  306. alias :from_suparr_pscc :pay_skill_cost
  307. alias :init_de_skeel :init_skills
  308. alias :die_exp_skill :die
  309. alias :escape_exp_skill :escape
  310. alias :skill_lv_mp_st :skill_mp_cost
  311. alias :skill_lv_tp_st :skill_tp_cost
  312. #--------------------------------------------------------------------------
  313. # Learn Skill
  314. #--------------------------------------------------------------------------
  315. def learn_skill(skill_id)
  316. old_skills = skills.clone
  317. ls_alias_SD13x(skill_id)
  318. if skills != old_skills
  319. @skills_lv[skill_id] = 1
  320. @skills_exp[skill_id] = 0
  321. @skills_list.push(skill_id)
  322. @skills_list.sort!
  323. end
  324. end
  325. #--------------------------------------------------------------------------
  326. # Initialize Skills
  327. #--------------------------------------------------------------------------
  328. def init_skills
  329. ds = $data_skills.size
  330. @skills_lv = [1] * ds
  331. @skills_exp = [0] * ds
  332. init_de_skeel
  333. end
  334. #--------------------------------------------------------------------------
  335. # Get Skill Level
  336. #--------------------------------------------------------------------------
  337. def skills_lv(id)
  338. @skills_lv[id]
  339. end
  340. #--------------------------------------------------------------------------
  341. # Get Skill Exp
  342. #--------------------------------------------------------------------------
  343. def skills_exp(id)
  344. @skills_exp[id] == nil ? 0 : @skills_exp[id]
  345. end
  346. #--------------------------------------------------------------------------
  347. # Increase Skill Exp
  348. #--------------------------------------------------------------------------
  349. def increase_skill_exp(skill, value = nil)
  350. return if skill.id == ( attack_skill_id || guard_skill_id )
  351. if value == nil
  352. value = Skill_Levels::Growth_Type[skill.growth_type][:per_use]
  353. end
  354. return if value == nil || value <= 0
  355. return if @skills_lv[skill.id] >= skill.max_lv
  356. set_id = skill.exp_set
  357. value.times do
  358. break if @skills_lv[skill.id] >= skill.max_lv
  359. @skills_exp[skill.id] += 1
  360. need = Skill_Levels::Exp_Set[set_id][(@skills_lv[skill.id]+1)][0]
  361. if @skills_exp[skill.id] >= (need)
  362. increase_skill_proficiency(skill.id)
  363. end
  364. end
  365. end
  366. #--------------------------------------------------------------------------
  367. # Increase Skill Level
  368. #--------------------------------------------------------------------------
  369. def increase_skill_proficiency(skill_id)
  370. @skills_lv[skill_id] += 1
  371. if Skill_Levels::Exp_Reset_On_Lv_Up
  372. @skills_exp[skill_id] = 0
  373. end
  374. ltex = Skill_Levels::Exp_Set[$data_skills[skill_id].exp_set][@skills_lv[skill_id]][1]
  375. text = "#{self.name}'s #{$data_skills[skill_id].name} is now #{ltex}"
  376. $game_message.add(text)
  377. end
  378. #--------------------------------------------------------------------------
  379. # Forget Skill
  380. #--------------------------------------------------------------------------
  381. def forget_skill(skill_id)
  382. @skills.delete(skill_id)
  383. end
  384. #--------------------------------------------------------------------------
  385. # Die
  386. #--------------------------------------------------------------------------
  387. def die
  388. die_exp_skill
  389. do_obscure_skill_exp(:per_die)
  390. end
  391. #--------------------------------------------------------------------------
  392. # Escape
  393. #--------------------------------------------------------------------------
  394. def escape
  395. escape_exp_skill
  396. do_obscure_skill_exp(:per_esc)
  397. end
  398. #--------------------------------------------------------------------------
  399. # Do Obscure Skill Exp Gain
  400. #--------------------------------------------------------------------------
  401. def do_obscure_skill_exp(type = :nil)
  402. return if type == :nil
  403. skills.each do |skill|
  404. next if skill == nil
  405. value = Skill_Levels::Growth_Type[skill.growth_type][type]
  406. next if value <= 0
  407. actor.increase_skill_exp(skill, value)
  408. end
  409. end
  410. #--------------------------------------------------------------------------
  411. # Pay Cost of Using Skill
  412. #--------------------------------------------------------------------------
  413. def pay_skill_cost(skill)
  414. from_suparr_pscc(skill)
  415. increase_skill_exp(skill)
  416. end
  417. #--------------------------------------------------------------------------
  418. # Calculate Skill's MP Cost
  419. #--------------------------------------------------------------------------
  420. def skill_mp_cost(skill)
  421. old = skill_lv_mp_st(skill)
  422. if Skill_Levels::Dmg_Multi_Skill_Cost[:mp]
  423. old *= @skills_lv[skill.id]
  424. end
  425. old
  426. end
  427. #--------------------------------------------------------------------------
  428. # Calculate Skill's TP Cost
  429. #--------------------------------------------------------------------------
  430. def skill_tp_cost(skill)
  431. old = skill_lv_tp_st(skill)
  432. if Skill_Levels::Dmg_Multi_Skill_Cost[:tp]
  433. old *= @skills_lv[skill.id]
  434. end
  435. old
  436. end
  437.  
  438. end # << Game_Actor
  439.  
  440. #==============================================================================
  441. class Window_SkillList < Window_Selectable
  442. #==============================================================================
  443. #--------------------------------------------------------------------------
  444. # Draw Item Name
  445. #--------------------------------------------------------------------------
  446. def draw_item_name(item, x, y, enabled = true, width = (Graphics.width/2))
  447. return unless item && @actor
  448. w = (width - (standard_padding*2) - 4)
  449. draw_icon(item.icon_index, x, y, enabled)
  450. change_color(normal_color, enabled)
  451. skill_lv = @actor.skills_lv(item.id)
  452. if $D13x[:Skill_Scene] && !SceneManager.scene_is?(Scene_Battle)
  453. refresh_font
  454. text = Skill_Levels::Exp_Set[item.exp_set][skill_lv][1]
  455. draw_text(x + 24, y, w-24, line_height, item.name)
  456. draw_text(x, y, w, line_height, text, 2)
  457. else
  458. text = "#{item.name} #{Skill_Levels::Exp_Set[item.exp_set][skill_lv][1]}"
  459. draw_text(x + 24, y, w-24, line_height, text)
  460. end
  461. end
  462.  
  463. end
  464.  
  465. #==============================================================================#
  466. # http://dekitarpg.wordpress.com/ #
  467. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement