Kolejny skrypt znaleziony przez użytkownika z rmxp.pl
CMS- Custom Menu System
Zmienia wygląd menu oraz pokazuje animację postaci. Animacja może pokazać czy char jest dobrze złożony.
Skrypt:
Spoiler:
Kod:
#============================================================
# Custom Menu System
# created by: Constance
# created on: Dec. 26, 2005
# version: 2.2
# credits: Acedent Prone, Diego, Dubealex, Catchm
# special thanks credits goes to: SephirothSpawn, couldn't have done it without you
# RMXP - Underground - The Underground Gaming Zone
#Tłumaczenie by Harvester (jak użyjesz creditsy dla mnie).
#Poprawiony by Harvester.
#============================================================
class Window_Base < Window
def draw_actor_level(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x + 4, y + 20, 24, 32, actor.level.to_s, 2)
end
def draw_sprite(x, y, name, hue, pose, frame)
bitmap = RPG::Cache.character(name, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
case pose
when 0;a = 0
when 1;a = ch
when 2;a = ch * 3
when 3;a = ch * 2
end
case frame
when 0;b = 0
when 1;b = cw
when 2;b = cw * 2
when 3;b = cw * 3
end
src_rect = Rect.new(b, a, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.name = "Tahoma"
self.contents.font.size = 20
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x + 30, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 30 + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 30 + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#============================================
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.name = "Tahoma"
self.contents.font.size = 20
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
self.contents.font.color = Color.new(74, 230, 51, 225)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x + 30, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 30 + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 30 + 60, y, 48, 32, actor.maxsp.to_s)
end
end
def draw_actor_level3(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Level")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
def draw_actor_hp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
def draw_actor_sp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 144, 32, actor.name)
end
def draw_actor_parameter2(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = "Obrona fizyczna"
parameter_value = actor.pdef
when 2
parameter_name = "Obrona magiczna"
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
end
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.draw_text(x, y, 130, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 130, y, 36, 32, parameter_value.to_s, 2)
end
def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
if type == "horizontal"
width = length
height = thick
self.contents.fill_rect(x-1, y - 1, width + 1, height + 3, Color.new(0, 0, 0, 255))
self.contents.fill_rect(x, y, width + 1, height + 1, Color.new(0, 0, 0, 255))
w = width * e1.to_f / e2.to_f
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 255 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 255 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 255 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x-1, y - 1, width + 1, height + 3, Color.new(255, 255, 255, 255))
end
end
end
end
class Window_Selectable2 < Window_Base
attr_reader :index
attr_reader :help_window
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
def index=(index)
@index = index
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end
def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end
def help_window=(help_window)
@help_window = help_window
if self.active and @help_window != nil
update_help
end
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
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x, y, 32, 32)
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::DOWN)
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
if Input.repeat?(Input::UP)
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
if Input.repeat?(Input::RIGHT)
if @column_max >= 2 and @index < @item_max - 1
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end
if Input.repeat?(Input::LEFT)
if @column_max >= 2 and @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
if Input.repeat?(Input::R)
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
if Input.repeat?(Input::L)
if self.top_row > 0
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
end
def refresh
self.contents.clear
self.contents.font.color = system_color
cx = contents.text_size("Którą postać chciałbyś wybrać?").width
self.contents.draw_text(145, -6, cx, 32, "Którą postać chciałbyś wybrać?", 2)
end
end
#--------------------------------------------------------------------------
# * Draw Sprite
#--------------------------------------------------------------------------
def draw_sprite(x, y, name, hue, stance)
bitmap = RPG::Cache.character(name, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
# Current Animation Slide
case (Graphics.frame_count / Graphics.frame_rate) % 4
when 0
x_off = 0
when 1
x_off = cw
when 2
x_off = cw * 2
when 3
x_off = cw * 3
end
# Facing Direction
case stance
when 0 # Down
y_off = 0
when 1 # Left
y_off = ch
when 2 # Up
y_off = ch * 3
when 3 # Right
y_off = ch * 2
end
# Bitmap Rectange
src_rect = Rect.new(x_off, y_off, cw, ch)
# Draws Bitmap
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Checks to Refresh Contents
if Graphics.frame_count / Graphics.frame_rate >= @last_frame + 1
@last_frame = Graphics.frame_count / Graphics.frame_rate
refresh
end
end
#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
# This window class contains cursor movement and scroll functions.
#==============================================================================
class Window_Selectable3 < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :index # cursor position
attr_reader :help_window # help window
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
#--------------------------------------------------------------------------
# * Set Cursor Position
# index : new cursor position
#--------------------------------------------------------------------------
def index=(index)
@index = index
# Update Help Text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Get Row Count
#--------------------------------------------------------------------------
def row_max
# Compute rows from number of items and columns
return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of 32
return self.oy / 32
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 32 for y-coordinate of window contents
# transfer origin
self.oy = row * 32
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Subtract a frame height of 32 from the window height, and divide it by
# 1 row height of 32
return (self.height - 32) / 32
end
#--------------------------------------------------------------------------
# * Get Number of Items Displayable on 1 Page
#--------------------------------------------------------------------------
def page_item_max
# Multiply row count (page_row_max) times column count (@column_max)
return page_row_max * @column_max
end
#--------------------------------------------------------------------------
# * Set Help Window
# help_window : new help window
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# Update cursor rectangle
if $game_party.actors.size < 2
self.cursor_rect.set(250 + @index * 140, y, 100, 20)
else
self.cursor_rect.set(160 + @index * 140, y, 150, 20)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If cursor is movable
if self.active and @item_max > 0 and @index >= 0
# If pressing down on the directional buttons
if Input.repeat?(Input::DOWN)
# If column count is 1 and directional button was pressed down with no
# repeat, or if cursor position is more to the front than
# (item count - column count)
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
# Move cursor down
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
# If column count is 1 and directional button was pressed up with no
# repeat, or if cursor position is more to the back than column count
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
# Move cursor up
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
# If column count is 2 or more, and cursor position is closer to front
# than (item count -1)
if @column_max >= 2 and @index < @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
# If column count is 2 or more, and cursor position is more back than 0
if @column_max >= 2 and @index > 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
# If R button was pressed
if Input.repeat?(Input::R)
# If bottom row being displayed is more to front than bottom data row
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# Move cursor 1 page back
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
# If L button was pressed
if Input.repeat?(Input::L)
# If top row being displayed is more to back than 0
if self.top_row > 0
# Move cursor 1 page forward
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
end
def initialize
$game_temp = Game_Temp.new
$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("Które wczytać?")
end
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end
def set_new_parameters(new_atk, new_pdef, new_mdef)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
refresh
end
end
end
def refresh
self.contents.clear
if $game_party.actors.size < 2
self.contents.clear
else
actor = $game_party.actors[1]
draw_actor_battler(actor, x + 130, y + 200)
end
end
end
def main
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
def update
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
if @skill_window.active
update_skill
return
end
if @target_window.active
update_target
return
end
end
def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @skill.scope >= 3
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
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 1
$game_system.se_play($data_system.decision_se)
case @window_character_selection1.index
when 0
$scene = Scene_Skill2.new(@window_character_selection1.index)
when 1
$scene = Scene_Skill2.new(@window_character_selection1.index)
end
when 2
$game_system.se_play($data_system.decision_se)
case @window_character_selection1.index
when 0
$scene = Scene_Equip2.new(@window_character_selection1.index)
when 1
$scene = Scene_Equip2.new(@window_character_selection1.index)
end
end
return
end
end
end
są tu podane nazwy ikon można je zmieniać i muszą się tak samo nazywać.
Tutaj macie, która co oznacza.
1.Przedmioty
2.Umiejętności
3.Ekwipunek
4.Wczytanie
5.Zapis
6.Wyjście
Mam nadzieję, że skorzystacie. Autor jest w skrypcie.
________________________ ...Amelanduil & FireBlade words will be remembered... ...Amelanduil & FireBlade acts will be remembered... ...Amelanduil & FireBlade never gonna die...
Nie pisać, bo nie odpiszę.
Ostatnio zmieniony przez Ayene Pon 03 Maj, 2010 09:17, w całości zmieniany 1 raz
Linijka 344-346.
Wystarczy że je usuniesz. Te niżej czyli 347-349 też możesz usunąć.
U mnie działa.
________________________ ...Amelanduil & FireBlade words will be remembered... ...Amelanduil & FireBlade acts will be remembered... ...Amelanduil & FireBlade never gonna die...
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum