Advertisement
Dekita

shinies

Nov 16th, 2012
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.15 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Pokémon Shinies™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This script replicates the shiny feature from pokemon, e.g each pokemon,
  9. (in this case actors/enemies) can randomly be a shiny ( more rare ) version
  10. of that actor/enemy, in pokemon its only the actors/enemies
  11. graphics that change, but i have included extra options...
  12.  
  13. ================================================================================
  14. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  15. ================================================================================
  16. 1. You must give credit to "Dekita"
  17. 2. You are NOT allowed to repost this script.(or modified versions)
  18. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  19. 4. You are NOT allowed to use this script for Commercial games.
  20. 5. ENJOY!
  21.  
  22. "FINE PRINT"
  23. By using this script you hereby agree to the above terms and conditions,
  24. if any violation of the above terms occurs "legal action" may be taken.
  25. Not understanding the above terms and conditions does NOT mean that
  26. they do not apply to you.
  27. If you wish to discuss the terms and conditions in further detail you can
  28. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  29.  
  30. ================================================================================
  31. History:
  32. =========
  33. D /M /Y
  34. 13/11/2o12 - started and finished,
  35.  
  36. ================================================================================
  37. Credit and Thanks to :
  38. =======================
  39.  
  40. ================================================================================
  41. Known Bugs:
  42. ============
  43. N/A
  44.  
  45. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46. If a new bug is found please contact me at
  47. http://dekitarpg.wordpress.com/
  48.  
  49. ================================================================================
  50. INSTRUCTIONS:
  51. ==============
  52. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  53.  
  54. ================================================================================
  55. Notetags:
  56. ==========
  57. ACTOR NOTETAGS:
  58.  
  59. <shiny char name: STRING>
  60. <shiny char index: INDEX>
  61. <shiny face name: STRING>
  62. <shiny face index: INDEX>
  63.  
  64. STIRNG = the name of the file in either the Graphics/characters or
  65. Graphics/faces folders #################
  66. # 0 | 1 | 2 | 3 #
  67. INDEX = the index of the file graphic ( 0 - 7 ) #---+---+---+---#
  68. # 4 | 5 | 6 | 7 #
  69. #################
  70. ENEMY NOTETAGS:
  71.  
  72. <shiny graphic: STRING>
  73. <shiny hue: VALUE>
  74. STRING = the name of the enemy graphic in the Graphics/Battlers folder
  75. VALUE = a value between 0 - 360
  76.  
  77. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  78. Examples:
  79. Actor:~
  80. <shiny char name: $bulbasaur shiny>
  81. <shiny char index: 0>
  82. <shiny face name: $bulbasaur shiny face>
  83. <shiny face index: 0>
  84.  
  85. Enemy:~
  86. <shiny graphic: Bat>
  87. <shiny hue: 180>
  88.  
  89. =end #==========================================================================#
  90. module Dekita__Pokemon_Shinies
  91.  
  92. # you will have a 1 in Shiny_Chance, chance for an actor to be a shiny upon
  93. # entering the party
  94. Shiny_Chance = 8192
  95.  
  96. # If you are using the actor natures, iv's and ev's script you can
  97. # make your shinies have a chance at gaining a shiny only nature
  98. Shiny_Nature = []# <- DO NOT DELETE.
  99.  
  100. # Make this false if you do not want to have shiny natures.
  101. Use_Shiny_Natures = true
  102.  
  103. Shiny_Nature_Chance = 100 # 100 = 100% chance
  104.  
  105. # NOTE: nature multipliers are percentage values, this means that
  106. # 1.1 = 110% 0.9 = 90% 0.01 = 1%
  107. # 1 is the default, any stats you do not want modified make sure they are 1.
  108.  
  109. #Shiny_Nature[id]=[ Name, mhp, mmp, atk, def, mat, mdf, agi, luk]
  110. Shiny_Nature[0] = ["Epic 1", 1.2, 1.2, 1, 1.2, 1, 1.2, 1, 1]
  111. Shiny_Nature[1] = ["Epic 2", 1, 1, 1.2, 1, 1.2, 1, 1.2, 1.2]
  112. Shiny_Nature[2] = ["Epic 3", 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1]
  113. Shiny_Nature[3] = ["Epic 4", 1.4, 1, 1.2, 1.2, 1, 1, 1, 1]
  114.  
  115. end
  116.  
  117. $imported = {} if $imported.nil?
  118. $imported[:Dekita_Pokémon_Shinies] = true
  119.  
  120. #==============================================================================
  121. module DataManager
  122. #==============================================================================
  123.  
  124. class <<self; alias load_database_SHINIES load_database; end
  125. def self.load_database
  126. load_database_SHINIES
  127. load_SHINIES
  128. end
  129.  
  130. def self.load_SHINIES
  131. groups = [$data_actors, $data_enemies]
  132. for group in groups
  133. for obj in group
  134. next if obj.nil?
  135. obj.load_SHINIES
  136. end
  137. end
  138. end
  139.  
  140. end # DataManager
  141.  
  142. #==============================================================================
  143. class RPG::Actor < RPG::BaseItem
  144. #==============================================================================
  145.  
  146. attr_accessor :shiny_char_name
  147. attr_accessor :shiny_char_index
  148. attr_accessor :shiny_face_name
  149. attr_accessor :shiny_face_index
  150.  
  151. def load_SHINIES
  152. @shiny_char_name = @character_name
  153. @shiny_char_index = @character_index
  154. @shiny_face_name = @face_name
  155. @shiny_face_index = @face_index
  156. self.note.split(/[\r\n]+/).each { |line|
  157. case line
  158. when /<shiny char name: (.*)>/i
  159. @shiny_char_name = $1.to_s
  160. #---
  161. when /<shiny char index: (.*)>/i
  162. @shiny_char_index = $1.to_i
  163. #---
  164. when /<shiny face name: (.*)>/i
  165. @shiny_face_name = $1.to_s
  166. #---
  167. when /<shiny face index: (.*)>/i
  168. @shiny_face_index = $1.to_i
  169. #---
  170. end
  171. } # self.note.split
  172. end
  173.  
  174. end
  175.  
  176. #==============================================================================
  177. class RPG::Enemy < RPG::BaseItem
  178. #==============================================================================
  179.  
  180. attr_accessor :shiny_image
  181. attr_accessor :shiny_hue
  182.  
  183. def load_SHINIES
  184. @shiny_image = @battler_name
  185. @shiny_hue = @battler_hue
  186. self.note.split(/[\r\n]+/).each { |line|
  187. case line
  188. when /<shiny graphic: (.*)>/i
  189. @shiny_image = $1.to_s
  190. #---
  191. when /<shiny hue: (.*)>/i
  192. @shiny_hue = $1.to_i
  193. #---
  194. end
  195. } # self.note.split
  196. end
  197.  
  198. end
  199.  
  200. #===============================================================================#
  201. class Game_Temp
  202. #===============================================================================#
  203.  
  204. attr_accessor :fix_nature_battle_SHINY
  205. attr_accessor :fix_iv_battle_SHINY
  206.  
  207. alias pokenemylvsgt_SHINYinit initialize
  208. def initialize
  209. pokenemylvsgt_SHINYinit
  210. init_fixed__SHINY_info
  211. end
  212.  
  213. def init_fixed__SHINY_info
  214. @fix_nature_battle_SHINY = [false, 0]
  215. @fix_iv_battle_SHINY = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  216. end
  217.  
  218. def clear_fixed_nature_data_SHINY
  219. @fix_nature_battle_SHINY = [false, 0, 0]
  220. end
  221.  
  222. def clear_fixed_iv_data_SHINY
  223. @fix_iv_battle_SHINY = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  224. end
  225.  
  226. end # Game_Temp
  227. #==============================================================================
  228. class Game_Actor < Game_Battler
  229. #==============================================================================
  230.  
  231. attr_reader :shiny
  232.  
  233. alias Poké_SHINIES_A_GO_GO setup
  234. def setup(actor_id)
  235. Poké_SHINIES_A_GO_GO(actor_id)
  236. @shiny = is_a_shiny
  237. recover_all
  238. end
  239.  
  240. def is_a_shiny
  241. value = rand(Dekita__Pokemon_Shinies::Shiny_Chance+1)
  242. if value == 1
  243. setup_shiny
  244. return true
  245. else
  246. return false
  247. end
  248. end
  249.  
  250. def setup_shiny
  251. charname = actor.shiny_char_name
  252. charindex = actor.shiny_char_index
  253. facename = actor.shiny_face_name
  254. faceindex = actor.shiny_face_index
  255. set_graphic(charname, charindex, facename, faceindex)
  256. @nature = get_shinies_nature if Dekita__Pokemon_Shinies::Use_Shiny_Natures
  257. end
  258.  
  259. def get_shinies_nature
  260. return unless $imported[:Dekita_Pokémon_Natures]
  261. randomness = (1 + rand(100))
  262. return if randomness > Dekita__Pokemon_Shinies::Shiny_Nature_Chance
  263. dnar = (Dekita__Pokemon_Shinies::Shiny_Nature.size)
  264. val = rand(dnar)
  265. p "Got Rare nature #{Dekita__Pokemon_Shinies::Shiny_Nature[val][0]}"
  266. return Dekita__Pokemon_Shinies::Shiny_Nature[val]
  267. end
  268.  
  269. end
  270.  
  271. #===============================================================================#
  272. class Game_Enemy < Game_Battler
  273. #===============================================================================#
  274.  
  275. alias init_for_enemy_shiny initialize
  276. def initialize(index, enemy_id)
  277. init_for_enemy_shiny(index, enemy_id)
  278. @shiny = is_a_shiny
  279. end
  280.  
  281. def is_a_shiny
  282. value = rand(Dekita__Pokemon_Shinies::Shiny_Chance+1)
  283. if value == 1
  284. setup_shiny
  285. return true
  286. else
  287. return false
  288. end
  289. end
  290.  
  291. def setup_shiny
  292. @battler_name = enemy.shiny_image
  293. @battler_hue = enemy.shiny_hue
  294. end
  295.  
  296. end # Game_Enemy < Game_Battler
  297.  
  298. #==============================================================================
  299. class Game_Interpreter
  300. #==============================================================================
  301.  
  302. def fix_shiny_battle(val)
  303. $game_temp.fixed_level_battle[0] = true
  304. $game_temp.fixed_level_battle[1] = val
  305. end
  306.  
  307. def fix_nature_battle(val)
  308. $game_temp.fixed_nature_battle[0] = true
  309. $game_temp.fixed_nature_battle[1] = val
  310. end
  311.  
  312. end # Game_Interpreter
  313.  
  314. #===============================================================================#
  315. # - SCRIPT END - #
  316. #===============================================================================#
  317. # http://dekitarpg.wordpress.com/ #
  318. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement