Advertisement
Dekita

Untitled

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