Advertisement
Raizen

Untitled

Jan 16th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.79 KB | None | 0 0
  1.  
  2. #=============================================================================
  3. # * Crystal Engine - VS Sequence
  4. #------------------------------------------------------------------------------
  5. # Current Version: 1.05
  6. #=============================================================================
  7. $imported = {} if $imported.nil?
  8. $imported["CE-VSSequence"] = true
  9. =begin
  10. with this script you can have it so that you could call a VS Sequence prior to
  11. a battle
  12. to call a sequence use the script call
  13. call_vs_sequence(x, y, z, name1, name2)
  14. the values are
  15. x => the id of the sequence 1 = normal, 2 = gym leader, 3 = elite 4
  16. y => the id of the first trainer
  17. z => the id of the second trainer
  18. to call one going into a battle use
  19. call_vs_battle(x, y, z, name1, name2, troop_id, can_escape, can_lose)
  20. =end
  21. #==============================================================================
  22. # Editing beyond this point may cause stone, zombie, mist frenzy, and/or toad,
  23. # so edit at your own risk.
  24. #==============================================================================
  25. module CRYSTAL
  26. module CHECK
  27. #--------------------------------------------------------------------------
  28. # * Checks if you have a certain script installed
  29. #--------------------------------------------------------------------------
  30. def self.require(self_name, script, site = "http://crystalnoel42.wordpress.com")
  31. unless $imported["CE-BasicModule"]
  32. msg = "The script '#{self_name}' requires the latest\n"
  33. msg += "version of 'Crystal Engine - Basic Module' to work properly\n"
  34. msg += "Go to http://crystalnoel42.wordpress.com/ to download this script."
  35. raise SyntaxError.new(msg)
  36. end
  37. unless $imported[script]
  38. msg = "The script '#{self_name}' requires the latest\n"
  39. msg += "version of #{scripts_list(script)} to work properly\n"
  40. msg += "Go to #{site} to download this script."
  41. raise SyntaxError.new(msg)
  42. end
  43. end
  44. require("Crystal Engine - VS Sequence", "CE-BasicModule")
  45. end
  46. end
  47. #==============================================================================
  48. # ** BattleManager
  49. #------------------------------------------------------------------------------
  50. # This module manages battle progress.
  51. #==============================================================================
  52.  
  53. module BattleManager
  54. #--------------------------------------------------------------------------
  55. # * Processing at Encounter Time
  56. #--------------------------------------------------------------------------
  57. class <<self; alias ce_vs_sequence_on_encounter on_encounter; end
  58. def self.on_encounter
  59. ce_vs_sequence_on_encounter
  60. save_bgm_and_bgs
  61. play_battle_bgm
  62. end
  63. end
  64. #==============================================================================
  65. # ** Game_Interpreter
  66. #------------------------------------------------------------------------------
  67. # An interpreter for executing event commands. This class is used within the
  68. # Game_Map, Game_Troop, and Game_Event classes.
  69. #==============================================================================
  70.  
  71. class Game_Interpreter
  72. #--------------------------------------------------------------------------
  73. # * Run a VS Sequence
  74. #--------------------------------------------------------------------------
  75. def call_vs_sequence(type, t1, t2, name1, name2)
  76. SceneManager.scene.message_window.openness = 0
  77. if SceneManager.scene.message_window.atsmo_all_windows.is_a?(Array)
  78. SceneManager.scene.message_window.atsmo_all_windows.each do |window|
  79. window.openness = 0
  80. end
  81. end
  82. case type
  83. when 1
  84. viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  85. count=0
  86. value=2
  87. value2=2
  88. bar1=Sprite.new(@viewport)
  89. bar1.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
  90. bar1.y=126 + ((Graphics.height - 384) / 2)
  91. bar1.x=Graphics.width
  92. bar1.z=100000
  93. bar2=Sprite.new(@viewport)
  94. bar2.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
  95. bar2.y=126 + ((Graphics.height - 384) / 2)
  96. bar2.x=Graphics.width*2
  97. bar2.z=100000
  98. face=Sprite.new(@viewport)
  99. face.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t2}.png")
  100. face.x=Graphics.width
  101. face.y=126 + ((Graphics.height - 384) / 2)
  102. face.z=100001
  103. face.color=Color.new(0,0,0,255)
  104. vs=Sprite.new(@viewport)
  105. vs.bitmap=Cache.load_bitmap("Graphics/VS/","VS.png")
  106. vs.x=150 + ((Graphics.width - 512) / 2)
  107. vs.y=138 + ((Graphics.height - 384) / 2)
  108. vs.z=100002
  109. vs.visible=false
  110. baseColor=Color.new(248,248,248)
  111. shadowColor=Color.new(104,88,112)
  112. 140.times do
  113. if count>=20
  114. if face.x>256
  115. face.x-=36
  116. end
  117. end
  118. if count==51
  119. text = Sprite.new(viewport)
  120. text.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  121. x = 282 + ((Graphics.width - 512) / 2)
  122. y = 264 + ((Graphics.height - 384) / 2)
  123. text.bitmap.draw_text(x,y,Graphics.width,24,sprintf("%s",name2))
  124. face.color=Color.new(0,0,0,0)
  125. vs.visible=true
  126. end
  127. if bar1.x<=-Graphics.width
  128. bar1.x=Graphics.width
  129. end
  130. if bar2.x<=-Graphics.width
  131. bar2.x=Graphics.width
  132. end
  133. if count>=51
  134. if vs.y==136 + ((Graphics.height - 384) / 2)
  135. value=2
  136. end
  137. if vs.y==140 + ((Graphics.height - 384) / 2)
  138. value=-2
  139. end
  140. if vs.x==148 + ((Graphics.width - 512) / 2)
  141. value2=2
  142. end
  143. if vs.x==152 + ((Graphics.width - 512) / 2)
  144. value2=-2
  145. end
  146. vs.y+=value
  147. vs.x+=value2
  148. end
  149. bar1.x-=64
  150. bar2.x-=64
  151. count+=1
  152. Graphics.update
  153. end
  154. when 2
  155. viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  156. baseColor=Color.new(248,248,248)
  157. shadowColor=Color.new(12*6,12*6,12*6)
  158. viewplayer=Viewport.new(0,Graphics.height/3,Graphics.width/2,128)
  159. viewplayer.z=viewport.z
  160. viewopp=Viewport.new(Graphics.width/2,Graphics.height/3,Graphics.width/2,128)
  161. viewopp.z=viewport.z
  162. viewvs=Viewport.new(0,0,Graphics.width,Graphics.height)
  163. viewvs.z=viewport.z
  164. xoffset=(Graphics.width/2)/10
  165. xoffset=xoffset.round
  166. xoffset=xoffset*10
  167.  
  168. fade=Sprite.new(viewport)
  169. fade.bitmap=Cache.load_bitmap("Graphics/VS/","flash")
  170. fade.tone=Tone.new(-255,-255,-255)
  171. fade.opacity=100
  172. overlay=Sprite.new(viewport)
  173. overlay.bitmap=Bitmap.new(Graphics.width,Graphics.height)
  174.  
  175. bar1=Sprite.new(viewplayer)
  176. bar1.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t1}")
  177. bar1.x=-xoffset
  178. bar2=Sprite.new(viewopp)
  179. bar2.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t2}")
  180. bar2.x=xoffset
  181.  
  182. vs=Sprite.new(viewvs)
  183. vs.bitmap=Cache.load_bitmap("Graphics/VS/","vs_gym")
  184. vs.ox=vs.bitmap.width/2
  185. vs.oy=vs.bitmap.height/2
  186. vs.x=Graphics.width/2
  187. vs.y=Graphics.height/1.5
  188. vs.z += 100
  189. vs.visible=false
  190.  
  191. flash=Sprite.new(viewvs)
  192. flash.bitmap=Cache.load_bitmap("Graphics/VS/","flash")
  193. flash.opacity=0
  194.  
  195. 10.times do
  196. bar1.x+=xoffset/10
  197. bar2.x-=xoffset/10
  198. Graphics.update
  199. end
  200. Audio.se_play('Audio/SE/Flash2', 100, 100)
  201. Audio.se_play('Audio/SE/Sword2', 100, 100)
  202. bar1=Sprite.new(viewplayer)
  203. bar1.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t1}")
  204. player=Sprite.new(viewplayer)
  205. player.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t1}")
  206. player.x=-xoffset
  207. bar2=Sprite.new(viewopp)
  208. bar2.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t2}")
  209. trainer=Sprite.new(viewopp)
  210. trainer.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t2}")
  211. trainer.x=xoffset
  212. trainer.tone=Tone.new(-255,-255,-255)
  213. 15.times do
  214. flash.opacity-=51
  215. bar1.ox-=16
  216. bar2.ox+=16
  217. Graphics.update
  218. end
  219. 10.times do
  220. bar1.ox-=16
  221. bar2.ox+=16
  222. Graphics.update
  223. end
  224. 11.times do
  225. bar1.ox-=16
  226. player.x+=xoffset/10
  227. trainer.x-=xoffset/10
  228. bar2.ox+=16
  229. Graphics.update
  230. end
  231. 2.times do
  232. bar1.ox-=16
  233. player.x-=xoffset/20
  234. trainer.x+=xoffset/20
  235. bar2.ox+=16
  236. Graphics.update
  237. end
  238. 10.times do
  239. bar1.ox-=16
  240. bar2.ox+=16
  241. Graphics.update
  242. end
  243. val=2
  244. flash.opacity=255
  245. vs.visible=true
  246. trainer.tone=Tone.new(0,0,0)
  247. text1 = Sprite.new
  248. text2 = Sprite.new
  249. text1.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  250. text2.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  251. text1.bitmap.draw_text(Graphics.width/4,(Graphics.height/1.5)+10,Graphics.width,24,sprintf("%s",name1))
  252. text2.bitmap.draw_text((Graphics.width/4)+(Graphics.width/2),(Graphics.height/1.5)+10,Graphics.width,24,sprintf("%s",name2))
  253. Audio.se_play('Audio/SE/Sword2', 100, 100)
  254. 10.times do
  255. flash.opacity-=25.5
  256. vs.x+=val
  257. vs.y-=val
  258. val=2 if vs.x<=(Graphics.width / 2)-2
  259. val=-2 if vs.x>=(Graphics.width / 2)+2
  260. bar1.ox-=16
  261. bar2.ox+=16
  262. Graphics.update
  263. end
  264. 60.times do
  265. vs.x+=val
  266. vs.y-=val
  267. val=2 if vs.x<=(Graphics.width / 2)-2
  268. val=-2 if vs.x>=(Graphics.width / 2)+2
  269. bar1.ox-=16
  270. bar2.ox+=16
  271. Graphics.update
  272. end
  273. 30.times do
  274. bar1.ox-=16
  275. bar2.ox+=16
  276. vs.zoom_x+=0.2
  277. vs.zoom_y+=0.2
  278. Graphics.update
  279. end
  280. flash.tone=Tone.new(-255,-255,-255)
  281. 10.times do
  282. flash.opacity+=25.5
  283. bar1.ox-=16
  284. bar2.ox+=16
  285. Graphics.update
  286. end
  287. when 3
  288. viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  289. count=0
  290. value=2
  291. value2=2
  292. bar1=Sprite.new(@viewport)
  293. bar1.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
  294. bar1.y=53 + ((Graphics.height - 384) / 2)
  295. bar1.x=Graphics.width
  296. bar1.z=100000
  297. bar2=Sprite.new(@viewport)
  298. bar2.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
  299. bar2.y=53 + ((Graphics.height - 384) / 2)
  300. bar2.x=Graphics.width*2
  301. bar2.z=100000
  302. bar3=Sprite.new(@viewport)
  303. bar3.bitmap=Cache.load_bitmap("Graphics/VS/",sprintf("full_bar_%s.png",t1))
  304. bar3.y=224 - ((Graphics.height - 384) / 2)
  305. bar3.x=-Graphics.width
  306. bar3.z=100000
  307. bar4=Sprite.new(@viewport)
  308. bar4.bitmap=Cache.load_bitmap("Graphics/VS/",sprintf("full_bar_%s.png",t1))
  309. bar4.y=224 - ((Graphics.height - 384) / 2)
  310. bar4.x=-Graphics.width*2
  311. bar4.z=100000
  312. face=Sprite.new(@viewport)
  313. face.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t2}.png")
  314. face.x=Graphics.width
  315. face.y=53 + ((Graphics.height - 384) / 2)
  316. face.z=100001
  317. face.color=Color.new(0,0,0,255)
  318. face2=Sprite.new(@viewport)
  319. face2.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t1}.png")
  320. face2.x=-Graphics.width
  321. face2.y=224 - ((Graphics.height - 384) / 2)
  322. face2.z=100001
  323. face2.color=Color.new(0,0,0,255)
  324. vs=Sprite.new(@viewport)
  325. vs.bitmap=Cache.load_bitmap("Graphics/VS/","VS.png")
  326. vs.x=150 + ((Graphics.width - 512) / 2)
  327. vs.y=138 + ((Graphics.height - 384) / 2)
  328. vs.z=100002
  329. vs.visible=false
  330. baseColor=Color.new(248,248,248)
  331. shadowColor=Color.new(104,88,112)
  332. 140.times do
  333. if count>=20
  334. if face.x>Graphics.width / 2
  335. face.x-=36
  336. end
  337. if face2.x<0
  338. face2.x+=36
  339. end
  340. end
  341. if count==51
  342. text = Sprite.new(viewport)
  343. text.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  344. text.bitmap.draw_text(292,201,Graphics.width,24,sprintf("%s",name2))
  345. face.color=Color.new(0,0,0,0)
  346. vs.visible=true
  347. text2 = Sprite.new(viewport)
  348. text2.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  349. text2.bitmap.draw_text(172,352,Graphics.width,24,sprintf("%s",name1))
  350. text2.z=100002
  351. face2.color=Color.new(0,0,0,0)
  352. end
  353. if bar1.x<=-Graphics.width
  354. bar1.x=Graphics.width
  355. end
  356. if bar2.x<=-Graphics.width
  357. bar2.x=Graphics.width
  358. end
  359. if bar3.x>=Graphics.width
  360. bar3.x=-Graphics.width
  361. end
  362. if bar4.x>=Graphics.width
  363. bar4.x=-Graphics.width
  364. end
  365. if count>=51
  366. if vs.y==136 + ((Graphics.height - 384) / 2)
  367. value=2
  368. end
  369. if vs.y==140 + ((Graphics.height - 384) / 2)
  370. value=-2
  371. end
  372. if vs.x==148 + ((Graphics.width - 512) / 2)
  373. value2=2
  374. end
  375. if vs.x==152 + ((Graphics.width - 512) / 2)
  376. value2=-2
  377. end
  378. vs.y+=value
  379. vs.x+=value2
  380. end
  381. bar1.x-=64
  382. bar2.x-=64
  383. bar3.x+=64
  384. bar4.x+=64
  385. count+=1
  386. Graphics.update
  387. end
  388. end
  389. end
  390. #--------------------------------------------------------------------------
  391. # * Battle Processing
  392. #--------------------------------------------------------------------------
  393. def command_301
  394. return if $game_party.in_battle
  395. if @params[0] == 0 # Direct designation
  396. troop_id = @params[1]
  397. elsif @params[0] == 1 # Designation with variables
  398. troop_id = $game_variables[@params[1]]
  399. else # Map-designated troop
  400. troop_id = $game_player.make_encounter_troop_id
  401. end
  402. if $data_troops[troop_id]
  403. BattleManager.setup(troop_id, @params[2], @params[3])
  404. BattleManager.event_proc = Proc.new {|n| @branch[@indent] = n }
  405. BattleManager.save_bgm_and_bgs
  406. BattleManager.play_battle_bgm
  407. $game_player.make_encounter_count
  408. SceneManager.call(Scene_Triad_Album)
  409. end
  410. Fiber.yield
  411. end
  412. #--------------------------------------------------------------------------
  413. # * Run a VS Leading into a battle
  414. #--------------------------------------------------------------------------
  415. def call_vs_battle(type, t1, t2, name1, name2, troop_id, can_escape = false, can_lose = false)
  416. return if $game_party.in_battle
  417. if $data_troops[troop_id]
  418. @calling_vs_battle = true
  419. BattleManager.setup(troop_id, can_escape, can_lose)
  420. BattleManager.event_proc = Proc.new {|n| @branch[@indent] = n }
  421. BattleManager.save_bgm_and_bgs
  422. BattleManager.play_battle_bgm
  423. call_vs_sequence(type, t1, t2, name1, name2)
  424. $game_player.make_encounter_count
  425. SceneManager.call(Scene_Triad_Album)
  426. end
  427. Fiber.yield
  428. end
  429. end
  430. #==============================================================================
  431. # ** Window_Message
  432. #------------------------------------------------------------------------------
  433. # This message window is used to display text.
  434. #==============================================================================
  435.  
  436. class Window_Message < Window_Base
  437. #--------------------------------------------------------------------------
  438. # * Public Instance Variables
  439. #--------------------------------------------------------------------------
  440. attr_accessor :atsmo_all_windows # The extra windows
  441. end
  442. #==============================================================================
  443. # ** Scene_Map
  444. #------------------------------------------------------------------------------
  445. # This class performs the map screen processing.
  446. #==============================================================================
  447.  
  448. class Scene_Map < Scene_Base
  449. #--------------------------------------------------------------------------
  450. # * Preprocessing for Battle Screen Transition
  451. #--------------------------------------------------------------------------
  452. def pre_battle_scene
  453. Graphics.update
  454. Graphics.freeze
  455. @spriteset.dispose_characters
  456. Sound.play_battle_start
  457. end
  458. end
  459. #==============================================================================
  460. # ■ Scene_Debug
  461. #==============================================================================
  462.  
  463. class Scene_Debug < Scene_MenuBase
  464. #--------------------------------------------------------------------------
  465. # new method: on_battle_ok
  466. #--------------------------------------------------------------------------
  467. def on_battle_ok
  468. troop_id = @battle_window.current_ext
  469. BattleManager.setup(troop_id)
  470. BattleManager.on_encounter
  471. BattleManager.save_bgm_and_bgs
  472. BattleManager.play_battle_bgm
  473. SceneManager.call(Scene_Triad_Album)
  474. Sound.play_battle_start
  475. end
  476. end
  477. #==============================================================================
  478. #
  479. # ▼ End of File
  480. #
  481. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement