Permisi mau Request convert scriprt Rggs2 ke Rggs3
# Variable Pictures
# Created By IceDragon
# Date Created : 01/16/2011
# Date Modified: 01/16/2011
# Version : BETA-1
$imported = {} if $imported == nil
$imported["IEX_VarPics-BETA"] = true
module IEX
module VariablePictures
#==============================================================================
# Start Primary Customization
#------------------------------------------------------------------------------
#==============================================================================
# Hosting Location
# 0 - Apart of the Spriteset_Map (Recommended)
# 1 - Solo (Directly on the Scene_Map) (Not Recommended)
HOST_MODE = 0
# Image handling mode
# 0 - Self
# 1 - Game_Picture (Only Recommended, when paired with YEM Restored Functions)
MODE = 0
# If using mode 1, this is used to designate what pictures
# should be used for this script, by giving it a start position
# Note the number of pictures used is equal to the number of variables
# stated in the VARIABLE_PICTURES
START_PICTURE = 21
VARIABLE_SWITCHES = {
# Variable_ID => Switch_ID
0 => nil,
93 => 99,
94 => 99,
95 => 99,
96 => 99,
97 => 99,
98 => 99,
99 => 99,
} # Do not Remove
VARIABLE_PICTURES = {}
# Currently this is how it works
# VARIABLE_PICTURES[variable_id] = {
# variable_value => "filename"}
#===============================================================================
#=========================#
# HUD Base #
#=========================#
VARIABLE_PICTURES[93] = {
0 => "",
1 => "hud_base",
}
#=========================#
# HUD AM/PM #
#=========================#
VARIABLE_PICTURES[94] = {
0 => "hud_time_am",
1 => "hud_time_pm",
}
#=========================#
# HUD Minute #
#=========================#
VARIABLE_PICTURES[95] = {
0 => "hud_min_00",
1 => "hud_min_10",
2 => "hud_min_20",
3 => "hud_min_30",
4 => "hud_min_40",
5 => "hud_min_50",
}
#=========================#
# HUD Hour #
#=========================#
VARIABLE_PICTURES[96] = {
0 => "hud_hour_00",
1 => "hud_hour_01",
2 => "hud_hour_02",
3 => "hud_hour_03",
4 => "hud_hour_04",
5 => "hud_hour_05",
6 => "hud_hour_06",
7 => "hud_hour_07",
8 => "hud_hour_08",
9 => "hud_hour_09",
10 => "hud_hour_10",
11 => "hud_hour_11",
12 => "hud_hour_12",
}
#=========================#
# HUD Day #
#=========================#
VARIABLE_PICTURES[97] = {
0 => "",
1 => "hud_day_01",
2 => "hud_day_02",
3 => "hud_day_03",
4 => "hud_day_04",
5 => "hud_day_05",
6 => "hud_day_06",
7 => "hud_day_07",
8 => "hud_day_08",
9 => "hud_day_09",
10 => "hud_day_10",
11 => "hud_day_11",
12 => "hud_day_12",
13 => "hud_day_13",
14 => "hud_day_14",
15 => "hud_day_15",
16 => "hud_day_16",
17 => "hud_day_17",
18 => "hud_day_18",
19 => "hud_day_19",
20 => "hud_day_20",
}
#=========================#
# HUD Week #
#=========================#
VARIABLE_PICTURES[98] = {
0 => "",
1 => "hud_week_1",
2 => "hud_week_2",
3 => "hud_week_3",
4 => "hud_week_4",
5 => "hud_week_5",
6 => "hud_week_6",
7 => "hud_week_7",
}
#=========================#
# HUD Season #
#=========================#
VARIABLE_PICTURES[99] = {
0 => "",
1 => "hud_season_1",
2 => "hud_season_2",
3 => "hud_season_3",
4 => "hud_season_4",
}
#==============================================================================
# As you already know, from the help file.
# 0 - Is for below character
# 50 - Same as character
# 100 - Above Character
# Note this is only effective with mode 0
VARIABLE_PRIORITY = {
0 => nil,
93 => 99,
94 => 100,
95 => 100,
96 => 100,
97 => 100,
98 => 100,
99 => 100,
} # Do not Remove
#==============================================================================
# End Primary Customization
#------------------------------------------------------------------------------
#==============================================================================
end
end
#==============================================================================
# ** Spriteset_VarPic
#------------------------------------------------------------------------------
#==============================================================================
class Spriteset_VarPic
include IEX::VariablePictures
attr_accessor :sprites
def initialize(viewport = nil)
@viewport = viewport
case MODE
when 0
@sprites = {} # The key is the variable ID, the value is a sprite
@last_values = {} # The key is the variable ID, the value is the variable's value
count = 0
for key in VARIABLE_PICTURES.keys
@sprites[key] = Sprite.new(@viewport)
@sprites[key].bitmap = Bitmap.new(24, 24)
az = 1+count; az = VARIABLE_PRIORITY[key] if VARIABLE_PRIORITY.has_key?(key)
@sprites[key].z = az
count += 1
end
when 1
@used_pictures = {} # The key is the variable ID, the value is the Picture ID
@last_values = {} # The key is the variable ID, the value is the variable's value
pid = START_PICTURE
for key in VARIABLE_PICTURES.keys
@used_pictures[key] = pid
pid += 1
end
end
update
end
def dispose
case MODE
when 0
for key in @sprites.keys
next if @sprites[key].nil?
@sprites[key].dispose
@sprites[key] = nil
end
when 1
for key in @used_pictures.keys
pid = @used_pictures[key]
$game_map.screen.pictures[pid].erase
end
end
end
def update
case MODE
when 0 # Self Mode
for key in @sprites.keys
vis = true
if VARIABLE_SWITCHES.has_key?(key)
vis = $game_switches[VARIABLE_SWITCHES[key]] if !VARIABLE_SWITCHES[key].nil?
else
vis = $game_switches[VARIABLE_SWITCHES[0]] if !VARIABLE_SWITCHES[0].nil?
end
@sprites[key].visible = vis
next unless @sprites[key].visible
if VARIABLE_PICTURES.has_key?(key)
if @last_values[key] != $game_variables[key]
@sprites[key].bitmap.dispose
nam = VARIABLE_PICTURES[key][$game_variables[key]]
if nam.to_s != ""
@sprites[key].bitmap = Cache.picture(nam)
end
@last_values[key] = $game_variables[key]
end
end
@sprites[key].update
end
when 1
for key in @used_pictures.keys
pid = @used_pictures[key]
vis = true
if VARIABLE_SWITCHES.has_key?(key)
vis = $game_switches[VARIABLE_SWITCHES[key]] if !VARIABLE_SWITCHES[key].nil?
else
vis = $game_switches[VARIABLE_SWITCHES[0]] if !VARIABLE_SWITCHES[0].nil?
end
if vis
if VARIABLE_PICTURES.has_key?(key)
if @last_values[key] != $game_variables[key]
$game_map.screen.pictures[pid].erase
x = 0
y = 0
nam = VARIABLE_PICTURES[key][$game_variables[key]]
$game_map.screen.pictures[pid].show(nam.to_s,
# Origin, x, y, zoomx, zoomy, opacity, blend_type
0, x, y, 100, 100, 255, 0)
@last_values[key] = $game_variables[key]
end
end
else
if $game_map.screen.pictures[pid].name != ""
$game_map.screen.pictures[pid].erase
@last_values[key].clear
end
end # End if vis
end # End for
end # End case
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#==============================================================================
class Spriteset_Map
attr_accessor :varpic_spriteset
alias iex_varpic_spmp_initialize initialize unless $@
def initialize
iex_varpic_spmp_initialize
@varpic_spriteset = Spriteset_VarPic.new(@viewport1)
end
alias iex_varpic_spmp_dispose dispose unless $@
def dispose
iex_varpic_spmp_dispose
@varpic_spriteset.dispose unless @varpic_spriteset.nil?
end
alias iex_varpic_spmp_update update unless $@
def update
iex_varpic_spmp_update
@varpic_spriteset.update unless @varpic_spriteset.nil?
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#==============================================================================
class Scene_Map < Scene_Base
alias iex_varpic_scmp_start start unless $@
def start
iex_varpic_scmp_start
@varpic_spriteset = Spriteset_VarPic.new if IEX::VariablePictures::HOST_MODE == 0
end
alias iex_varpic_scmp_terminate terminate unless $@
def terminate
iex_varpic_scmp_terminate
@varpic_spriteset.dispose unless @varpic_spriteset.nil?
end
alias iex_varpic_scmp_update update unless $@
def update
iex_varpic_scmp_update
@varpic_spriteset.update if @varpic_spriteset != nil
end
def varpic_spriteset
case IEX::VariablePictures::HOST_MODE
when 0; return @varpic_spriteset
when 1; return @spriteset.varpic_spriteset
else ; return nil
end
end
end