Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Carmaniac's Speech Bubbles for v18
- # Updated by Avery
- #-------------------------------------------------------------------------------
- # To use, call pbCallBub(type, eventID)
- #
- # Where type is either 1 or 2:
- # 1 - floating bubble
- # 2 - speech bubble with arrow
- #-------------------------------------------------------------------------------
- #PluginManager.register({
- # :name => "Speech Bubbles",
- # :version => "1.3",
- # :credits => ["Carmaniac","Avery","Boonzeet","Golisopod User"],
- # :link => "https://reliccastle.com/resources/461/"
- #})
- #-------------------------------------------------------------------------------
- # Class modifiers
- #-------------------------------------------------------------------------------
- class PokemonTemp
- attr_accessor :speechbubble_bubble
- attr_accessor :speechbubble_vp
- attr_accessor :speechbubble_arrow
- attr_accessor :speechbubble_outofrange
- attr_accessor :speechbubble_talking
- end
- module MessageConfig
- if defined?($PokemonTemp.speechbubble_bubble) && $PokemonTemp.speechbubble_bubble > 0
- type = $PokemonTemp.speechbubble_bubble
- if type == 1 || type == 3
- LIGHT_TEXT_MAIN_COLOR = Color.new(80, 80, 88)
- LIGHT_TEXT_SHADOW_COLOR = Color.new(160, 160, 168)
- DARK_TEXT_MAIN_COLOR = Color.new(80, 80, 88)
- DARK_TEXT_SHADOW_COLOR = Color.new(160, 160, 168)
- end
- end
- end
- #-------------------------------------------------------------------------------
- # Function modifiers
- #-------------------------------------------------------------------------------
- class Window_AdvancedTextPokemon
- def text=(value)
- if value != nil && value != "" && $PokemonTemp.speechbubble_bubble && $PokemonTemp.speechbubble_bubble > 0
- type = $PokemonTemp.speechbubble_bubble
- if type == 1 || type == 3
- $PokemonTemp.speechbubble_bubble = 0
- self.height = 100
- self.width = 480
- if type == 1
- @x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x
- @y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y - (32 + @height)
- else
- @x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x - (@width/2)
- @y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y - 50 - @height
- end
- if @y>(Graphics.height-@height-2)
- @y = (Graphics.height-@height)
- end
- if @y<2
- if type == 1
- @y=2
- else
- @y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y + 16
- end
- end
- if @x = Graphics.width - @width - 2 #@x>(Graphics.width-@width-2)
- @x = ($game_map.events[$PokemonTemp.speechbubble_talking].screen_x-(@width/2))
- end
- if @x<2
- @x=2
- end
- else
- $PokemonTemp.speechbubble_bubble = 0
- end
- end
- setText(value)
- end
- end
- def pbRepositionMessageWindow(msgwindow, linecount=2)
- msgwindow.height=32*linecount+msgwindow.borderY
- msgwindow.y=(Graphics.height)-(msgwindow.height)
- if $game_temp && $game_temp.in_battle && !$scene.respond_to?("update_basic")
- msgwindow.y=0
- elsif $game_system && $game_system.respond_to?("message_position")
- case $game_system.message_position
- when 0 # up
- msgwindow.y=0
- when 1 # middle
- msgwindow.y=(Graphics.height/2)-(msgwindow.height/2)
- when 2
- if $PokemonTemp.speechbubble_bubble && $PokemonTemp.speechbubble_bubble > 0
- msgwindow.setSkin("Graphics/Windowskins/frlgtextskin")
- msgwindow.baseColor = MessageConfig::DARK_TEXT_MAIN_COLOR
- msgwindow.shadowColor = MessageConfig::DARK_TEXT_SHADOW_COLOR
- end
- case $PokemonTemp.speechbubble_bubble
- when 1
- msgwindow.height = 100
- msgwindow.width = 400
- when 2
- msgwindow.height = 102
- msgwindow.width = Graphics.width
- if $game_player.direction==8
- $PokemonTemp.speechbubble_vp = Viewport.new(0, 0, Graphics.width, 280)
- msgwindow.y = 6
- else
- $PokemonTemp.speechbubble_vp = Viewport.new(0, 6 + msgwindow.height, Graphics.width, 280)
- msgwindow.y = (Graphics.height - msgwindow.height) - 6
- if $PokemonTemp.speechbubble_outofrange==true
- msgwindow.y = 6
- end
- end
- when 3
- msgwindow.height = 300
- msgwindow.width = 600
- else
- msgwindow.height = 102
- msgwindow.y = Graphics.height - msgwindow.height - 6
- end
- end
- end
- if $game_system && $game_system.respond_to?("message_frame")
- if $game_system.message_frame != 0
- msgwindow.opacity = 0
- end
- end
- if $game_message
- case $game_message.background
- when 1,2 # dim, transparent
- msgwindow.opacity=0
- end
- end
- end
- def pbCreateMessageWindow(viewport=nil,skin=nil)
- #@directory = "Graphics/Pictures/"
- arrow = nil
- if $PokemonTemp.speechbubble_bubble==2 && $game_map.events[$PokemonTemp.speechbubble_talking] != nil # Message window set to floating bubble.
- if $game_player.direction==8 # Player facing up, message window top.
- $PokemonTemp.speechbubble_vp = Viewport.new(0, 100, Graphics.width, 300) #104, 280
- $PokemonTemp.speechbubble_vp.z = 999999
- arrow = Sprite.new($PokemonTemp.speechbubble_vp)
- arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x - Graphics.width
- arrow.y = ($game_map.events[$PokemonTemp.speechbubble_talking].screen_y - Graphics.height) - 216
- arrow.z = 999999
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow4")
- arrow.zoom_x = 2
- arrow.zoom_y = 2
- if arrow.x<-230
- arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow3")
- end
- else # Player facing left, down, right, message window bottom.
- $PokemonTemp.speechbubble_vp = Viewport.new(0, 0, Graphics.width, 284)
- $PokemonTemp.speechbubble_vp.z = 999999
- arrow = Sprite.new($PokemonTemp.speechbubble_vp)
- arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x
- arrow.y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y - 8
- arrow.z = 999999
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow1")
- if arrow.y>=Graphics.height-120 # Change arrow direction.
- $PokemonTemp.speechbubble_outofrange=true
- $PokemonTemp.speechbubble_vp.rect.y+=104
- arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x - Graphics.width
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow4")
- arrow.y = ($game_map.events[$PokemonTemp.speechbubble_talking].screen_y - Graphics.height) - 136
- if arrow.x<-250
- arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow3")
- end
- if arrow.x>=256
- arrow.x -= 15 # $game_map.events[$PokemonTemp.speechbubble_talking].screen_x-Graphics.width
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow3")
- end
- else
- $PokemonTemp.speechbubble_outofrange=false
- end
- arrow.zoom_x = 2
- arrow.zoom_y = 2
- end
- elsif $PokemonTemp.speechbubble_bubble==3 && $game_map.events[$PokemonTemp.speechbubble_talking] != nil # Message window set to floating bubble.
- $PokemonTemp.speechbubble_vp = Viewport.new(0, 0, Graphics.width, Graphics.height)
- $PokemonTemp.speechbubble_vp.z = 999999
- if Graphics.height/3>$game_map.events[$PokemonTemp.speechbubble_talking].screen_y-32
- arrow = Sprite.new($PokemonTemp.speechbubble_vp)
- arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x-16#arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x - Graphics.width
- arrow.y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y+4#arrow.y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y - Graphics.height
- arrow.z = 999999
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow6")
- else
- arrow = Sprite.new($PokemonTemp.speechbubble_vp)
- arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x#arrow.x = $game_map.events[$PokemonTemp.speechbubble_talking].screen_x - Graphics.width
- arrow.y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y-60#arrow.y = $game_map.events[$PokemonTemp.speechbubble_talking].screen_y - Graphics.height
- arrow.z = 999999
- arrow.y-=1 if ($PokemonSystem.screensize==2)
- arrow.bitmap = Bitmap.new("Graphics/Pictures/Arrow5")
- end
- end
- $PokemonTemp.speechbubble_arrow = arrow
- $game_temp.message_window = Window_AdvancedTextPokemon.new("")
- msgwindow=$game_temp.message_window
- if !viewport
- msgwindow.z=99999
- else
- msgwindow.viewport=viewport
- end
- msgwindow.visible=true
- msgwindow.letterbyletter=true
- msgwindow.back_opacity=MessageConfig::WINDOW_OPACITY
- pbBottomLeftLines(msgwindow,2)
- $game_temp.message_window_showing=true if $game_temp
- $game_message.visible=true if $game_message
- skin=MessageConfig.pbGetSpeechFrame() if !skin
- msgwindow.setSkin(skin)
- return msgwindow
- end
- def pbDisposeMessageWindow(msgwindow)
- $game_temp.message_window_showing=false if $game_temp
- $game_message.visible=false if $game_message
- $game_temp.message_window.dispose if $game_temp.message_window
- msgwindow.dispose
- $PokemonTemp.speechbubble_arrow.dispose if $PokemonTemp.speechbubble_arrow
- $PokemonTemp.speechbubble_vp.dispose if $PokemonTemp.speechbubble_vp
- end
- def pbCallBub(status=0,value=0)
- $PokemonTemp.speechbubble_talking=get_character(value).id
- $PokemonTemp.speechbubble_bubble=status
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement