XP 스크립트

Release Thread: http://www.creationasylum.net/forum/index.php?showtopic=25007

  지난 번 자작메뉴 데모 올리면서 누락된 스크립트입니다.  이것도 만들 때 RPG 만들기 XP에서 손놓은 지 한참 뒤에 만든 거라서 완전히 잘 돌아간다는 장담은 없습니다.(메뉴명령창은 수정이 필요합니다.  OTL)



#============================================================================
#L's Custom Menu #4 - Compact SDK2 ver.
#============================================================================

#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log("L's CMS #4", 'Landarma', '???', '2009-03-14')

#--------------------------------------------------------------------------
# * Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1])

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?("L's CMS #4")

module SDK::Scene_Commands
#============================================================================
# ** Scene_Menu
#============================================================================
module Scene_Menu
Item = 'Item'
Skill = 'Skill'
Equip = 'Equip'
Status = 'Status'
Save = 'Save'
Load = 'Load'
End_Game = 'Exit'

Order = 'Order'
Party = 'Party'
Option = 'Option'
Quest = 'Quest'
System = 'System'

Menu_Commands = [Item, Skill, Equip, Status, Order, Party, System]
SysMenu_Commands = [Option, Save, Load, End_Game]
end
end


#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
def name
$map_infos[@map_id]
end
end


#========================================
#■ Scene_Title
#--------------------------------------------------------------------------------
# Setting functions for the Title
#========================================
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end


class Window_Infos < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 200, 160)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
#---Show Time
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "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(4, 0, 160, 32, text, 2)
#---Show Steps
self.contents.font.color = system_color
self.contents.draw_text(4, 25, 120, 32, "Steps")
self.contents.font.color = normal_color
self.contents.draw_text(4, 25, 160, 32, $game_party.steps.to_s, 2)
#---Show Money
case $game_party.gold
when 0..9999
gold = $game_party.gold
when 10000..99999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+","+array[2].to_s+array[3].to_s+array[4].to_s
when 100000..999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+array[2].to_s+","+array[3].to_s+array[4].to_s+array[5].to_s
when 1000000..9999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+","+array[1].to_s+array[2].to_s+array[3].to_s+","+array[4].to_s+array[5].to_s+array[6].to_s
when 10000000..99999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+","+array[2].to_s+array[3].to_s+array[4].to_s+","+array[5].to_s+array[6].to_s+array[7].to_s
when 100000000..999999999
gold = $game_party.gold
end

self.contents.font.color = normal_color
cx = contents.text_size($data_system.words.gold).width
self.contents.draw_text(4, 67, 160-cx-2, 32, gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(164-cx, 67, cx, 32, $data_system.words.gold, 2)

self.contents.font.color = normal_color
self.contents.draw_text(4, 100, 200, 32, $game_map.name.to_s)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end

#===========================================================
# This class is almost identical to command window from Cogwheel menu, except
#command check method originated from SDK 2.x.
#===========================================================
class Window_TwoColumnMenuCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :commands
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command(index = self.index)
return @commands[index]
end
#--------------------------------------------------------------------------
# * Commands
#--------------------------------------------------------------------------
def commands=(commands)
# Return if Commands Are Same
return if @commands == commands
# Reset Commands
@commands = commands
# Resets Item Max
item_max = @item_max
@item_max = @commands.size
# If Item Max Changes
unless item_max == @item_max
# Deletes Existing Contents (If Exist)
unless self.contents.nil?
self.contents.dispose
self.contents = nil
end
# Recreates Contents
self.contents = Bitmap.new(width - 32, @item_max * 32)
end
# Refresh Window
refresh
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(width, commands)
# Compute window height from command quantity
super(0, 0, width, ((commands.size/2) + (commands.size%2)) * 32 + 32)
@item_max = commands.size
@commands = commands
@column_max = 2
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((index%2)*(width/2), 32*(index/2), width/2 - 32, 32)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4 + (index%2)*(width/2), 32 * (index/2), width/2 - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end


#==============================================================================
# Window_CompactMenuStatus
#==============================================================================
class Window_CompactMenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 320, 640, 160)
#Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 20
#Refresh and add the contents to window
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
#Clear Bitmap
self.contents.clear
@item_max = $game_party.actors.size
@column_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = i * 160
y = 0
actor = $game_party.actors[i]
draw_actor_graphic(actor, x + 16, y + 60)
draw_actor_class(actor, x + 48, y)
draw_actor_level(actor, x + 48, y + 24)
draw_actor_state(actor, x + 48, y + 48)
draw_actor_hp(actor, x+4, y + 72)
draw_actor_sp(actor, x+4, y + 96)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((@index*160), 0, 128, 128)
end
end
end


#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================

class Scene_Menu < SDK::Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
party_order_init
end
#--------------------------------------------------------------------------
# * Main Processing : Spriteset Initialization
#--------------------------------------------------------------------------
def main_spriteset
#Draw Background
@background = Spriteset_Map.new
end
#--------------------------------------------------------------------------
# * Party Order Change Initiation
#--------------------------------------------------------------------------
def party_order_init
@changer = 0 #Change Party Order by Yargovish
@where = 0 #
@checker = 0 #
end
#--------------------------------------------------------------------------
# * Main Processing : Window Initialization
#--------------------------------------------------------------------------
def main_window
super
# Make main command window
main_command_window
system_command_window
# Make Info Window
@infos_window = Window_Infos.new
@infos_window.x = 420
@infos_window.y = 16
# Make status window
@status_window = Window_CompactMenuStatus.new
end
#--------------------------------------------------------------------------
# * Main Processing : Window Initialization : Main Command
#--------------------------------------------------------------------------
def main_command_window
# Make command window
command = SDK::Scene_Commands::Scene_Menu::Menu_Commands.dup
@command_window = Window_TwoColumnMenuCommand.new(288, command)
@command_window.index = @menu_index
@command_window.x = 16
@command_window.y = 16
if @command_window.height > 256
@command_window.height = 256
end
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_party.actors.size <= 1 #
#Disable change party order
@command_window.disable_item(4)
end
end
#--------------------------------------------------------------------------
# * Main Processing : Window Initialization : System Command
#--------------------------------------------------------------------------
def system_command_window
# Make command window
sys_command = SDK::Scene_Commands::Scene_Menu::SysMenu_Commands.dup
@sys_command_window = Window_Command.new(128, sys_command)
@sys_command_window.visible = false
@sys_command_window.active = false
@sys_command_window.x = 120
@sys_command_window.y = 120
#@sys_command_window.z = 0
check_save_available
check_load_available
end
#-----------------
def check_save_available
# If save is forbidden
if $game_system.save_disabled
# Disable save
@sys_command_window.disable_item(1)
end
end
#-----------------
def check_load_available
#Check if saved file exists
@load_enabled = false
for i in 0..3
if (FileTest.exist?("Save#{i+1}.rxdata"))
@load_enabled = true
end
end
if !@load_enabled
#Put your @command_window.disable_item(index)
@sys_command_window.disable_item(2)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If command window is active: call update_command
if @command_window.active
update_command
return
# If status window is active: call update_status
elsif @status_window.active
update_status
return
end

if @sys_command_window.active
@sys_command_window.z = +500
end
# If system window is active: call update_sys_command
if @sys_command_window.active
update_sys_command
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Command Input
main_command_input
return
end
end
#--------------------------------------------------------------------------
# * Update SysCommand Window
#--------------------------------------------------------------------------
def update_sys_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@sys_command_window.active = false
@sys_command_window.visible = false
@sys_command_window.index = 0
@sys_command_window.z = -500
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Command Input
sys_command_input
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Command Input
sub_command_input
return
end
end
#--------------------------------------------------------------------------
# * Disabled Main Command? Test
#--------------------------------------------------------------------------
def disabled_main_command?
# Gets Current Command
command = @command_window.command
sys_command = @sys_command_window.command
# Gets SDK Scene_Menu Commands
c = SDK::Scene_Commands::Scene_Menu
# If 0 Party Size
if $game_party.actors.size == 0
# If Item, Skill, Equip or Status Selected
if [c::Item, c::Skill, c::Equip, c::Status].include?(command)
return true
end
end
if $game_party.actors.size <= 1
if [c::Order].include?(command)
return true
end
end
# If Save Disabled && Command is Save
return true if $game_system.save_disabled && sys_command == c::Save
# If Load Disabled && Command is Load
return true if !@load_enabled && sys_command == c::Load
return false
end
#--------------------------------------------------------------------------
# * Main Command Input
#--------------------------------------------------------------------------
def main_command_input
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Branch by command window cursor position
case @command_window.command
when SDK::Scene_Commands::Scene_Menu::Item # item
command_item
when SDK::Scene_Commands::Scene_Menu::Skill # skill
command_skill
when SDK::Scene_Commands::Scene_Menu::Equip # equipment
command_equip
when SDK::Scene_Commands::Scene_Menu::Status # status
command_status
when SDK::Scene_Commands::Scene_Menu::Order # order
command_order
when SDK::Scene_Commands::Scene_Menu::Party # party
command_party
when SDK::Scene_Commands::Scene_Menu::Option #option
command_option
when SDK::Scene_Commands::Scene_Menu::System # call system menu
$game_system.se_play($data_system.decision_se)
@sys_command_window.active = true
@sys_command_window.visible = true
@command_window.active = false
end
end
#--------------------------------------------------------------------------
# * System Command Input
#--------------------------------------------------------------------------
def sys_command_input
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Branch by command window cursor position
case @sys_command_window.command
when SDK::Scene_Commands::Scene_Menu::Save #save
command_save
when SDK::Scene_Commands::Scene_Menu::Load #load
command_load
when SDK::Scene_Commands::Scene_Menu::End_Game #end game
command_endgame
when SDK::Scene_Commands::Scene_Menu::Option #option
command_option
end
end
#--------------------------------------------------------------------------
# * Disabled Sub Command? Test
#--------------------------------------------------------------------------
def disabled_sub_command?
# If Skill Selected
if @command_window.command == SDK::Scene_Commands::Scene_Menu::Skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Sub Command Input
#--------------------------------------------------------------------------
def sub_command_input
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Branch by command window cursor position
case @command_window.command
when SDK::Scene_Commands::Scene_Menu::Skill # skill
command_skill
when SDK::Scene_Commands::Scene_Menu::Equip # equipment
command_equip
when SDK::Scene_Commands::Scene_Menu::Status # status
command_status
when SDK::Scene_Commands::Scene_Menu::Order # order
command_order
end
end
#--------------------------------------------------------------------------
# * Command : Item
#--------------------------------------------------------------------------
def command_item
# Switch to item screen
$scene = Scene_Item.new
end
#--------------------------------------------------------------------------
# * Command : Skill
#--------------------------------------------------------------------------
def command_skill
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
return
end
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command : Equip
#--------------------------------------------------------------------------
def command_equip
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
return
end
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command : Status
#--------------------------------------------------------------------------
def command_status
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
return
end
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command : Order
#--------------------------------------------------------------------------
def command_order
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
@checker = 0
return
end
#Change Party Order by Yargovish
if @checker == 0
@changer = $game_party.actors[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.actors[@where] = $game_party.actors[@status_window.index]
$game_party.actors[@status_window.index] = @changer
@checker = 0
@status_window.refresh
$game_player.refresh #
end
end
#--------------------------------------------------------------------------
# * Command : Party
#--------------------------------------------------------------------------
def command_party
# Switch to party change screen
#Put your Party Change Scene here
end
#--------------------------------------------------------------------------
# * Command : Option
#--------------------------------------------------------------------------
def command_option
# Switch to option screen
#Put your Option Scene here
end
#--------------------------------------------------------------------------
# * Command : Quest
#--------------------------------------------------------------------------
def command_quest
# Switch to quest screen
#Put your Quest Scene here
end
#--------------------------------------------------------------------------
# * Command : Save
#--------------------------------------------------------------------------
def command_save
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Command : Load
#--------------------------------------------------------------------------
def command_load
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command : End Game
#--------------------------------------------------------------------------
def command_endgame
# Switch to end game screen
$scene = Scene_End.new
end
#--------------------------------------------------------------------------
# * Activate Status Window
#--------------------------------------------------------------------------
def active_status_window
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end

 

**non-SDK 버전 없습니다.(물론 요령을 알면 수정하는 건 크게 어렵지 않지만)


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
841 전투 KGC_SeparationCommand file 백호 2009.02.22 1706
840 이동 및 탈것 KGC_SetAttackElement (공격속성설정) file 백호 2009.02.22 1407
839 스킬 KGC_SkillMessage (스킬사용메세지) 1 file 백호 2009.02.22 2081
838 스킬 KGC_SkillReflection (마법반사) 2 file 백호 2009.02.22 1476
837 전투 KGC_SPdamage (SP데미지) 3 file 백호 2009.02.22 1627
836 전투 KGC_SPdeath (SP전투불능) file 백호 2009.02.22 1527
835 상태/속성 KGC_StateIcon(스테이터스 아이콘 표시) 2 file 12345678 2010.02.03 1965
834 이동 및 탈것 KGC_Teleport file 백호 2009.02.22 1153
833 기타 KGC_UsableWeapon file 백호 2009.02.22 1384
832 장비 KGC_장비확장 (7/30일자) 12 file 백호 2009.02.22 2055
831 기타 KGC꺼 몬스터도감 수정해봤어요;;; 9 file 백호 2009.02.21 2134
830 메뉴 KGC스크립트모음 12 file 키라링 2009.01.18 2687
829 기타 killer님 요청하신 스크립트 두번째입니다. 나뚜루 2009.02.21 759
828 기타 killer님 요청하신 스크립트입니다. 1 나뚜루 2009.02.21 784
827 전투 Kingdom Hearts 스타일의 전투 시스템 1 백호 2009.02.21 1709
826 메뉴 L's Custom Menu #3: 1인용 메뉴 Revision 1 3 Alkaid 2010.09.12 2360
» 메뉴 L's Custom Menu #4: 'Compact' (SDK 2.x 필수) Alkaid 2010.09.11 1755
824 메뉴 L's Simple Custom Menu #1 R2 (SDK 2.x 필요) Alkaid 2013.01.18 1227
823 저장 Law's Custom Save System by The Law G14 & Night Runner 1 file Alkaid 2013.02.18 1073
822 메뉴 Leidy's Ring Command Window 1.2 by DerVVulfman Alkaid 2012.09.09 1430
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52