10-17-2024, 12:04 AM
(This post was last modified: 10-17-2024, 12:19 AM by kyonides.
Edit Reason: Full Script
)
EDIT: Replace it with this full version that no longer includes any weird hidden character AFAIK.
Now it would only fail if you lack any of the frames.
Code:
#==============================================================================
# ** GW Animated Battlebacks + New Features
#------------------------------------------------------------------------------
# by The Bard (Gabriel Winchester)
# - Improvements by Atoa -
# May 22, 2010
#
# This screipt allows battlebacks to be animated (no, its not like Moghunter's
# system which moves). They are actually animated, by individual frames.
#
# USAGE
# Before each battle, you establish the parameters you want for the battleback.
#
# Use the call script command: animated_bb_on(speed, frames, opacity_
# * Opacity can be omitted as it is defaulted to a full 255 solid setting
#
# To turn off the animated battleback layer, use: animated_bb_off
#
# NEVER set a speed value to 0 or below.
#
# UPPER LAYER
# If you add a top layer to the battleback, the image will be above the heroes.
#
# To set a top layer, use the code: upper_bb_on(speed, frames, opacity)
#
# If the image is not moving, just call: upper_bb_on
#
# To turn off the upper battleback layer, use: upper_bb_off
#
# Upper layers should have the suffixes "UP" and 'frame' followed by
# each other. IF, for example, it is an image to be shown above the heroes
# and has three frames of animations, they must be named as follows
# "CastleUP1" "CastleUP2" "CastleUp3"
#
#==============================================================================
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
alias :animated_gm_sys_init :initialize
#--------------------------------------------------------------------------
def initialize
animated_gm_sys_init
@animated_bb = false
@bb_speed = 0
@bb_frames = 0
@bb_opac = 0
@upperbb = 0
@upperbb_speed = 0
@upperbb_frames = 0
@upperbb_opac = 0
end
attr_accessor :animated_bb, :bb_speed, :bb_frames, :bb_opac
attr_accessor :upperbb, :upperbb_speed, :upperbb_frames, :upperbb_opac
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
alias :animated_sprtst_btl_init :initialize
def initialize
create_animbb if $game_system.animated_bb
create_upperbb if $game_system.upperbb
animated_sprtst_btl_init
end
#--------------------------------------------------------------------------
def create_animbb
@animbb_time = 0
@animbb_frame = 0
@animbb = Sprite.new(@viewport1)
@animbb.bitmap = RPG::Cache.battleback($game_temp.battleback_name +
@animbb_frame.to_s)
@animbb.z = 2
@animbb.opacity = $game_system.bb_opac
end
#--------------------------------------------------------------------------
def create_upperbb
@upperbb_time = 0
@upperbb_frame = 1
@upperbb = Sprite.new(@viewport3)
@upperbb.bitmap = RPG::Cache.battleback($game_temp.battleback_name +
"UP" + @animbb_frame.to_s)
@upperbb.opacity = $game_system.upperbb_opac
@upperbb.z = 20
# ACBS = 140, Padrão = 20
end
#--------------------------------------------------------------------------
alias gw_update update
def update
upperbb_update if $game_system.upperbb
animbb_update if $game_system.animated_bb
@animbb.dispose if @animbb != nil and not $game_system.animated_bb
@upperbb.dispose if @upperbb != nil and not $game_system.upperbb
gw_update
end
#--------------------------------------------------------------------------
alias gw_dispose dispose
def dispose
@animbb.dispose if $game_system.animated_bb
@upperbb.dispose if $game_system.upperbb
gw_dispose
end
#--------------------------------------------------------------------------
def animbb_update
create_animbb if @animbb.nil?
@animbb_time += 1
if @animbb_time % $game_system.bb_speed == 0
@animbb_frame = (@animbb_frame % $game_system.bb_frames) + 1
begin
bb = RPG::Cache.battleback(@battleback_name + @animbb_frame.to_s)
rescue
bb = RPG::Cache.battleback($game_temp.battleback_name)
end
@animbb.bitmap = bb
@animbb.opacity = $game_system.bb_opac
end
end
#--------------------------------------------------------------------------
def upperbb_update
create_upperbb if @upperbb.nil?
@upperbb_time += 1
if @upperbb_time % $game_system.upperbb_speed == 0
@upperbb_frame = (@upperbb_frame % $game_system.upperbb_frames) + 1
begin
upperbb = RPG::Cache.battleback(@battleback_name + "UP" +
@upperbb_frames.to_s)
rescue
upperbb = RPG::Cache.battleback($game_temp.battleback_name)
end
@upperbb.bitmap = upperbb
@upperbb.opacity = $game_system.upperbb_opac
end
end
end
#==============================================================================
# ■ Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
def animated_bb_on(speed, frames, opacity=255)
$game_system.animated_bb = true
$game_system.bb_speed = speed
$game_system.bb_frames = frames
$game_system.bb_opac = opacity
end
#--------------------------------------------------------------------------
def upper_bb_on(speed=1, frames=1, opacity=255)
$game_system.upperbb = true
$game_system.upperbb_speed = speed
$game_system.upperbb_frames = frames
$game_system.upperbb_opac = opacity
end
#--------------------------------------------------------------------------
def animated_bb_off
$game_system.animated_bb = false
$game_system.bb_speed = 0
$game_system.bb_frames = 0
end
#--------------------------------------------------------------------------
def upper_bb_off
$game_system.upperbb = false
$game_system.upperbb_speed = 0
$game_system.upperbb_frames = 0
$game_system.upperbb_opac = 0
end
end
Now it would only fail if you lack any of the frames.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE