Advertisement
Dekita

Battle Trans

Jan 8th, 2013
1,758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.44 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Battle Transitions™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This script allows for multiple battle transitions.
  9. It also allows for each transition to have its own "battle start" sound.
  10. Each map can be given its own set of transitions using notetags.
  11. Transitions are random.
  12. (you can fix the next battles transition with a simple script call.)
  13.  
  14. ================================================================================
  15. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  16. ================================================================================
  17. 1. You must give credit to "Dekita"
  18. 2. You are NOT allowed to repost this script.(or modified versions)
  19. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  20. 4. You are NOT allowed to use this script for Commercial games.
  21. 5. ENJOY!
  22.  
  23. "FINE PRINT"
  24. By using this script you hereby agree to the above terms and conditions,
  25. if any violation of the above terms occurs "legal action" may be taken.
  26. Not understanding the above terms and conditions does NOT mean that
  27. they do not apply to you.
  28. If you wish to discuss the terms and conditions in further detail you can
  29. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  30.  
  31. ================================================================================
  32. History:
  33. =========
  34. D /M /Y
  35. 06/01/2o13 - started && finished,
  36.  
  37. ================================================================================
  38. INSTRUCTIONS:
  39. ==============
  40. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  41. Simply put your transition graphic in the "Graphics/System" folder
  42. and fill in the details in the customisation module.
  43.  
  44.  
  45. ================================================================================
  46. NOTETAGS : (MAP Notebox)
  47. ===========
  48. <trans: id>
  49. replace id with the id of the transition this map has.
  50. maps can have multiple transitions (as many as you want),
  51. simply put a comma , after each id number like so...
  52. <trans: id, id, id, id, id, id, id, id, id, id, id> ect..
  53.  
  54. ================================================================================
  55. SCRIPT CALLS :
  56. ==============
  57. set_battle_trans(id)
  58. Replace id with the Trans[id] of the transition you want.
  59. This will make the next transition the one you select.
  60.  
  61. =end #==========================================================================#
  62. module Battle_Transitions
  63. Trans=[]# Do Not Delete.
  64.  
  65. Use_Script = true
  66.  
  67. Use_Transition_Sounds = true
  68.  
  69. # Default is 10, i didnt like it ^_^
  70. Battle_Trans_Speed = 0 # (transition after entering battle).
  71.  
  72. # Trans[id]= [Duration, "NAME" Vauge, "Sound", Volume, Pitch]
  73. Trans[0] = [100, "BattleStart", 100, "Battle1", 80, 100]
  74. Trans[1] = [150, "BattleStart", 50, "Battle2", 80, 100]
  75. Trans[2] = [ 50, "BattleStart", 150, "Battle3", 80, 100]
  76. Trans[3] = [100, "BattleStart", 100, "Attack1", 80, 100]
  77. ##
  78. # Duration = number of frames the transition will last.
  79. # The default for battles is 100.
  80. #--
  81. # Vague = the ambiguity of the borderline between the graphic's
  82. # starting and ending points. The larger the value, the greater the ambiguity.
  83. # The default for battles is 100.
  84. #--
  85. # Sound = the sound effect to use for this transition.
  86. # Volume = the volume for the sound used.
  87. # Pitch = the pitch for the sound used.
  88. #--
  89. # You can add more lines like so...
  90. # Trans[id] = [Duration, "NAME" Vauge, "Sound", Volume, Pitch]
  91. ###
  92.  
  93. Dekitas_Option = false
  94. # This is an option i have included for my own project.
  95. # if this is true each time a battle is encountered the game will
  96. # try to find a battlestart image with the above name +
  97. # Graphics_width x Graphics_height
  98. # e.g B1-640x384 , B2-576x352.
  99. # i reccomend making this false unless your game can have
  100. # multiple screen sizes.
  101.  
  102. end #####################
  103. # CUSTOMISATION END #
  104. #####################
  105. #===============================================================================#
  106. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  107. # #
  108. # http://dekitarpg.wordpress.com/ #
  109. # #
  110. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  111. #===============================================================================#
  112. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  113. # YES?\.\. #
  114. # OMG, REALLY? \| #
  115. # WELL SLAP MY FACE AND CALL ME A DITTO.\..\.. #
  116. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  117. #===============================================================================#
  118. module Sound
  119. #===============================================================================#
  120.  
  121. if Battle_Transitions::Use_Transition_Sounds
  122. def self.play_battle_start
  123. end
  124. end
  125.  
  126. end
  127.  
  128. #===============================================================================#
  129. class RPG::Map
  130. #===============================================================================#
  131.  
  132. attr_reader(:b_trans_set)
  133.  
  134. def get_battle_trans
  135. @b_trans_set = Battle_Transitions::Trans
  136. self.note.split(/[\r\n]+/).each { |line|
  137. case line ;
  138. when /<(?:TRANS|trans):[ ](\d+(?:\s*,\s*\d+)*)>/i
  139. @b_trans_set = []
  140. bts = Battle_Transitions::Trans
  141. $1.scan(/\d+/).each {|num|@b_trans_set.push(bts[num.to_i]) if num.to_i > 0 ;}
  142. end ; } # self.note.split
  143. end
  144.  
  145. end
  146.  
  147. #===============================================================================#
  148. class Game_Temp
  149. #===============================================================================#
  150.  
  151. attr_accessor :set_battle_trans
  152.  
  153. alias :i_gt_4_bts_DPBz :initialize
  154. def initialize
  155. i_gt_4_bts_DPBz
  156. @set_battle_trans = [false, nil]
  157. end
  158.  
  159. end
  160.  
  161. #===============================================================================#
  162. class Game_Map
  163. #===============================================================================#
  164.  
  165. attr_reader(:trans_set)
  166.  
  167. alias :bt_4_gm_DPBz__ :setup
  168. def setup(map_id)
  169. bt_4_gm_DPBz__(map_id)
  170. setup_this_maps_battle_transitions
  171. end
  172.  
  173. def setup_this_maps_battle_transitions
  174. @map.get_battle_trans
  175. @trans_set = @map.b_trans_set
  176. end
  177.  
  178. end
  179.  
  180. #===============================================================================#
  181. class Game_Interpreter
  182. #===============================================================================#
  183.  
  184. def set_battle_trans(id)
  185. $game_temp.set_battle_trans = [true, id]
  186. end
  187.  
  188. end
  189.  
  190. #===============================================================================#
  191. class Scene_Map < Scene_Base
  192. #===============================================================================#
  193.  
  194. alias :pbt_random_trans :perform_battle_transition
  195. def perform_battle_transition(*args, &block)
  196. if !Battle_Transitions::Use_Script
  197. pbt_random_trans(*args, &block)
  198. else
  199. dekitas_battle_trans
  200. end
  201. end
  202.  
  203. def dekitas_battle_trans
  204. t = rand_b_trans
  205. spd = t[0]
  206. tra = t[1] + add_g_wid
  207. vag = t[2]
  208. if Battle_Transitions::Use_Transition_Sounds
  209. sound = t[3]
  210. volum = t[4]
  211. pitch = t[5]
  212. Audio.se_play("Audio/SE/" + sound, volum, pitch)
  213. end
  214. Graphics.transition(spd, "Graphics/System/" + tra, vag)
  215. Graphics.freeze
  216. end
  217.  
  218. def rand_b_trans
  219. if $game_temp.set_battle_trans[0]
  220. mod = Battle_Transitions::Trans
  221. val = $game_temp.set_battle_trans[1]
  222. $game_temp.set_battle_trans = [false, nil]
  223. id = mod[val]
  224. else
  225. mod = $game_map.trans_set
  226. val = rand(mod.size)
  227. id = mod[val]
  228. end
  229. id
  230. end
  231.  
  232. def add_g_wid
  233. return "" unless Battle_Transitions::Dekitas_Option
  234. voc = "#{Graphics.width.to_s}x#{Graphics.height.to_s}"
  235. return voc
  236. end
  237.  
  238. end
  239.  
  240. #==============================================================================
  241. class Scene_Battle < Scene_Base
  242. #==============================================================================
  243.  
  244. alias :ts_4_rand_trans :transition_speed
  245. def transition_speed
  246. if !Battle_Transitions::Use_Script
  247. return ts_4_rand_trans
  248. else
  249. return Battle_Transitions::Battle_Trans_Speed
  250. end
  251. end
  252.  
  253. end
  254.  
  255. #==============================================================================#
  256. # - SCRIPT END - #
  257. #==============================================================================#
  258. # http://dekitarpg.wordpress.com/ #
  259. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement