XP 스크립트

  예전에 썼던 1인용 메뉴를 고쳐쓴 것입니다.  Option이나 Quest Log같은 더미항목은 Scene_Menu::commands_init를 편집해서 빼거나 해당기능을 하는 스크립트를 넣은 뒤 더미로 되어 있는 명령 부분에 추가하면 됩니다.  정보창의 Variable부분은 삭제하거나 자신이 원하는 정보, 가령 게임의 제목이나 추가적인 플레이어 정보(달성치 같은 것)로 교체하면 됩니다.


#==============================================================================
# L's Custom Menu #3: Simple 1-person CMS - Non-SDK ver. Revision 1
# 2010-09-12
# by Y.W. Ahn aka Landarma
#--------------------------------------------------------------------------
#==============================================================================

module MenuCommand
Item = 'Item'
Skill = 'Skill'
Equip = 'Equip'
Status = 'Status'
Save = 'Save'
Load = 'Load'
End_Game = 'Exit'

Option = 'Option'
Quest = 'Quest Log'
System_Menu = 'System'
Player_Menu = 'Player'
end


class Window_Base < Window
SYSTEM_WORD_EVA = "Evade" #
#--------------------------------------------------------------------------
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
when 7 #
parameter_name = SYSTEM_WORD_EVA #
parameter_value = actor.eva #
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
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


#==============================================================================
# InfoWindow
#==============================================================================
class Window_Info < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 384, 640, 96)
#Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 22
#Z-Pos
self.z = 100
#Refresh and add the contents to window
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
#Clear Bitmap
self.contents.clear
#Add Contents
self.contents.font.color = system_color
self.contents.draw_text(4,0,120,32,'Location')
self.contents.font.color = normal_color
self.contents.draw_text(96,0,360,32,$game_map.name.to_s)

#Draw Steps
self.contents.font.color = system_color
self.contents.draw_text(4,32,120,32,'Steps')
self.contents.font.color = normal_color
self.contents.draw_text(48,32, 120, 32, $game_party.steps.to_s, 2)

#Draw Play Time
self.contents.font.color = system_color
self.contents.draw_text(200,32,120,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(310, 32, 120, 32, text)

#Draw Gold
#Advanced Gold Display mini-script by Dubealex.
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
end
self.contents.font.color = system_color
gold_word = $data_system.words.gold.to_s + " :"
cx = contents.text_size(gold_word).width
cx2=contents.text_size(gold.to_s).width
self.contents.draw_text(412,32,120-cx-2,32,gold_word)
self.contents.font.color = normal_color
self.contents.draw_text(600-cx2+2, 32, cx2, 32, gold.to_s, 2)

#Draw Variable
self.contents.font.color = system_color
self.contents.draw_text(412,0,120,32,'Variable Name')
self.contents.font.color = normal_color
self.contents.draw_text(540,0,120,32,'Variable')
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end


#==============================================================================
# MenuStatus
#==============================================================================
class Window_NewMenuStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 320)
#Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 22
#Z-Pos
self.z = 100
#Refresh and add the contents to window
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
#Clear Bitmap
self.contents.clear
actor = $game_party.actors[0]
draw_actor_graphic(actor, 32, 64)
draw_actor_name(actor, 75, 0)
draw_actor_class(actor, 240, 0)
draw_actor_level(actor, 75, 32)
draw_actor_state(actor, 240, 32)
draw_actor_exp(actor, 75, 64)
draw_actor_hp(actor, 32,100)
draw_actor_sp(actor, 240,100)
draw_actor_parameter(actor, 32, 150, 0)
draw_actor_parameter(actor, 32, 182, 1)
draw_actor_parameter(actor, 32, 214, 2)
draw_actor_parameter(actor, 32, 246, 7) #Evade
draw_actor_parameter(actor, 240, 150, 3)
draw_actor_parameter(actor, 240, 182, 4)
draw_actor_parameter(actor, 240, 214, 5)
draw_actor_parameter(actor, 240, 246, 6)
end
end


#==============================================================================
# Scene_Menu
#==============================================================================
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
commands_init
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_init
# MenuCommand
@commands = []
s1=MenuCommand::Item
s2=MenuCommand::Skill
s3=MenuCommand::Equip
s4=MenuCommand::Player_Menu
s5=MenuCommand::Option
s6=MenuCommand::System_Menu
@commands.push(s1, s2, s3, s4, s5, s6).flatten!

@player_commands = []
z1=MenuCommand::Status
z2=MenuCommand::Quest
@player_commands.push(z1, z2).flatten!

@system_commands = []
o1=MenuCommand::Save
o2=MenuCommand::Load
o3=MenuCommand::End_Game
@system_commands.push(o1, o2, o3).flatten!
end
#--------------------------------------------------------------------------
# * Main - Handles drawing/disposing windows and the main loop
#--------------------------------------------------------------------------
def main
#Draw Windows
main_command_window
player_command_window
system_command_window
main_draw
#Execute transition
Graphics.transition
#Main Loop
loop do
#Main Loop
main_loop
# Abort loop if screen is changed
break if $scene != self
end
#Prepare for transition
Graphics.freeze
#Dispose Windows
main_dispose
end
#--------------------------------------------------------------------------
# * Main Command Window
#--------------------------------------------------------------------------
def main_command_window
@command_window = Window_Command.new(160,@commands)
@command_window.back_opacity = 160
@command_window.index = @menu_index
# 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
end
#--------------------------------------------------------------------------
# * Player Command Window
#--------------------------------------------------------------------------
def player_command_window
@player_command_window = Window_Command.new(160,@player_commands)
@player_command_window.back_opacity = 160
@player_command_window.visible = false
@player_command_window.active = false
@player_command_window.x = 100
@player_command_window.y = 120
end
#--------------------------------------------------------------------------
# * System Command Window
#--------------------------------------------------------------------------
def system_command_window
@sys_command_window = Window_Command.new(128,@system_commands)
@sys_command_window.back_opacity = 160
@sys_command_window.visible = false
@sys_command_window.active = false
@sys_command_window.x=100
@sys_command_window.y=180
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(0)
end
end
#-----------------
def check_load_available
#Check if saved file exists
@load_enabled = (Dir.glob('Save*.rxdata').size > 0)
if !@load_enabled
#Put your @command_window.disable_item(index)
@sys_command_window.disable_item(1)
end
end
#--------------------------------------------------------------------------
# * Main Draw - Handles drawing windows
#--------------------------------------------------------------------------
def main_draw
#Draw Background
@background = Spriteset_Map.new

#Draw Windows
# InfoWindow
@info_window = Window_Info.new
@info_window.back_opacity = 160
# MenuStatus
@status_window = Window_NewMenuStatus.new
@status_window.back_opacity = 160
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
#Dispose Background
@background.dispose

# Dispose All Windows
# Dispose InfoWindow
@info_window.dispose
# Dispose MenuStatus
@status_window.dispose
# Dispose MenuCommand
@command_window.dispose
@player_command_window.dispose
@sys_command_window.dispose
end
#--------------------------------------------------------------------------
# * Main Loop
#--------------------------------------------------------------------------
def main_loop
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Update Windows
update_windows

if @player_command_window.active
@player_command_window.z = +500
end

if @sys_command_window.active
@sys_command_window.z = +500
end

# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If player menu window is active: call update_player_command
if @player_command_window.active
update_player_command
return
end
# If system menu window is active: call update_sys_command
if @sys_command_window.active
update_sys_command
return
end
end
#--------------------------------------------------------------------------
# * Window Update
#--------------------------------------------------------------------------
def update_windows
# Update MenuCommand
@command_window.update if @command_window.visible
@player_command_window.update if @player_command_window.visible
@sys_command_window.update if @sys_command_window.visible
@info_window.update
@status_window.update
end
#--------------------------------------------------------------------------
# * Update Menu Command
#--------------------------------------------------------------------------
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)# If command other than save or end game, and party members = 0
# 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 PlayerCommand Window
#--------------------------------------------------------------------------
def update_player_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@player_command_window.active = false
@player_command_window.visible = false
@player_command_window.index = 0
@player_command_window.z = 0
return
end

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
player_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 = 0
return
end

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
#--------------------------------------------------------------------------
# * Disabled Main Command? Test
#--------------------------------------------------------------------------
def disabled_main_command?
# Gets Current Command
command = @commands[@command_window.index]
sys_command = @system_commands[@sys_command_window.index]
player_command = @player_commands[@player_command_window.index]
# Gets Scene_Menu Commands
c = MenuCommand
# 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
if [c::Status].include?(player_command)
return true
end
end
if [c::Skill].include?(command)
# If this actor's action limit is 2 or more
if $game_party.actors[0].restriction >= 2
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
# Loads Current Command
command = @commands[@command_window.index]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Checks Commands
case command
when MenuCommand::Item # item
command_item
when MenuCommand::Skill # skill
command_skill
when MenuCommand::Equip # equipment
command_equip
when MenuCommand::Player_Menu # Call Player Menu
$game_system.se_play($data_system.decision_se)
@player_command_window.active = true
@player_command_window.visible = true
@command_window.active = false
when MenuCommand::Option #option
command_option
when MenuCommand::System_Menu # 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
#--------------------------------------------------------------------------
# * Player Command Input
#--------------------------------------------------------------------------
def player_command_input
# Loads Current Command
player_command = @player_commands[@player_command_window.index]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Checks Commands
case player_command
when MenuCommand::Status # status
command_status
when MenuCommand::Quest # quest
command_quest
end
end
#--------------------------------------------------------------------------
# * System Command Input
#--------------------------------------------------------------------------
def sys_command_input
# Loads Current Command
sys_command = @system_commands[@sys_command_window.index]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Checks Commands
case sys_command
when MenuCommand::Save #save
command_save
when MenuCommand::Load #load
command_load
when MenuCommand::End_Game #end game
command_endgame
end
end
#--------------------------------------------------------------------------
# * Command : Item
#--------------------------------------------------------------------------
def command_item
# Switch to item screen
$scene = Scene_Item.new
end
#--------------------------------------------------------------------------
# * Command : Skill
#--------------------------------------------------------------------------
def command_skill
# Switch to skill screen
$scene = Scene_Skill.new
end
#--------------------------------------------------------------------------
# * Command : Equip
#--------------------------------------------------------------------------
def command_equip
# Switch to equipment screen
$scene = Scene_Equip.new
end
#--------------------------------------------------------------------------
# * Command : Status
#--------------------------------------------------------------------------
def command_status
# Switch to status screen
$scene = Scene_Status.new
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
end


class Scene_Save < Scene_File
alias save_on_decision on_decision
alias save_on_cancel on_cancel
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
save_on_decision(filename)
$scene = Scene_Menu.new(5)
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
save_on_cancel
$scene = Scene_Menu.new(5)
end
end


class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias load_initialize initialize
alias load_on_cancel on_cancel
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@scene = $scene
load_initialize
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
load_on_cancel
$scene = @scene
end
end


Comment '3'
  • profile
    메세지 2010.09.24 14:53

    복사불가능

    제대로좀올려주시지...

    줄이 다다다다다닥 붙어서 나옵니다...

  • ?
    Alkaid 2010.09.24 14:58

    IE에서 그런 현상이 있습니다.(IE8도 그러니....--+ 9나 기대?)  파이어폭스나 크롬등에서 시도해 보시기 바랍니다.

  • ?
    코아 코스튬 2010.10.10 12:33

    구글 크롬으로 해보세여


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
861 영상 berka's Video Script II Reloaded 1.2 2 Alkaid 2010.10.08 1399
860 기타 Seph's Test Bed v.4 (파일첨부) (SDK2.x용) Alkaid 2010.10.08 1533
859 상점 Advanced Shop System by Alexis Hiemis 1 file Alkaid 2010.10.08 1872
858 저장 Chaos Project Save Layout 1.4 by Fantasist, Blizzard file Alkaid 2010.10.08 1558
857 저장 StupidStormy36's Custom Save System 2010-10-06(05?) Edition 1 Alkaid 2010.10.07 1247
856 메뉴 3D Menu Script 7 현문 2010.10.06 4077
855 저장 Advanced Save Menu 편집 20101006 Edition (SDK2용) 1 Alkaid 2010.10.06 1217
854 메시지 UCoder's Message System by Mr.Mo file Alkaid 2010.10.05 1542
853 저장 StupidStormy36's Custom Save System 3 Alkaid 2010.10.05 1199
852 저장 Advanced Save Menu 편집 20101005 Edition (SDK2용) 3 Alkaid 2010.10.05 1293
851 기타 SFont 사용 스크립트 by Trickster Alkaid 2010.10.05 1512
850 메뉴 CoaMenu2탄Ver2.0 15 file 코아 코스튬 2010.10.03 2091
849 타이틀/게임오버 코아 코스튬씨의 타이틀 랜덤출력 1.5를 SDK2용으로 편집한 것(수정). file Alkaid 2010.09.29 1753
848 전투 깔끔한형식의 Asan'Tear배틀시스탬 4 file 콩밥 2010.09.29 4121
847 타이틀/게임오버 パラ犬씨의 타이틀 화면 커스터마이즈를 SDK2용으로 편집 by Trickster Alkaid 2010.09.29 1588
846 타이틀/게임오버 타이틀 화면 커스터마이즈 1.11 by パラ犬 3 Alkaid 2010.09.29 2247
845 타이틀/게임오버 타이틀 랜덤 출력 기능 1.5 5 file 코아 코스튬 2010.09.29 2203
844 메뉴 CoaMenuVer0.1 10 file 코아 코스튬 2010.09.25 2701
843 상태/속성 상태창 표시 Ver 8.0 // 글씨 위치 변경 기능 + 변수 한글 7 file 코아 코스튬 2010.09.24 2555
842 온라인 최신중의 최신 2010년 4월 작 넷플레이 3.0!!! 6 김똘식 2010.09.18 3320
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