Advertisement
Dekita

elev1.2

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