XP 스크립트

http://www.dubealex.com/asylum/index.php?showtopic=6360
다른 장비화면 스크립트처럼 장착시 모든 파라미터의 변동을 보여줍니다. 두 가지 레이아웃 중에서 선택 가능.(데모를 참조할 것)


#===================================================
# ■ SIB Advanced Equip v2
#===================================================
# For more infos and update, visit:
# www.dubealex.com (Creation Asylum)
#
# Created Entirely by SIBruno
# shaun.bruno@mail.utexas.edu
# Use freely and give credit! :)
#
# Special Thanks:
# Creation Asylum
#
# Feb 6, 2006
#===================================================
# SUPPORTED LAYOUTS (more to come...):
# 1) Default SIB Advanced Equip Layout
# 2) NEW! Inspired by PhotonWeapon's Equip Screen
#===================================================
# Changes in v.2:
# * Beginning the concept of "layouts"
#
# Added Layout #2
# NOTE: Most similar to default equip screen
# * Maintained default window sizes
# * Character sprite removed
# * Character hp and sp removed
# * Character lvl included
#===================================================
#Instructions:
# Paste script-x right above main.
# Change Layouts: set $AElayout to a layout num
# ex. $AElayout = 1 (for default Equip Screen)
# ex. $AElayout = 2 (for layout # 2)
# You can set the equip screen to your default font
# and size by setting $AEfont and $AEsize to your
# respective default font and size variables.
$AEfont = "Tahoma"
$AEsize = 22
$AElayout = 1
#===================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * SIBRUNO Draw Parameter color
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
# value : parameter value
# colorNum: color for parameter
#--------------------------------------------------------------------------
def draw_sib_parameter(actor, x, y, type, value, colorNum)
parameter_value = value
case type
when 0
parameter_name = $data_system.words.atk
when 1
parameter_name = $data_system.words.pdef
when 2
parameter_name = $data_system.words.mdef
when 3
parameter_name = $data_system.words.str
when 4
parameter_name = $data_system.words.dex
when 5
parameter_name = $data_system.words.agi
when 6
parameter_name = $data_system.words.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = text_color(colorNum)
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end

class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
if($AElayout == 1)
super(0, 64, 302, 416)
elsif($AElayout == 2)
super(0, 64, 272, 192)
end
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $AEfont # "Equip" left side (Status) window font
self.contents.font.size = $AEsize
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
#-----SIBRUNO EQUIP LEFT-----
draw_actor_name(@actor, 4, 0)

xPos = 50
xVar = 180
yAtk = 124
yPDef = 156
yMDef = 188
yStr = 252
yDex = 284
yAgi = 316
yInt = 348

if($AElayout == 1)
draw_actor_graphic(@actor, 40, 112)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_hp(@actor, 96, 32, 172)
draw_actor_sp(@actor, 96, 64, 172)
elsif($AElayout == 2)
draw_actor_level(@actor, 180, 0)
xPos = 4
xVar = 180
yAtk = 32
yPDef = 48
yMDef = 64
yStr = 84
yDex = 100
yAgi = 116
yInt = 132
end

# Atk
if @new_atk != nil
if @actor.atk < @new_atk
draw_sib_parameter(@actor, xPos, yAtk, 0, @new_atk, 7)
self.contents.font.color = text_color(3)
elsif @actor.atk > @new_atk
draw_sib_parameter(@actor, xPos, yAtk, 0, @new_atk, 7)
self.contents.font.color = text_color(2)
else
draw_sib_parameter(@actor, xPos, yAtk, 0, @new_atk, 8)
end
atk_var = @new_atk - @actor.atk
if atk_var != 0
atktxt = ""
if atk_var > 0
atktxt = "+" + atk_var.to_s
else
atktxt = atk_var.to_s
end
self.contents.draw_text(xPos + xVar, yAtk, 36, 32, atktxt, 2)
end
else
draw_actor_parameter(@actor, xPos, yAtk, 0)
end

# Phy Def
if @new_pdef != nil
if @actor.pdef < @new_pdef
draw_sib_parameter(@actor, xPos, yPDef, 1, @new_pdef, 7)
self.contents.font.color = text_color(3)
elsif @actor.pdef > @new_pdef
draw_sib_parameter(@actor, xPos, yPDef, 1, @new_pdef, 7)
self.contents.font.color = text_color(2)
else
draw_sib_parameter(@actor, xPos, yPDef, 1, @new_pdef, 8)
end
pdef_var = @new_pdef - @actor.pdef
if pdef_var != 0
pdeftxt = ""
if pdef_var > 0
pdeftxt = "+" + pdef_var.to_s
else
pdeftxt = pdef_var.to_s
end
self.contents.draw_text(xPos + xVar, yPDef, 36, 32, pdeftxt, 2)
end
else
draw_actor_parameter(@actor, xPos, yPDef, 1)
end

# Mag Def
if @new_mdef != nil
if @actor.mdef < @new_mdef
draw_sib_parameter(@actor, xPos, yMDef, 2, @new_mdef, 7)
self.contents.font.color = text_color(3)
elsif @actor.mdef > @new_mdef
draw_sib_parameter(@actor, xPos, yMDef, 2, @new_mdef, 7)
self.contents.font.color = text_color(2)
else
draw_sib_parameter(@actor, xPos, yMDef, 2, @new_mdef, 8)
end
mdef_var = @new_mdef - @actor.mdef
if mdef_var != 0
mdeftxt = ""
if mdef_var > 0
mdeftxt = "+" + mdef_var.to_s
else
mdeftxt = mdef_var.to_s
end
self.contents.draw_text(xPos + xVar, yMDef, 36, 32, mdeftxt, 2)
end
else
draw_actor_parameter(@actor, xPos, yMDef, 2)
end

# Str
if @new_str != nil
if @actor.str < @new_str
draw_sib_parameter(@actor, xPos, yStr, 3, @new_str, 7)
self.contents.font.color = text_color(3)
elsif @actor.str > @new_str
draw_sib_parameter(@actor, xPos, yStr, 3, @new_str, 7)
self.contents.font.color = text_color(2)
else
draw_sib_parameter(@actor, xPos, yStr, 3, @new_str, 8)
end
str_var = @new_str - @actor.str
if str_var != 0
strtxt = ""
if str_var > 0
strtxt = "+" + str_var.to_s
else
strtxt = str_var.to_s
end
self.contents.draw_text(xPos + xVar, yStr, 36, 32, strtxt, 2)
end
else
draw_actor_parameter(@actor, xPos, yStr, 3)
end

#Dex
if @new_dex != nil
if @actor.dex < @new_dex
draw_sib_parameter(@actor, xPos, yDex, 4, @new_dex, 7)
self.contents.font.color = text_color(3)
elsif @actor.dex > @new_dex
draw_sib_parameter(@actor, xPos, yDex, 4, @new_dex, 7)
self.contents.font.color = text_color(2)
else
draw_sib_parameter(@actor, xPos, yDex, 4, @new_dex, 8)
end
dex_var = @new_dex - @actor.dex
if dex_var != 0
dextxt = ""
if dex_var > 0
dextxt = "+" + dex_var.to_s
else
dextxt = dex_var.to_s
end
self.contents.draw_text(xPos + xVar, yDex, 36, 32, dextxt, 2)
end
else
draw_actor_parameter(@actor, xPos, yDex, 4)
end

#Agi
if @new_agi != nil
if @actor.agi < @new_agi
draw_sib_parameter(@actor, xPos, yAgi, 5, @new_agi, 7)
self.contents.font.color = text_color(3)
elsif @actor.agi > @new_agi
draw_sib_parameter(@actor, xPos, yAgi, 5, @new_agi, 7)
self.contents.font.color = text_color(2)
else
draw_sib_parameter(@actor, xPos, yAgi, 5, @new_agi, 8)
end
agi_var = @new_agi - @actor.agi
if agi_var != 0
agitxt = ""
if agi_var > 0
agitxt = "+" + agi_var.to_s
else
agitxt = agi_var.to_s
end
self.contents.draw_text(xPos + xVar, yAgi, 36, 32, agitxt, 2)
end
else
draw_actor_parameter(@actor, xPos, yAgi, 5)
end

#Int
if @new_int != nil
if @actor.int < @new_int
draw_sib_parameter(@actor, xPos, yInt, 6, @new_int, 7)
self.contents.font.color = text_color(3)
elsif @actor.int > @new_int
draw_sib_parameter(@actor, xPos, yInt, 6, @new_int, 7)
self.contents.font.color = text_color(2)
else
draw_sib_parameter(@actor, xPos, yInt, 6, @new_int, 8)
end
int_var = @new_int - @actor.int
if int_var != 0
inttxt = ""
if int_var > 0
inttxt = "+" + int_var.to_s
else
inttxt = int_var.to_s
end
self.contents.draw_text(xPos + xVar, yInt, 36, 32, inttxt, 2)
end
else
draw_actor_parameter(@actor, xPos, yInt, 6)
end

end

#--------------------------------------------------------------------------
# ● Set parameters after changing equipment
# new_atk : attack power after changing equipment
# new_pdef : physical defense after changing equipment
# new_mdef : magic defense after changing equipment
# new_str : str after changing equipment
# new_dex : dex after changing equipment
# new_agi : agi after changing equipment
# new_int : int after changing equipment
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef,
new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or
@new_str != new_str or
@new_dex != new_dex or @new_agi != new_agi or @new_int != new_int

@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end

class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
if($AElayout == 1)
super(302, 64, 338, 192)
elsif($AElayout == 2)
super(272, 64, 368, 192)
end
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $AEfont # "Equip" right side (Equiped Items) window font
self.contents.font.size = $AEsize
@actor = actor
refresh
self.index = -1
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end
#--------------------------------------------------------------------------
# ● Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.descript-xion)
end
end

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================

class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
if($AElayout == 1)
super(302, 256, 338, 224)
@column_max = 1
elsif($AElayout == 2)
super(0, 256, 640, 224)
@column_max = 2
end
@actor = actor
@equip_type = equip_type
#@column_max = 2
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add equippable weapons
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons)
end
end
end
# Add equippable armor
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# Add blank page
@data.push(nil)
# Make a bit map and draw all items
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $AEfont # "Equip" bottom (Item List) window font
self.contents.font.size = $AEsize
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if($AElayout == 1)
x = index
y = index * 32
elsif($AElayout == 2)
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
end
#x = 4 + index % 2 * (288 + 32)
#y = index / 2 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.descript-xion)
end
end

#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================

class Scene_Equip
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
# equip_index : equipment index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make windows
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
# Associate help window
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
# Set cursor position
@right_window.index = @equip_index
refresh
# 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 windows
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set item window to visible
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# Get currently equipped item
item1 = @right_window.item
# Set current item window to @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# If right window is active
if @right_window.active
# Erase parameters for after equipment change
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil,
nil)
end
# If item window is active
if @item_window.active
# Get currently selected item
item2 = @item_window.item
# Change equipment
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# Get parameters for after equipment change
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
# Return equipment
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# Draw in left window
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi,
new_int)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@left_window.update
@right_window.update
@item_window.update
refresh
# If right window is active: call update_right
if @right_window.active
update_right
return
end
# If item window is active: call update_item
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
# 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(2)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If equipment is fixed
if @actor.equip_fix?(@right_window.index)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate item window
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
return
end
end
end


**장비확장 스크립트와 함께 사용시 정상적으로 작동한다는 보장은 할 수 없습니다.

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6203
1021 아이템 흠..몬스터도감말고 아이템도감~ 9 백호 2009.02.21 2028
1020 전투 흠.. 아직도 이 스크립트가 없군요 ㅋㅋ(제가올림..) 1 file 백호 2009.02.21 3337
1019 전투 횡스크롤형식의 스크립트 7 백호 2009.02.21 2982
1018 기타 횡스크롤 스크립트 한국말 번역. 15 file 백호 2009.02.21 3315
1017 기타 회복으로 데미지를 받는 좀비 스크립트 7 백호 2009.02.22 2010
1016 메뉴 화살표 모양 셀렉트 커서 사용 2 백호 2009.02.22 2118
1015 그래픽 화면을 부드럽게 해주는스크립트[ 아주 유용] 56 file - 하늘 - 2009.08.05 6566
1014 미니맵 화면에 축소된 미니맵을 표시하는 스크립트 - 한글 번역 - 6 file 백호 2009.02.21 2560
1013 화면에 축소된 맵을 표시하는 스크립트 7 file 백호 2009.02.21 2394
1012 기타 홈페이지 띄우기 (VX 상관없음.) 6 KNAVE 2009.08.25 2139
1011 메뉴 혹시있나해서-_-.. 대화창에 테두리치기 스크립트 7 백호 2009.02.22 2596
1010 기타 현재시간표시 33 file 코아 코스튬 2010.10.09 2529
1009 기타 현재 맵BGM을 그대로 전투 BGM으로 연결 from phylomortis.com 백호 2009.02.22 1180
1008 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 507
1007 메시지 한글자씩 뜨는 스크립트 6 백호 2009.02.21 3005
1006 키입력 한글입력스크립트 16 file 아방스 2007.11.09 11828
1005 키입력 한글입력기(자음, 모음 분리. 아마 중복일 듯...) 11 캉쿤 2011.09.13 3225
1004 키입력 한글입력기 6 백호 2009.02.22 4306
1003 이름입력 한글이름 입력기 스크립트 14 백호 2009.02.22 4211
1002 메시지 한글 채팅 스크립트 32 file こなた 2009.01.22 4947
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