Advertisement
Dekita

pkene1.1

Nov 23rd, 2012
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.64 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.1
  3. ★ Pokémon 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. ================================================================================
  17. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  18. ================================================================================
  19. 1. You must give credit to "Dekita"
  20. 2. You are NOT allowed to repost this script.(or modified versions)
  21. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  22. 4. You are NOT allowed to use this script for Commercial games.
  23. 5. ENJOY!
  24.  
  25. "FINE PRINT"
  26. By using this script you hereby agree to the above terms and conditions,
  27. if any violation of the above terms occurs "legal action" may be taken.
  28. Not understanding the above terms and conditions does NOT mean that
  29. they do not apply to you.
  30. If you wish to discuss the terms and conditions in further detail you can
  31. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  32.  
  33. ================================================================================
  34. History:
  35. =========
  36. D /M /Y
  37. 16/11/2o12 - finished,
  38.  
  39. ================================================================================
  40. Credit and Thanks to :
  41. =======================
  42.  
  43. ================================================================================
  44. Known Bugs:
  45. ============
  46. N/A
  47.  
  48. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49. If a new bug is found please contact me at
  50. http://dekitarpg.wordpress.com/
  51.  
  52. ================================================================================
  53. INSTRUCTIONS:
  54. ==============
  55. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  56.  
  57. =end #==========================================================================#
  58. module Dekita__Pokemon_Enemies
  59.  
  60. # NOTETAGS :
  61.  
  62. # <lv: min, max>
  63. # <ene lv: enemy_id, min, max>
  64. # these go in map noteboxes, replace min with the maps minimum map level max
  65. # with the maximum,
  66. # enemy_id the enemy id in the database.
  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 = 100
  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. end
  87.  
  88. $imported = {} if $imported.nil?
  89. $imported[:Dekita_Pokémon_Enemies] = true
  90.  
  91. #################################################################################
  92. #################################################################################
  93. # As team rocket where once again "blasting off" Ash, Brock and Misty slowly #
  94. # lifted their bodies from the ground, turning, gasping at the horror they could#
  95. # see before them... #
  96. #################################################################################
  97. #################### !! DONT MODIFY SHIT AFTER HERE !! ##########################
  98. #################################################################################
  99. class RPG::Map
  100. #===============================================================================#
  101.  
  102. attr_accessor :map_level_range
  103. attr_accessor :map_level_rangeind_poks
  104.  
  105. def load_enemy_levels
  106. @map_level_range = [1, Dekita__Pokemon_Enemies::Max_Level]
  107. @map_level_rangeind_poks = []
  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. when /<ene lv: (.*), (.*), (.*)>/i
  114. @map_level_rangeind_poks.push([$1.to_i, $2.to_i, $3.to_i])
  115. #---
  116. p "PUSHED"
  117. end
  118. } # self.note.split
  119. end
  120.  
  121. end
  122.  
  123. #===============================================================================#
  124. class Game_Map
  125. #===============================================================================#
  126.  
  127. attr_reader :level_range_min
  128. attr_reader :level_range_max
  129. attr_reader :map_level_rangeind_poks
  130.  
  131. alias enemylevelsmapsetup setup
  132. def setup(map_id)
  133. enemylevelsmapsetup(map_id)
  134. @map.load_enemy_levels
  135. @level_range_min = @map.map_level_range[0]
  136. @level_range_max = @map.map_level_range[1]
  137. @map_level_rangeind_poks = @map.map_level_rangeind_poks
  138. p "@map_level_rangeind_poks = #{@map_level_rangeind_poks}"
  139. end
  140.  
  141. end
  142.  
  143. #===============================================================================#
  144. class Game_Temp
  145. #===============================================================================#
  146.  
  147. attr_accessor :fixed_level_battle
  148. attr_accessor :fixed_nature_battle
  149. attr_accessor :fixed_iv_battle
  150.  
  151. alias pokenemylvsgtinit initialize
  152. def initialize
  153. pokenemylvsgtinit
  154. init_fixed_enemies_info
  155. end
  156.  
  157. def init_fixed_enemies_info
  158. @fixed_level_battle = [false, 0]
  159. @fixed_nature_battle = [false, 0]
  160. @fixed_iv_battle = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  161. end
  162.  
  163. def clear_fixed_level_data
  164. @fixed_level_battle = [false, 0]
  165. end
  166.  
  167. def clear_fixed_nature_data
  168. @fixed_nature_battle = [false, 0]
  169. end
  170.  
  171. def clear_fixed_iv_data
  172. @fixed_iv_battle = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  173. end
  174.  
  175. end # Game_Temp
  176.  
  177. #===============================================================================#
  178. class Game_Enemy < Game_Battler
  179. #===============================================================================#
  180.  
  181. attr_accessor :level
  182. attr_accessor :nature
  183. attr_accessor :init_ivs
  184.  
  185. alias init_for_enemy_levels initialize
  186. def initialize(index, enemy_id)
  187. setup_enemies_pokestylee(enemy_id)
  188. init_for_enemy_levels(index, enemy_id)
  189. end
  190.  
  191. def setup_enemies_pokestylee(enemy_id)
  192. dekita_natures_for_enemies_agogo
  193. get_enemy_level(enemy_id)
  194. end
  195.  
  196. def dekita_natures_for_enemies_agogo
  197. return if !$imported[:Dekita_Pokémon_Natures]
  198. @init_ivs = [0] * 8
  199. @nature = get_rand_nature
  200. get_init_ivs
  201. end
  202.  
  203. def get_enemy_level(enemy_id)
  204. if $game_temp.fixed_level_battle[0] == true
  205. @level = $game_temp.fixed_level_battle[1]
  206. $game_temp.clear_fixed_level_data
  207. elsif $BTEST
  208. min = Dekita__Pokemon_Enemies::BattleTest_Level[0]
  209. max = Dekita__Pokemon_Enemies::BattleTest_Level[1]
  210. @level = (min+rand(max-min+1))
  211. else
  212. $game_map.map_level_rangeind_poks.size.times {|i|
  213. p "Checked"
  214. if $game_map.map_level_rangeind_poks[i][0] == enemy_id
  215. p "Returned"
  216. checker = $game_map.map_level_rangeind_poks[i]
  217. @level = (checker[1] + rand(checker[2] - checker[1]+1))
  218. else
  219. p "Not Returned"
  220. @level = ($game_map.level_range_min + rand($game_map.level_range_max - $game_map.level_range_min+1))
  221. end
  222. }
  223. end
  224. @level = [[@level, Dekita__Pokemon_Enemies::Max_Level].min, 1].max
  225. end
  226.  
  227. def fixed_enemy_level_for_map(check)
  228. checker = $game_map.map_level_rangeind_poks[check]
  229. @level = (checker[1] + rand(checker[2] - checker[1]+1))
  230. end
  231.  
  232. def get_init_ivs
  233. return get_fixed_ivs if $game_temp.fixed_iv_battle[0]
  234. p "Got enemies iv's RAND"
  235. 8.times {|i| @init_ivs[i] = (rand(Dekita__Pokémon_Nature::Max_IV_Amount+1))}
  236. end
  237.  
  238. def get_fixed_ivs
  239. p "Got enemies iv's FIXED"
  240. fixed_val = $game_temp.fixed_iv_battle
  241. 8.times {|i| @init_ivs[i] = fixed_val[i+1]}
  242. $game_temp.clear_fixed_iv_data
  243. end
  244.  
  245. def get_rand_nature
  246. t1_ = $game_temp.fixed_nature_battle[0]
  247. dnar = (Dekita__Pokémon_Nature::Nature.size)
  248. val = rand(dnar)
  249. if t1_
  250. val = $game_temp.fixed_nature_battle[1]
  251. $game_temp.clear_fixed_nature_data
  252. return Dekita__Pokémon_Nature::Nature[val]
  253. end
  254. return Dekita__Pokémon_Nature::Nature[val]
  255. end
  256.  
  257. alias enemiesparbase param_base
  258. def param_base(param_id)
  259. if $imported[:Dekita_Pokémon_Natures]
  260. par_id = param_id
  261. case par_id
  262. when 0, 1 # NOTE : if you change these calculations your a fucking moron ! ijs...
  263. return ( (((@init_ivs[par_id]+2*enemy.params[par_id]+(0/4))*@level/100)+10+@level)*@nature[par_id+1]).to_i
  264. when 2, 3, 4, 5, 6, 7
  265. return ( (((@init_ivs[par_id]+2*enemy.params[par_id]+(0/4))*@level/100)+5)*@nature[par_id+1]).to_i
  266. end
  267. else
  268. enemiesparbase(param_id)
  269. end
  270. end
  271.  
  272. alias pokgold gold
  273. def gold
  274. (@level * pokgold)
  275. end
  276.  
  277. end # Game_Enemy < Game_Battler
  278.  
  279. #==============================================================================
  280. class Game_Interpreter
  281. #==============================================================================
  282.  
  283. def fix_lv_battle(val)
  284. $game_temp.fixed_level_battle[0] = true
  285. $game_temp.fixed_level_battle[1] = val
  286. end
  287.  
  288. def fix_nature_battle(val)
  289. $game_temp.fixed_nature_battle[0] = true
  290. $game_temp.fixed_nature_battle[1] = val
  291. end
  292.  
  293. def fix_iv_battle(val_1,val_2,val_3,val_4,val_5,val_6,val_7,val_8)
  294. $game_temp.fixed_iv_battle[0] = true
  295. $game_temp.fixed_iv_battle[1] = val_1
  296. $game_temp.fixed_iv_battle[2] = val_2
  297. $game_temp.fixed_iv_battle[3] = val_3
  298. $game_temp.fixed_iv_battle[4] = val_4
  299. $game_temp.fixed_iv_battle[5] = val_5
  300. $game_temp.fixed_iv_battle[6] = val_6
  301. $game_temp.fixed_iv_battle[7] = val_7
  302. $game_temp.fixed_iv_battle[8] = val_8
  303. end
  304.  
  305. end # Game_Interpreter
  306.  
  307. #===============================================================================#
  308. # - SCRIPT END - #
  309. #===============================================================================#
  310. # http://dekitarpg.wordpress.com/ #
  311. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement