Advertisement
Dekita

$D13x - Enemy Levels 1.1

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