Advertisement
Dekita

enates

Nov 16th, 2012
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.83 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Enémy Natures™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This script replicates the natures / iv / levels feature from pokemon,
  9. e.g each pokemon, (in this case ENEMY) is given a random nature, iv value and
  10. level upon encounter, That enemies stats are then determined by that.
  11. Use map notetags toset enemy levels and use script calls to make fixed encounters
  12. e.g set nature iv and lvl.
  13.  
  14. NOTE: This works 100% like pokemon.
  15.  
  16. BIG_NOTE: This scrip requires My Pokemon Natures (actors) script
  17.  
  18. ================================================================================
  19. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  20. ================================================================================
  21. 1. You must give credit to "Dekita"
  22. 2. You are NOT allowed to repost this script.(or modified versions)
  23. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  24. 4. You are NOT allowed to use this script for Commercial games.
  25. 5. ENJOY!
  26.  
  27. "FINE PRINT"
  28. By using this script you hereby agree to the above terms and conditions,
  29. if any violation of the above terms occurs "legal action" may be taken.
  30. Not understanding the above terms and conditions does NOT mean that
  31. they do not apply to you.
  32. If you wish to discuss the terms and conditions in further detail you can
  33. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  34.  
  35. ================================================================================
  36. History:
  37. =========
  38. D /M /Y
  39. 16/11/2o12 - finished,
  40.  
  41. ================================================================================
  42. Credit and Thanks to :
  43. =======================
  44.  
  45. ================================================================================
  46. Known Bugs:
  47. ============
  48. N/A
  49.  
  50. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  51. If a new bug is found please contact me at
  52. http://dekitarpg.wordpress.com/
  53.  
  54. ================================================================================
  55. INSTRUCTIONS:
  56. ==============
  57. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  58.  
  59. =end #==========================================================================#
  60. module Dekita__Pokemon_Enemies
  61.  
  62.  
  63. # NOTETAGS :
  64.  
  65. # <lv: min, max>
  66. # these go in map noteboxes, replace min with the maps minimum map level max with the max
  67.  
  68. # SCRIPT CALLS :
  69. # fix_lv_battle(val)
  70. # fix_nature_battle(val)
  71. # fix_iv_battle(mhp, mmp, atk, def, mat, mdf, agi, luk)
  72.  
  73. # val = an integer
  74. # replace mhp, mmp, atk, def, mat, mdf, agi and luk with values between 0 - 31
  75. # and this will change that enemies iv values to whatever you set.
  76. # REMEMBER iv values are different from the acctual param value, but they do
  77. # affect param values
  78.  
  79. # The maximum level for enemies
  80. Max_Level = 99
  81.  
  82. # as enemy levels are based on maps and during battle test there is no map id,
  83. # you have to set the min and max level for enemies in test battles here.
  84. BattleTest_Level = [5, 10] # [min, max]
  85.  
  86. Gold_Inc = 0.10 # 0.10 % more gold each enemy level
  87.  
  88. end
  89.  
  90. $imported = {} if $imported.nil?
  91. $imported[:Dekita_Pokémon_Enemies] = true
  92.  
  93. #################################################################################
  94. #################################################################################
  95. # As team rocket where once again "blasting off" Ash, Brock and Misty slowly #
  96. # lifted their bodies from the ground, turning, gasping at the horror they could#
  97. # see before them... #
  98. #################################################################################
  99. #################### !! DONT MODIFY SHIT AFTER HERE !! ##########################
  100. #################################################################################
  101. class RPG::Map
  102. #===============================================================================#
  103.  
  104. attr_accessor :map_level_range
  105.  
  106. def load_enemy_levels
  107. @map_level_range = [1, Dekita__Pokemon_Enemies::Max_Level]
  108. self.note.split(/[\r\n]+/).each { |line|
  109. case line
  110. when /<lv: (.*), (.*)>/i
  111. @map_level_range = [$1.to_i, $2.to_i]
  112. #---
  113. end
  114. } # self.note.split
  115. end
  116.  
  117. end
  118.  
  119. #===============================================================================#
  120. class Game_Map
  121. #===============================================================================#
  122.  
  123. attr_reader :level_range_min
  124. attr_reader :level_range_max
  125.  
  126. alias enemylevelsmapsetup setup
  127. def setup(map_id)
  128. enemylevelsmapsetup(map_id)
  129. @map.load_enemy_levels
  130. @level_range_min = @map.map_level_range[0]
  131. @level_range_max = @map.map_level_range[1]
  132. end
  133.  
  134. end
  135.  
  136. #===============================================================================#
  137. class Game_Temp
  138. #===============================================================================#
  139.  
  140. attr_accessor :fixed_level_battle
  141. attr_accessor :fixed_nature_battle
  142. attr_accessor :fixed_iv_battle
  143.  
  144. alias pokenemylvsgtinit initialize
  145. def initialize
  146. pokenemylvsgtinit
  147. init_fixed_enemies_info
  148. end
  149.  
  150. def init_fixed_enemies_info
  151. @fixed_level_battle = [false, 0]
  152. @fixed_nature_battle = [false, 0]
  153. @fixed_iv_battle = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  154. end
  155.  
  156. def clear_fixed_level_data
  157. @fixed_level_battle = [false, 0]
  158. end
  159.  
  160. def clear_fixed_nature_data
  161. @fixed_nature_battle = [false, 0]
  162. end
  163.  
  164. def clear_fixed_iv_data
  165. @fixed_iv_battle = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  166. end
  167.  
  168. end # Game_Temp
  169.  
  170. #===============================================================================#
  171. class Game_Enemy < Game_Battler
  172. #===============================================================================#
  173.  
  174. attr_accessor :level
  175. attr_accessor :nature
  176. attr_accessor :init_ivs
  177.  
  178. alias init_for_enemy_levels initialize
  179. def initialize(index, enemy_id)
  180. setup_enemies_pokestylee
  181. init_for_enemy_levels(index, enemy_id)
  182. end
  183.  
  184. def setup_enemies_pokestylee
  185. dekita_natures_for_enemies_agogo
  186. get_enemy_level
  187. end
  188.  
  189. def dekita_natures_for_enemies_agogo
  190. return if !$imported[:Dekita_Pokémon_Natures]
  191. @init_ivs = [0] * 8
  192. @nature = get_rand_nature
  193. get_init_ivs
  194. end
  195.  
  196. def get_enemy_level
  197. if $game_temp.fixed_level_battle[0] == true
  198. @level = $game_temp.fixed_level_battle[1]
  199. $game_temp.clear_fixed_level_data
  200. elsif $BTEST
  201. min = Dekita__Pokemon_Enemies::BattleTest_Level[0]
  202. max = Dekita__Pokemon_Enemies::BattleTest_Level[1]
  203. @level = (min+rand(max-min+1))
  204. else
  205. @level = ($game_map.level_range_min + rand($game_map.level_range_max - $game_map.level_range_min+1))
  206. end
  207. @level = [[@level, Dekita__Pokemon_Enemies::Max_Level].min, 1].max
  208. end
  209.  
  210. def get_init_ivs
  211. return get_fixed_ivs if $game_temp.fixed_iv_battle[0]
  212. p "Got enemies iv's RAND"
  213. 8.times {|i| @init_ivs[i] = (rand(Dekita__Pokémon_Nature::Max_IV_Amount+1))}
  214. end
  215.  
  216. def get_fixed_ivs
  217. p "Got enemies iv's FIXED"
  218. fixed_val = $game_temp.fixed_iv_battle
  219. 8.times {|i| @init_ivs[i] = fixed_val[i+1]}
  220. $game_temp.clear_fixed_iv_data
  221. end
  222.  
  223. def get_rand_nature
  224. t1_ = $game_temp.fixed_nature_battle[0]
  225. dnar = (Dekita__Pokémon_Nature::Nature.size)
  226. val = rand(dnar)
  227. if t1_
  228. val = $game_temp.fixed_nature_battle[1]
  229. $game_temp.clear_fixed_nature_data
  230. return Dekita__Pokémon_Nature::Nature[val]
  231. end
  232. return Dekita__Pokémon_Nature::Nature[val]
  233. end
  234.  
  235. alias enemiesparbase param_base
  236. def param_base(param_id)
  237. if $imported[:Dekita_Pokémon_Natures]
  238. par_id = param_id
  239. case par_id
  240. when 0, 1 # NOTE : if you change these calculations your a fucking moron ! ijs...
  241. return ( (((@init_ivs[par_id]+2*enemy.params[par_id]+(0/4))*@level/100)+10+@level)*@nature[par_id+1]).to_i
  242. when 2, 3, 4, 5, 6, 7
  243. return ( (((@init_ivs[par_id]+2*enemy.params[par_id]+(0/4))*@level/100)+5)*@nature[par_id+1]).to_i
  244. end
  245. else
  246. enemiesparbase(param_id)
  247. end
  248. end
  249.  
  250. alias pokgold gold
  251. def gold
  252. @level.times(pokgold * Dekita__Pokemon_Enemies::Gold_Inc)
  253. end
  254.  
  255. end # Game_Enemy < Game_Battler
  256.  
  257. #==============================================================================
  258. class Game_Interpreter
  259. #==============================================================================
  260.  
  261. def fix_lv_battle(val)
  262. $game_temp.fixed_level_battle[0] = true
  263. $game_temp.fixed_level_battle[1] = val
  264. end
  265.  
  266. def fix_nature_battle(val)
  267. $game_temp.fixed_nature_battle[0] = true
  268. $game_temp.fixed_nature_battle[1] = val
  269. end
  270.  
  271. def fix_iv_battle(val_1,val_2,val_3,val_4,val_5,val_6,val_7,val_8)
  272. $game_temp.fixed_iv_battle[0] = true
  273. $game_temp.fixed_iv_battle[1] = val_1
  274. $game_temp.fixed_iv_battle[2] = val_2
  275. $game_temp.fixed_iv_battle[3] = val_3
  276. $game_temp.fixed_iv_battle[4] = val_4
  277. $game_temp.fixed_iv_battle[5] = val_5
  278. $game_temp.fixed_iv_battle[6] = val_6
  279. $game_temp.fixed_iv_battle[7] = val_7
  280. $game_temp.fixed_iv_battle[8] = val_8
  281. end
  282.  
  283. end # Game_Interpreter
  284.  
  285. #===============================================================================#
  286. # - SCRIPT END - #
  287. #===============================================================================#
  288. # http://dekitarpg.wordpress.com/ #
  289. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement