######################################################
#
# ____ _ _
# | _ \ | \ | |
# | |[I]) |[/I] _ _______| \| | __ ___ __
# | _ <| | | |_ /_ / . [ICODE] |/ _[/ICODE] \ \ / /
# | |[I]) | |[/I]| |/ / / /| |\ | (_| |\ V /
# |[B]__/ \[/B],[I]/__[/I]/[B][I]|[/I]| \_|\[/B],[I]| \[/I]/
#
# By Henry
# Original Script: henrythefiend
# v19 Port: Judge Creep#6725
# v21 preliminary Port: AenaonDusky
#
#
######################################################
# _____ __
# |_ _| / _|
# | | _ __ | |_ ___
# | | | '_ \| _/ _ \
# [I]| |[/I]| | | | || (_) |
# |_____|[I]| |[/I]|[I]| \__[/I]/
#
#
# To call the BuzzNav, use pbBuzzNav
#
# To add a new Buzz, add one in the "BUZZ" list.
#
# !!!NO BUZZ SHOULD SHARE IDS!!!
#
# Buzz.new(ID, Text, Icon, Speaker, Active)
#
# Icon can be found in Graphics/Pictures/BuzzNav/Icons
# Presenters can be found in Graphics/Pictures/BuzzNav/Presenters
#
# Active has to be true or false. To turn a Buzz on or off,
# use pbSetBuzz(ID, Active).
#
#
# To change an existing Buzz's text without going into this menu,
# use pbSetBuzzTxt(ID, "Buzz Text")
#
#
# To add variables to the text, like a trainer name, go to the
# variables section at the bottom and look at examples.
#
######################################################
# _____ _ _ _
# / ____| | | | | (_)
# | ([B]_ _[/B]| |[I]| |[/I] _ _ __ __ _ ___
# \___ \ / _ \ __| __| | '_ \ / [I]` / _[/I]|
# [B]__) | __/ |[I]| |[/I]| | | | | (_| \[/B] \
# |_____/ \[B]_|\[/B]|\[B]|[I]|[/I]| |_|\[/B], |___/
# __/ |
# |___/
#
# USE_BGM should be on if you want to use BGM.
# BGM should be the name of your BGM. Only works
# if USE_BGM is on.
# When REPEAT is false, a Buzz won't appear after that
# same buzz appears. Example: If REPEAT is false, and you've
# got Buzz 1, 2, and 3 active, 1 will only happen after 2 or 3,
# never after another 1. Same goes with 2 only happening after
# 1 and 3, and 3 happening after 1 and 2.
USE_BGM = false
BGM = "Gate"
REPEAT = false
#
######################################################
#==============================================
# Setting up the Class
#==============================================
class Buzz
attr_accessor :id
attr_accessor :buzztxt
attr_accessor :icon
attr_accessor :presenter
attr_accessor :active
def initialize(id, buzztxt, icon, presenter, active)
self.id = id
self.buzztxt = buzztxt
self.icon = icon
self.presenter = presenter
self.active = active
end
end
#=========================================================
# Adding an attribute that can be accessed to Player class
#=========================================================
class Player
attr_accessor :buzz
def buzz
if !@BUZZ
@BUZZ = [
Buzz.new(1,"According to recent reports","iconchatter","ann1",false),
Buzz.new(2,"I like Pokémon!","iconcatch","ann2",false),
Buzz.new(3,"I found a Pokémon.","iconexplore","ann3",false),
Buzz.new(4,"I'm a shopaholic.","iconmart","ann4",false),
Buzz.new(5,"I like to battle.","icontrainer","ann5",false),
Buzz.new(6,"Our region is great.","iconregion","ann1",true),
Buzz.new(7,"Your name is {1} and you have {2} Pokémon.","icontrainer","ann2",true),
Buzz.new(8,"Your name is {1} and you have seen {2} Pokémon.","icontrainer","ann4",true)
]
end
return @BUZZ
end
end
#==============================================
# Look through in $player and Prepare Buzzes
#==============================================
def pbSetBuzz(id, active)
$player.buzz.each{|b|
if b.id==id
b.active=active
break
end
}
end
# Set buzz text
def pbSetBuzzTxt(id, buzztxt)
$player.buzz.each{|b|
if b.id==id
b.buzztxt=buzztxt
break
end
}
end
# Set buzz icon
class BuzzSprite < IconSprite
attr_accessor :buzz
end
#==============================================
# The Scene for Buzznav
#==============================================
class BuzzNavScene
# Initialize Scene
def pbStartScene
@anim = 0
@lastbuzz = []
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@sprites = {}
@sprites["main"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["main"].z = 5
@sprites["main"].opacity = 0
@main = @sprites["main"].bitmap
pbSetSystemFont(@main)
@sprites["bg"] = IconSprite.new(0, 0, @viewport)
@sprites["bg"].setBitmap("Graphics/Pictures/BuzzNav/bg")
@sprites["bg"].opacity = 0
@sprites["txtbox"] = IconSprite.new(0, 0, @viewport)
@sprites["txtbox"].setBitmap("Graphics/Pictures/BuzzNav/txtbox")
@sprites["txtbox"].z = 2
@sprites["txtbox"].opacity = 0
$game_system.bgm_memorize if USE_BGM==true
pbBGMPlay(BGM) if USE_BGM==true
12.times do
Graphics.update
@sprites["txtbox"].opacity += 32
@sprites["bg"].opacity += 32
@sprites["main"].opacity += 64
end
pbLoadBuzz
end
# Load Buzz
def pbLoadBuzz
@timer = 0
@frame = 0
currentbuzz=[]
loop do
currentbuzz = $player.buzz[rand($player.buzz.length)]
if currentbuzz.active
if currentbuzz.id != @lastbuzz || REPEAT==true
break
end
end
end
@sprites["ann"] = IconSprite.new(300, 100, @viewport)
@sprites["ann"].setBitmap("Graphics/Pictures/BuzzNav/Presenters/"+currentbuzz.presenter)
@sprites["ann"].opacity = 0
@sprites["icon"] = IconSprite.new(50, 50, @viewport)
@sprites["icon"].setBitmap("Graphics/Pictures/BuzzNav/Icons/"+currentbuzz.icon)
@sprites["icon"].opacity = 0
@sprites["text"] = IconSprite.new(@viewport)
@sprites["text"].bitmap = Bitmap.new(Graphics.width,Graphics.height)
@text = @sprites["text"].bitmap
pbSetSystemFont(@text)
###############################################################
# Variables
###############################################################
if currentbuzz.id==7
drawTextExMulti(@main,10,260,500,3,_INTL(currentbuzz.buzztxt,$player.name),Color.new(255,255,255),Color.new(0,0,0))
elsif currentbuzz.id==8
drawTextExMulti(@main,10,260,500,3,_INTL(currentbuzz.buzztxt,$player.name),Color.new(255,255,255),Color.new(0,0,0))
else
drawTextExMulti(@main,10,260,500,3,currentbuzz.buzztxt,Color.new(255,255,255),Color.new(0,0,0))
end
###############################################################
# Fade in assets
10.times do
Graphics.update
@sprites["main"].opacity += 32
@sprites["text"].opacity += 32
@sprites["icon"].opacity += 32
@sprites["ann"].opacity += 32
end
@lastbuzz=currentbuzz.id # Set last viewed buzz
end
def pbMain
loop do
@frame += 1 # add to framecount for sprite movement
@timer += 1 # add to timer before buzz changes
Graphics.update
Input.update
self.update
if Input.trigger?(Input::BACK) # if cancel, break
pbBGMStop(1.0) if USE_BGM==true
$game_system.bgm_restore if USE_BGM==true
break
end
# moving sprite depending on frames
if @frame==3
if @anim==0
@sprites["ann"].y += 3
@anim=1
elsif @anim==1
@sprites["ann"].y -= 3
@anim=0
end
end
@frame = 0 if @frame == 18 # setting frame to zero when it's reached 18
if @timer==160 # If timer 160, fade out graphics and clear them
20.times do
@sprites["ann"].opacity -= 16 if @sprites["ann"]
@sprites["icon"].opacity -= 16 if @sprites["icon"]
@sprites["text"].opacity -= 16 if @sprites["text"]
@sprites["main"].opacity -= 16 if @sprites["main"]
@main.clear if @sprites["main"]
end
pbLoadBuzz # load again after 160
end
end
end
def update
pbUpdateSpriteHash(@sprites)
end
def pbEndScene
pbFadeOutAndHide(@sprites) { update }
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
end
#==============================================
# The Screen Class for Buzznav
#==============================================
class BuzzNavScreen
def initialize(scene)
@scene=scene
end
def pbStartScreen #initializing, calling the main loop, and ending the scene
@scene.pbStartScene
@scene.pbMain
@scene.pbEndScene
end
end
#==============================================
# The Script Call, to be used in events
#==============================================
def pbBuzzNav
scene = BuzzNavScene.new
screen = BuzzNavScreen.new(scene)
screen.pbStartScreen
end
###############################################################
# _____ _ _ _ _ _ #
# / ____| | (_) | | | | | #
# | | _ __ [B]_ __| |[I]| |[/I] | |[/B]| | ___ _ __ _ __ _ _ #
# | | | '[B]/ _ \/ [I]` | | _[/I]| | __ |/ _ \ '_ \| '[/B]| | | |#
# | |____| | | __/ ([I]| | | |[/I] | | | | __/ | | | | | |_| |#
# \_____|[I]| \__[/I]|\[B],[I]|[/I]|\[/B]| |[I]| |[/I]|\[B][I]|[/I]| |[I]|[/I]| \[/B], |#
# __/ |#
# |___/ #
###############################################################