Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=============================================================================
- # * Crystal Engine - VS Sequence
- #------------------------------------------------------------------------------
- # Current Version: 1.05
- #=============================================================================
- $imported = {} if $imported.nil?
- $imported["CE-VSSequence"] = true
- =begin
- with this script you can have it so that you could call a VS Sequence prior to
- a battle
- to call a sequence use the script call
- call_vs_sequence(x, y, z, name1, name2)
- the values are
- x => the id of the sequence 1 = normal, 2 = gym leader, 3 = elite 4
- y => the id of the first trainer
- z => the id of the second trainer
- to call one going into a battle use
- call_vs_battle(x, y, z, name1, name2, troop_id, can_escape, can_lose)
- =end
- #==============================================================================
- # Editing beyond this point may cause stone, zombie, mist frenzy, and/or toad,
- # so edit at your own risk.
- #==============================================================================
- module CRYSTAL
- module CHECK
- #--------------------------------------------------------------------------
- # * Checks if you have a certain script installed
- #--------------------------------------------------------------------------
- def self.require(self_name, script, site = "http://crystalnoel42.wordpress.com")
- unless $imported["CE-BasicModule"]
- msg = "The script '#{self_name}' requires the latest\n"
- msg += "version of 'Crystal Engine - Basic Module' to work properly\n"
- msg += "Go to http://crystalnoel42.wordpress.com/ to download this script."
- raise SyntaxError.new(msg)
- end
- unless $imported[script]
- msg = "The script '#{self_name}' requires the latest\n"
- msg += "version of #{scripts_list(script)} to work properly\n"
- msg += "Go to #{site} to download this script."
- raise SyntaxError.new(msg)
- end
- end
- require("Crystal Engine - VS Sequence", "CE-BasicModule")
- end
- end
- #==============================================================================
- # ** BattleManager
- #------------------------------------------------------------------------------
- # This module manages battle progress.
- #==============================================================================
- module BattleManager
- #--------------------------------------------------------------------------
- # * Processing at Encounter Time
- #--------------------------------------------------------------------------
- class <<self; alias ce_vs_sequence_on_encounter on_encounter; end
- def self.on_encounter
- ce_vs_sequence_on_encounter
- save_bgm_and_bgs
- play_battle_bgm
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # An interpreter for executing event commands. This class is used within the
- # Game_Map, Game_Troop, and Game_Event classes.
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Run a VS Sequence
- #--------------------------------------------------------------------------
- def call_vs_sequence(type, t1, t2, name1, name2)
- SceneManager.scene.message_window.openness = 0
- if SceneManager.scene.message_window.atsmo_all_windows.is_a?(Array)
- SceneManager.scene.message_window.atsmo_all_windows.each do |window|
- window.openness = 0
- end
- end
- case type
- when 1
- viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
- count=0
- value=2
- value2=2
- bar1=Sprite.new(@viewport)
- bar1.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
- bar1.y=126 + ((Graphics.height - 384) / 2)
- bar1.x=Graphics.width
- bar1.z=100000
- bar2=Sprite.new(@viewport)
- bar2.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
- bar2.y=126 + ((Graphics.height - 384) / 2)
- bar2.x=Graphics.width*2
- bar2.z=100000
- face=Sprite.new(@viewport)
- face.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t2}.png")
- face.x=Graphics.width
- face.y=126 + ((Graphics.height - 384) / 2)
- face.z=100001
- face.color=Color.new(0,0,0,255)
- vs=Sprite.new(@viewport)
- vs.bitmap=Cache.load_bitmap("Graphics/VS/","VS.png")
- vs.x=150 + ((Graphics.width - 512) / 2)
- vs.y=138 + ((Graphics.height - 384) / 2)
- vs.z=100002
- vs.visible=false
- baseColor=Color.new(248,248,248)
- shadowColor=Color.new(104,88,112)
- 140.times do
- if count>=20
- if face.x>256
- face.x-=36
- end
- end
- if count==51
- text = Sprite.new(viewport)
- text.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- x = 282 + ((Graphics.width - 512) / 2)
- y = 264 + ((Graphics.height - 384) / 2)
- text.bitmap.draw_text(x,y,Graphics.width,24,sprintf("%s",name2))
- face.color=Color.new(0,0,0,0)
- vs.visible=true
- end
- if bar1.x<=-Graphics.width
- bar1.x=Graphics.width
- end
- if bar2.x<=-Graphics.width
- bar2.x=Graphics.width
- end
- if count>=51
- if vs.y==136 + ((Graphics.height - 384) / 2)
- value=2
- end
- if vs.y==140 + ((Graphics.height - 384) / 2)
- value=-2
- end
- if vs.x==148 + ((Graphics.width - 512) / 2)
- value2=2
- end
- if vs.x==152 + ((Graphics.width - 512) / 2)
- value2=-2
- end
- vs.y+=value
- vs.x+=value2
- end
- bar1.x-=64
- bar2.x-=64
- count+=1
- Graphics.update
- end
- when 2
- viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
- baseColor=Color.new(248,248,248)
- shadowColor=Color.new(12*6,12*6,12*6)
- viewplayer=Viewport.new(0,Graphics.height/3,Graphics.width/2,128)
- viewplayer.z=viewport.z
- viewopp=Viewport.new(Graphics.width/2,Graphics.height/3,Graphics.width/2,128)
- viewopp.z=viewport.z
- viewvs=Viewport.new(0,0,Graphics.width,Graphics.height)
- viewvs.z=viewport.z
- xoffset=(Graphics.width/2)/10
- xoffset=xoffset.round
- xoffset=xoffset*10
- fade=Sprite.new(viewport)
- fade.bitmap=Cache.load_bitmap("Graphics/VS/","flash")
- fade.tone=Tone.new(-255,-255,-255)
- fade.opacity=100
- overlay=Sprite.new(viewport)
- overlay.bitmap=Bitmap.new(Graphics.width,Graphics.height)
- bar1=Sprite.new(viewplayer)
- bar1.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t1}")
- bar1.x=-xoffset
- bar2=Sprite.new(viewopp)
- bar2.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t2}")
- bar2.x=xoffset
- vs=Sprite.new(viewvs)
- vs.bitmap=Cache.load_bitmap("Graphics/VS/","vs_gym")
- vs.ox=vs.bitmap.width/2
- vs.oy=vs.bitmap.height/2
- vs.x=Graphics.width/2
- vs.y=Graphics.height/1.5
- vs.z += 100
- vs.visible=false
- flash=Sprite.new(viewvs)
- flash.bitmap=Cache.load_bitmap("Graphics/VS/","flash")
- flash.opacity=0
- 10.times do
- bar1.x+=xoffset/10
- bar2.x-=xoffset/10
- Graphics.update
- end
- Audio.se_play('Audio/SE/Flash2', 100, 100)
- Audio.se_play('Audio/SE/Sword2', 100, 100)
- bar1=Sprite.new(viewplayer)
- bar1.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t1}")
- player=Sprite.new(viewplayer)
- player.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t1}")
- player.x=-xoffset
- bar2=Sprite.new(viewopp)
- bar2.bitmap=Cache.load_bitmap("Graphics/VS/","bar_#{t2}")
- trainer=Sprite.new(viewopp)
- trainer.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t2}")
- trainer.x=xoffset
- trainer.tone=Tone.new(-255,-255,-255)
- 15.times do
- flash.opacity-=51
- bar1.ox-=16
- bar2.ox+=16
- Graphics.update
- end
- 10.times do
- bar1.ox-=16
- bar2.ox+=16
- Graphics.update
- end
- 11.times do
- bar1.ox-=16
- player.x+=xoffset/10
- trainer.x-=xoffset/10
- bar2.ox+=16
- Graphics.update
- end
- 2.times do
- bar1.ox-=16
- player.x-=xoffset/20
- trainer.x+=xoffset/20
- bar2.ox+=16
- Graphics.update
- end
- 10.times do
- bar1.ox-=16
- bar2.ox+=16
- Graphics.update
- end
- val=2
- flash.opacity=255
- vs.visible=true
- trainer.tone=Tone.new(0,0,0)
- text1 = Sprite.new
- text2 = Sprite.new
- text1.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- text2.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- text1.bitmap.draw_text(Graphics.width/4,(Graphics.height/1.5)+10,Graphics.width,24,sprintf("%s",name1))
- text2.bitmap.draw_text((Graphics.width/4)+(Graphics.width/2),(Graphics.height/1.5)+10,Graphics.width,24,sprintf("%s",name2))
- Audio.se_play('Audio/SE/Sword2', 100, 100)
- 10.times do
- flash.opacity-=25.5
- vs.x+=val
- vs.y-=val
- val=2 if vs.x<=(Graphics.width / 2)-2
- val=-2 if vs.x>=(Graphics.width / 2)+2
- bar1.ox-=16
- bar2.ox+=16
- Graphics.update
- end
- 60.times do
- vs.x+=val
- vs.y-=val
- val=2 if vs.x<=(Graphics.width / 2)-2
- val=-2 if vs.x>=(Graphics.width / 2)+2
- bar1.ox-=16
- bar2.ox+=16
- Graphics.update
- end
- 30.times do
- bar1.ox-=16
- bar2.ox+=16
- vs.zoom_x+=0.2
- vs.zoom_y+=0.2
- Graphics.update
- end
- flash.tone=Tone.new(-255,-255,-255)
- 10.times do
- flash.opacity+=25.5
- bar1.ox-=16
- bar2.ox+=16
- Graphics.update
- end
- when 3
- viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
- count=0
- value=2
- value2=2
- bar1=Sprite.new(@viewport)
- bar1.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
- bar1.y=53 + ((Graphics.height - 384) / 2)
- bar1.x=Graphics.width
- bar1.z=100000
- bar2=Sprite.new(@viewport)
- bar2.bitmap=Cache.load_bitmap("Graphics/VS/","full_bar_#{t2}.png")
- bar2.y=53 + ((Graphics.height - 384) / 2)
- bar2.x=Graphics.width*2
- bar2.z=100000
- bar3=Sprite.new(@viewport)
- bar3.bitmap=Cache.load_bitmap("Graphics/VS/",sprintf("full_bar_%s.png",t1))
- bar3.y=224 - ((Graphics.height - 384) / 2)
- bar3.x=-Graphics.width
- bar3.z=100000
- bar4=Sprite.new(@viewport)
- bar4.bitmap=Cache.load_bitmap("Graphics/VS/",sprintf("full_bar_%s.png",t1))
- bar4.y=224 - ((Graphics.height - 384) / 2)
- bar4.x=-Graphics.width*2
- bar4.z=100000
- face=Sprite.new(@viewport)
- face.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t2}.png")
- face.x=Graphics.width
- face.y=53 + ((Graphics.height - 384) / 2)
- face.z=100001
- face.color=Color.new(0,0,0,255)
- face2=Sprite.new(@viewport)
- face2.bitmap=Cache.load_bitmap("Graphics/VS/","trainer_#{t1}.png")
- face2.x=-Graphics.width
- face2.y=224 - ((Graphics.height - 384) / 2)
- face2.z=100001
- face2.color=Color.new(0,0,0,255)
- vs=Sprite.new(@viewport)
- vs.bitmap=Cache.load_bitmap("Graphics/VS/","VS.png")
- vs.x=150 + ((Graphics.width - 512) / 2)
- vs.y=138 + ((Graphics.height - 384) / 2)
- vs.z=100002
- vs.visible=false
- baseColor=Color.new(248,248,248)
- shadowColor=Color.new(104,88,112)
- 140.times do
- if count>=20
- if face.x>Graphics.width / 2
- face.x-=36
- end
- if face2.x<0
- face2.x+=36
- end
- end
- if count==51
- text = Sprite.new(viewport)
- text.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- text.bitmap.draw_text(292,201,Graphics.width,24,sprintf("%s",name2))
- face.color=Color.new(0,0,0,0)
- vs.visible=true
- text2 = Sprite.new(viewport)
- text2.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- text2.bitmap.draw_text(172,352,Graphics.width,24,sprintf("%s",name1))
- text2.z=100002
- face2.color=Color.new(0,0,0,0)
- end
- if bar1.x<=-Graphics.width
- bar1.x=Graphics.width
- end
- if bar2.x<=-Graphics.width
- bar2.x=Graphics.width
- end
- if bar3.x>=Graphics.width
- bar3.x=-Graphics.width
- end
- if bar4.x>=Graphics.width
- bar4.x=-Graphics.width
- end
- if count>=51
- if vs.y==136 + ((Graphics.height - 384) / 2)
- value=2
- end
- if vs.y==140 + ((Graphics.height - 384) / 2)
- value=-2
- end
- if vs.x==148 + ((Graphics.width - 512) / 2)
- value2=2
- end
- if vs.x==152 + ((Graphics.width - 512) / 2)
- value2=-2
- end
- vs.y+=value
- vs.x+=value2
- end
- bar1.x-=64
- bar2.x-=64
- bar3.x+=64
- bar4.x+=64
- count+=1
- Graphics.update
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Battle Processing
- #--------------------------------------------------------------------------
- def command_301
- return if $game_party.in_battle
- if @params[0] == 0 # Direct designation
- troop_id = @params[1]
- elsif @params[0] == 1 # Designation with variables
- troop_id = $game_variables[@params[1]]
- else # Map-designated troop
- troop_id = $game_player.make_encounter_troop_id
- end
- if $data_troops[troop_id]
- BattleManager.setup(troop_id, @params[2], @params[3])
- BattleManager.event_proc = Proc.new {|n| @branch[@indent] = n }
- BattleManager.save_bgm_and_bgs
- BattleManager.play_battle_bgm
- $game_player.make_encounter_count
- SceneManager.call(Scene_Triad_Album)
- end
- Fiber.yield
- end
- #--------------------------------------------------------------------------
- # * Run a VS Leading into a battle
- #--------------------------------------------------------------------------
- def call_vs_battle(type, t1, t2, name1, name2, troop_id, can_escape = false, can_lose = false)
- return if $game_party.in_battle
- if $data_troops[troop_id]
- @calling_vs_battle = true
- BattleManager.setup(troop_id, can_escape, can_lose)
- BattleManager.event_proc = Proc.new {|n| @branch[@indent] = n }
- BattleManager.save_bgm_and_bgs
- BattleManager.play_battle_bgm
- call_vs_sequence(type, t1, t2, name1, name2)
- $game_player.make_encounter_count
- SceneManager.call(Scene_Triad_Album)
- end
- Fiber.yield
- end
- end
- #==============================================================================
- # ** Window_Message
- #------------------------------------------------------------------------------
- # This message window is used to display text.
- #==============================================================================
- class Window_Message < Window_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :atsmo_all_windows # The extra windows
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # This class performs the map screen processing.
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # * Preprocessing for Battle Screen Transition
- #--------------------------------------------------------------------------
- def pre_battle_scene
- Graphics.update
- Graphics.freeze
- @spriteset.dispose_characters
- Sound.play_battle_start
- end
- end
- #==============================================================================
- # ■ Scene_Debug
- #==============================================================================
- class Scene_Debug < Scene_MenuBase
- #--------------------------------------------------------------------------
- # new method: on_battle_ok
- #--------------------------------------------------------------------------
- def on_battle_ok
- troop_id = @battle_window.current_ext
- BattleManager.setup(troop_id)
- BattleManager.on_encounter
- BattleManager.save_bgm_and_bgs
- BattleManager.play_battle_bgm
- SceneManager.call(Scene_Triad_Album)
- Sound.play_battle_start
- end
- end
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement