Sasame Kiryu
Member
Here is the CMS I'm trying to revamp for my game:
I want it so that I can shrink the actor's battlegraphic so that it fits in a square behind the HP, SP, and all that. The selection square is 150 x 150. I want it so that the whole actor is visible, not confined in a box. I just need a way to shrink them really, so it could look nice and neat from behind ^^
Sorry if this is a nOOb request or question, but I'm not very good at scripting just yet. All I really did was copy and paste the defaults and tweaked some scripts I saw here and there. If you need the script for the CMS, I'll post it here.
http://i22.photobucket.com/albums/b335/JohnerX/CMSshot.gif[/IMG]
I want it so that I can shrink the actor's battlegraphic so that it fits in a square behind the HP, SP, and all that. The selection square is 150 x 150. I want it so that the whole actor is visible, not confined in a box. I just need a way to shrink them really, so it could look nice and neat from behind ^^
Sorry if this is a nOOb request or question, but I'm not very good at scripting just yet. All I really did was copy and paste the defaults and tweaked some scripts I saw here and there. If you need the script for the CMS, I'll post it here.
Code:
#===============================================================================
# • Yggdrasil CMS
#===============================================================================
# This is my CMS for my game Hymns of Yggdrasil: Tears of Asgard
#-------------------------------------------------------------------------------
=begin
This CMS is made to function in conjunction with a few scripts; these being:
- Quest Scene by coolmariners98
- Multiple Equip Slots by Guillaume777
- Character Biography by Claimh
Also trying to have help creating my own Yggdrasil CBS, still currently under
way. Once this is finished, this CMS will be completed. Otherwise, Here it is.
=end
#===============================================================================
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
attr_accessor :actors
def add_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.size < 8 and not @actors.include?(actor)
@actors.push(actor)
$game_player.refresh
end
end
end
#==============================================================================
# Scene_Save
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super("Which file would you like to save to?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(6)
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(6)
end
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
#==============================================================================
# Scene_Load2
#==============================================================================
class Scene_Load2 < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Remake temporary object
$game_temp = Game_Temp.new
# Timestamp selects new file
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("Which file would you like to load?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play load SE
$game_system.se_play($data_system.load_se)
# Read save data
file = File.open(filename, "rb")
read_save_data(file)
file.close
# Restore BGM and BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to title screen
$scene = Scene_Menu.new(7)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end
#==============================================================================
# Scene_End
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = "To Title"
s2 = "Shutdown"
s3 = "Cancel"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame Update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of window
@command_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(8)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # to title
command_to_title
when 1 # shutdown
command_shutdown
when 2 # quit
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
# * Process When Choosing [To Title] Command
#--------------------------------------------------------------------------
def command_to_title
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Switch to title screen
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
# * Process When Choosing [Shutdown] Command
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Process When Choosing [Cancel] Command
#--------------------------------------------------------------------------
def command_cancel
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to menu screen
$scene = Scene_Menu.new(5)
end
end
#===============================================================================
# Window_MenuStatus
#===============================================================================
class Window_MenuStatus < Window_Selectable
def initialize
super (0, 0, 640, 360)
@column_max = 4
@item_max = $game_party.actors.size
self.contents = Bitmap.new(width - 32, row_max * 150)
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = i % 4 * 150
y = i / 4 * 150
actor = $game_party.actors[i]
actor = $game_party.actors[i]
draw_actor_graphic(actor, x + 32, y + 70)
draw_actor_name(actor, x + 10, y)
draw_actor_level(actor, x, y + 64)
draw_actor_state(actor, x, y + 80)
draw_actor_hp(actor, x, y + 24)
draw_actor_sp(actor, x, y + 48)
end
end
def top_row
return self.oy / 150
end
def page_row_max
return (self.height - 32) / 150
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 150
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
self.cursor_rect.set(@index % 4 * 150, @index / 4 * 150 - self.oy, 150, 150)
end
end
#===============================================================================
# Window_Gold
#===============================================================================
class Window_Gold < Window_Base
def initialize
super (0, 0, 200, 120)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 160-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(164-cx, 0, cx, 32, $data_system.words.gold, 2)
end
end
#===============================================================================
# Menu_PlayTime
#===============================================================================
class Window_PlayTime < Window_Base
def initialize
super(0, 0, 200, 120)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 96, 32, "Play Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(44, 0, 120, 32, text, 2)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#===============================================================================
# Window_Location
#===============================================================================
class Window_Location < Window_Base
def initialize
super(0, 0, 200, 60)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
$data_map_infos = load_data("Data/MapInfos.rxdata")
self.contents.draw_text(0, 0, 120, 32, $data_map_infos[$game_map.map_id].name, 2)
end
end
#===============================================================================
# Window_Steps
#===============================================================================
class Window_Steps
def initialize
super(0, 0, 200, 60)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, 32, 'Steps:')
self.contents.font.color = normal_color
self.contents.draw_text(48, 0, 120, 32, $game_party.steps.to_s, 2)
end
end
#===============================================================================
# Scene_Menu
#===============================================================================
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
@actor_change = false
end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Quests"
s6 = "Save"
s7 = "Load"
s8 = "Exit"
@command_window = Window_Command.new(240, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.index = @menu_index
@command_window.opacity = 100
@command_window.x = 400
@command_window.y = 360
@command_window.height = 120
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
@status_window = Window_MenuStatus.new
@status_window.opacity = 100
@status_window.x = 0
@status_window.y = 0
@gold_window = Window_Gold.new
@gold_window.opacity = 100
@gold_window.x = 0
@gold_window.y = 360
@playtime_window = Window_PlayTime.new
@playtime_window.opacity = 100
@playtime_window.x = 200
@playtime_window.y = 360
@location_window = Window_Location.new
@location_window.opacity = 0
@location_window.x = 200
@location_window.y = 420
@steps_window = Window_Steps.new
@steps_window.opacity = 0
@steps_window.x = 0
@steps_window.y = 420
@background = Sprite.new
@background.bitmap = RPG::Cache.picture("yggdrasil_title2")
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@playtime_window.dispose
@location_window.dispose
@gold_window.dispose
@steps_window.dispose
@status_window.dispose
end
def update
@command_window.update
@playtime_window.update
@location_window.update
@gold_window.update
@steps_window.update
@status_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0 # Item
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1 # Skill
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # Equip
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # Status
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
$game_system.se_play($data_system.decision_se)
$scene = Scene_Quests.new
when 5 # Save
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 6 #Load
$game_system.se_play($data_system.decision_se)
$scene = Scene_Load2.new
when 7 # End
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
@actor_change = false
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1 # Skill
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2 # Equip
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3 # Status
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end