Advertisement
Dekita

$D13x - Enemy Levels

Nov 18th, 2013
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.92 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Enemy Levels
  5. # -- Author : Dekita
  6. # -- Version : 1.0
  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[:Enemy_Levels]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 12/11/2o13 - Finished,
  21. # ??/??/2o13 - Started
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This script simply allows for enemies to be given levels, based on the
  27. # current map.
  28. #
  29. # Levels are easily adustable via notetags.
  30. #
  31. # Enemies are also given a statistic bonus for each level. This is obviously,
  32. # Fully customizable.
  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
  58. #-------------------------------------------------------------------------------
  59. # ( enemies )
  60. # <level mod id: X>
  61. # X = the idof the Level_Mod for this enemy.
  62. #
  63. # ( maps )
  64. # <lv: X, Y>
  65. # X = Minimum Level for enemies on this map.
  66. # Y = Maximum level for enemies on this map.
  67. #
  68. # <ene lv: X, Y, Z>
  69. # X = Enemy Database ID.
  70. # Y = Min Level For X enemy on this map.
  71. # Z = Max Level For X enemy on this map.
  72. #
  73. #===============================================================================
  74. # ☆ HELP
  75. #-------------------------------------------------------------------------------
  76. #
  77. #===============================================================================
  78. # ☆ HELP
  79. #-------------------------------------------------------------------------------
  80. # PARAMS : # XPARAMS : # SPARAMS : #
  81. # stat = id # stat = id # stat = id #
  82. # mhp = 0 # hit = 0 # tgr = 0 #
  83. # mmp = 1 # eva = 1 # grd = 1 #
  84. # atk = 2 # cri = 2 # rec = 2 #
  85. # def = 3 # cev = 3 # pha = 3 #
  86. # mat = 4 # mev = 4 # mcr = 4 #
  87. # mdf = 5 # mrf = 5 # tcr = 5 #
  88. # agi = 6 # cnt = 6 # pdr = 6 #
  89. # luk = 7 # hrg = 7 # mdr = 7 #
  90. # # mrg = 8 # fdr = 8 #
  91. # # trg = 9 # exr = 9 #
  92. #-------------------------------------------------------------------------------
  93. # Remember :
  94. # All Params work with integer values, eg. 1, 5, 123, 653, 198123
  95. # All x/s-Params work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01
  96. # 1.0 = 100%, 0.01 = 1%,
  97. #
  98. #===============================================================================
  99. module Enemy_Control
  100. #===============================================================================
  101. Level_Mod=[]# << Keep
  102.  
  103. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  104. # ☆ General Settings :
  105. #-----------------------------------------------------------------------------
  106. # Minimum Level an Enemy can ever be.
  107. Min_Level = 1
  108. # Maximum Level an Enemy can ever be.
  109. Max_Level = 100
  110. # Use Pokemon Style Exp Calculation.
  111. Use_Exp_Gain_Formula = true
  112. # Use Pokemon Style Gold Calculation.
  113. Use_Gold_Gain_Formula = true
  114. # As enemy levels are based on maps and during battle test there is no map id,
  115. # you have to set the min and max level for enemies in test battles here.
  116. BattleTest_Level = [10, 20] # [min, max]
  117.  
  118. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  119. # ☆ Notetag Settings :
  120. #-----------------------------------------------------------------------------
  121. Notetag = /<lv:(.*),(.*)>/i
  122. Notetag_B = /<ene lv:(.*),(.*),(.*)>/i
  123. Notetag_C = /<level mod id:(.*)>/i
  124.  
  125. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  126. # ☆ Level Stat Modifcations :
  127. #-----------------------------------------------------------------------------
  128. # This is the default Level_Mod id for all enemies.
  129. # Can be changed via notetags.
  130. LM_Default = 1
  131. # Syntax is:
  132. # Level_Mod[id] = [
  133. # [:param , id, change],
  134. # [:x_param , id, change],
  135. # [:s_param , id, change],
  136. # [:atk_ele , id, change],
  137. # [:def_ele , id, change],
  138. # [:spds_stat , id, change]
  139. # [:atk_lvl , change],
  140. # [:def_lvl , change],
  141. # [:max_tp , change],
  142. # ]
  143. # NOTE : the value will be multiplied by the enemies level.
  144. Level_Mod[0]=[
  145. # -- Keep this stat set empty for monsters that should not receive any
  146. # -- stat increase based on levels
  147. ]# << End Stat_Set[0]
  148.  
  149. Level_Mod[1]=[
  150. [:param , 0, 2.8],
  151. [:param , 1, 2.8],
  152. # [:param , 2, 0.6],
  153. # [:param , 3, 0.4],
  154. # [:param , 4, 0.4],
  155. # [:param , 5, 0.2],
  156. # [:param , 6, 1],
  157. # [:param , 7, 1],
  158. # [:x_param , 0, 0.01],
  159. # [:x_param , 1, 0.01],
  160. # [:x_param , 2, 0.01],
  161. # [:atk_ele , 4, 0.01],
  162. # [:def_ele , 4, -0.01],
  163. [:spds_stat, 0, 1],
  164. [:spds_stat, 1, 1],
  165. [:spds_stat, 2, 1],
  166. [:spds_stat, 3, 1],
  167. [:atk_lvl , 0.5],
  168. [:def_lvl , 0.5],
  169. [:max_tp , 1],
  170. # Insert other regular/x/s-param codes here (codes found above)
  171. # Rememer to put a comma , after each line.
  172. ]# << End Stat_Set[1]
  173. #####################
  174. # CUSTOMISATION END #
  175. end #####################
  176. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  177. # #
  178. # http://dekitarpg.wordpress.com/ #
  179. # #
  180. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  181. #===============================================================================#
  182. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  183. # YES?\.\. #
  184. # OMG, REALLY? \| #
  185. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  186. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  187. #===============================================================================#
  188. module DataManager
  189. #===============================================================================
  190. #---------------------------------------------------------------------------
  191. # Alias List
  192. #---------------------------------------------------------------------------
  193. class << self
  194. alias :lbd_enemy_lv_stat :load_database
  195. end
  196. #---------------------------------------------------------------------------
  197. # Load Database (alias)
  198. #---------------------------------------------------------------------------
  199. def self.load_database
  200. lbd_enemy_lv_stat
  201. loa_enemy_lv_stat
  202. end
  203. #---------------------------------------------------------------------------
  204. # Load Unique Shit
  205. #---------------------------------------------------------------------------
  206. def self.loa_enemy_lv_stat
  207. for o in $data_enemies
  208. next if o == nil
  209. o.load__lv_up_stat
  210. end
  211. end
  212.  
  213. end # DataManager
  214.  
  215. #===============================================================================
  216. class RPG::Enemy < RPG::BaseItem
  217. #===============================================================================
  218. #---------------------------------------------------------------------------
  219. # Pi Variables
  220. #---------------------------------------------------------------------------
  221. attr_accessor :stat_set_id_EL
  222. #---------------------------------------------------------------------------
  223. # Load Level Stat Notes
  224. #---------------------------------------------------------------------------
  225. def load__lv_up_stat
  226. @stat_set_id_EL = Enemy_Control::LM_Default
  227. self.note.split(/[\r\n]+/).each do |line|
  228. case line
  229. when Enemy_Control::Notetag_C
  230. @stat_set_id_EL = $1.to_i
  231. end
  232. end
  233. end
  234.  
  235. end
  236.  
  237. #===============================================================================
  238. class RPG::Map
  239. #===============================================================================
  240. #-----------------------------------------------------------------------------
  241. # Level Range
  242. #-----------------------------------------------------------------------------
  243. def level_range
  244. if self.note =~ Enemy_Control::Notetag
  245. @level_range = [$1.to_i, $2.to_i]
  246. else
  247. @level_range = [Enemy_Control::Min_Level, Enemy_Control::Max_Level]
  248. end
  249. end
  250. #-----------------------------------------------------------------------------
  251. # Enemy Level Range
  252. #-----------------------------------------------------------------------------
  253. def enemy_level_range
  254. @enemy_level_range = []
  255. self.note.split(/[\r\n]+/).each do |line|
  256. case line
  257. when Enemy_Control::Notetag_B
  258. @enemy_level_range << [$1.to_i, $2.to_i, $3.to_i]
  259. end
  260. end
  261. return @enemy_level_range
  262. end
  263.  
  264. end
  265.  
  266. #===============================================================================
  267. class Game_Map
  268. #===============================================================================
  269. #-----------------------------------------------------------------------------
  270. # Level Range
  271. #-----------------------------------------------------------------------------
  272. def level_range
  273. return @map.level_range
  274. end
  275. #-----------------------------------------------------------------------------
  276. # Enemy Level Range
  277. #-----------------------------------------------------------------------------
  278. def enemy_level_range
  279. return @map.enemy_level_range
  280. end
  281.  
  282. end
  283.  
  284. #===============================================================================#
  285. class Game_Enemy < Game_Battler
  286. #===============================================================================#
  287. #-----------------------------------------------------------------------------
  288. # Pi Variables
  289. #-----------------------------------------------------------------------------
  290. attr_accessor :level
  291. #-----------------------------------------------------------------------------
  292. # Alias List
  293. #-----------------------------------------------------------------------------
  294. alias :init_enemy_levels :initialize
  295. alias :nme_exp_natures :exp
  296. alias :pokgold :gold
  297. #-----------------------------------------------------------------------------
  298. # Initialize
  299. #-----------------------------------------------------------------------------
  300. def initialize(index, enemy_id)
  301. init_enemy_levels(index, enemy_id)
  302. setup_enemy_level(enemy_id)
  303. doda_stat_inc_for_level
  304. @hp = mhp
  305. @mp = mmp
  306. # refresh
  307. p "Enemy Level is #{@level} ;; Hp = #{@hp}/#{mhp}"
  308. end
  309. #-----------------------------------------------------------------------------
  310. # Setup Enemy Levels
  311. #-----------------------------------------------------------------------------
  312. def setup_enemy_level(enemy_id)
  313. level = 1
  314. if $BTEST
  315. range = Enemy_Control::BattleTest_Level
  316. level = rand_between(range[0],range[1])
  317. else
  318. range = $game_map.level_range
  319. level = rand_between(range[0],range[1])
  320. $game_map.enemy_level_range.size.times do |i|
  321. checker = $game_map.enemy_level_range[i]
  322. next unless checker[0] == enemy_id
  323. level = rand_between(checker[1],checker[2])
  324. end
  325. end
  326. @level = [[level, Enemy_Control::Max_Level].min, Enemy_Control::Min_Level].max
  327. end
  328. #-----------------------------------------------------------------------------
  329. # Exp
  330. #-----------------------------------------------------------------------------
  331. def exp
  332. if Enemy_Control::Use_Exp_Gain_Formula
  333. _A = ((@level * 2) + 10)
  334. _B = (enemy.exp * @level / 5)
  335. _C = (@level + $game_party.battle_members[0].level + 10)
  336. val = ((_A)*(_A*_A).floor).floor*_B/((_C)*(_C*_C)).floor+1
  337. return val
  338. else
  339. return nme_exp_natures
  340. end
  341. end
  342. #-----------------------------------------------------------------------------
  343. # Gold
  344. #-----------------------------------------------------------------------------
  345. def gold
  346. if Enemy_Control::Use_Gold_Gain_Formula
  347. _A = ((@level * 2) + 10)
  348. _B = (enemy.gold * @level / 5)
  349. _C = (@level + $game_party.battle_members[0].level + 10)
  350. val = ((_A)*(_A*_A).floor).floor*_B/((_C)*(_C*_C)).floor+1
  351. return val
  352. else
  353. pokgold
  354. end
  355. end
  356. #---------------------------------------------------------------------------
  357. # Do Stat Increase
  358. #---------------------------------------------------------------------------
  359. def doda_stat_inc_for_level
  360. stat_set_type.each do |stat|
  361. case stat[0]
  362. when :param
  363. add_param(stat[1],(stat[2]*@level).to_i,false) if $D13x[:Stats_Control]
  364. when :x_param
  365. add_xparam(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Stats_Control]
  366. when :s_param
  367. add_sparam(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Stats_Control]
  368. when :atk_ele
  369. add_atk_ele(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Elems_Control]
  370. when :def_ele
  371. add_def_ele(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Elems_Control]
  372. when :atk_lvl
  373. add_atl((stat[1]*@level).to_i,false) if $D13x[:Atk_Def_Lvs]
  374. when :def_lvl
  375. add_dfl((stat[1]*@level).to_i,false) if $D13x[:Atk_Def_Lvs]
  376. when :max_tp
  377. add_max_tp((stat[1]*@level).to_i,false) if $D13x[:TP_Control]
  378. when :spds_stat
  379. add_spds_stats(stat[1],(stat[2]*@level).to_i,false) if $D13x[:ISPDS]
  380. end
  381. end
  382. # refresh
  383. end
  384. #---------------------------------------------------------------------------
  385. # Get Stat Increase Type
  386. #---------------------------------------------------------------------------
  387. def stat_set_type
  388. set = Enemy_Control::Level_Mod[enemy.stat_set_id_EL]
  389. set
  390. end
  391.  
  392. end
  393.  
  394. #==============================================================================#
  395. # http://dekitarpg.wordpress.com/ #
  396. #==============================================================================#
  397. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement