Heigh ho', need all your help plz!
i have this menu and when i try to implement in my game...
but--- something doesn't work.
when i try to select the individual chara--- to status, equipement or ability, don't do right.
and the worst is this.
if i have only one member in the party, the menu you can let you select a empty space.
if you tap enter in the empty slot, show us a error.
who can i force the selection, in order to only can select the character space in party.
The code:
class Scene_Menu
#--------------------------------------------------------------------------
# - Object initialization
# menu_index : Cursor initial position of command
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# - Main processing
#--------------------------------------------------------------------------
def main
# Drawing up the command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Estado"
s5 = "Guardar"
s6 = "Salir"
#--------------------------- edit-------------------------------
# Command menu
# Size = Screen height - border sizes -
# GameStatus menu - Spacing from GameStatus
@command_window = Window_Command.new(160, [s1, s2, s3, s4, "Aprendizajes", s5, s6])
@command_window.x = - 20 - @command_window.width # 180 default
@command_window.y = 210
@command_window.z = 630 # 110 at at default
@command_window.index = @menu_index
@command_window.windowskin = RPG::Cache.windowskin("Dragon skin")
# When party number of people 0 is
if $game_party.actors.size == 0
# Nullifying the item, skill, equipment and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# In case of saving prohibition
if $game_system.save_disabled
# Saving is made invalid
@command_window.disable_item(4)
end
# Drawing up the play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 890
@playtime_window.y = 394
@playtime_window.z = 640
@playtime_window.opacity = 0
@playtime_window.windowskin = RPG::Cache.windowskin("Dragon skin")
# Drawing up the Gold window
@gold_window = Window_Gold.new
@gold_window.x = 890
@gold_window.y = 280
@gold_window.z = 640
@gold_window.height = 199
@gold_window.opacity = 0
@gold_window.windowskin = RPG::Cache.windowskin("Dragon skin")
#drawing up the map_name Window
@map = Window_Mapname.new
@map.x = 890
@map.y = 180 # 180 deafault
@map.z = 640 # decides wether window is on top of others or below
@map.height = 50
#@map.width = 550
@map.windowskin = RPG::Cache.windowskin("Dragon skin")
#Drawing up the Contents for the Party XP Window
@party_exp_window = Window_party_exp.new
@party_exp_window.x = 890
@party_exp_window.y = 262
@party_exp_window.z = 640
@party_exp_window.opacity = 255
@party_exp_window.height = 214 # must be over 221 to look right!
@party_exp_window.windowskin = RPG::Cache.windowskin("Dragon skin")
#-------------------------------------------------------------------------------
#- Help Windows Show Begin - Begin Customization Here
#-------------------------------------------------------------------------------
# - Before editing this section I wud advise you to create a bakup of the script so you can repast it in to correct any errors you make
#Drawing up the "location" Text Window 1
@Window_location_text = Window_location_text.new
@Window_location_text.x = 890 # 532 default
@Window_location_text.y = 148 #152 # must be 28 below map location
@Window_location_text.z = 640
@Window_location_text.height = 46
@Window_location_text.windowskin = RPG::Cache.windowskin("Dragon skin")
#Drawing up the Data_text Window
@Window_data_text = Window_data_text.new
@Window_data_text.x = 900 # 890 a sec
@Window_data_text.y = 248 #248 must be 38 above
@Window_data_text.z = 640
# @Window_data_text.width = 70
@Window_data_text.height = 44
@Window_data_text.windowskin = RPG::Cache.windowskin("Dragon skin")
#Drawing up the Command_Text Window
@Window_command_text = Window_command_text.new
@Window_command_text.x = -120 # 86 default
@Window_command_text.y = 182 #182
@Window_command_text.z = 640
@Window_command_text.windowskin = RPG::Cache.windowskin("Dragon skin")
#Drawing up the Background Window
@Background_window = Background_window.new
@Background_window.x = 0
@Background_window.y = 0
@Background_window.z = 0
@Background_window.opacity = 255
@Background_window.windowskin = RPG::Cache.windowskin("BackgroundSkin")
#Drawing up the actor Windows !!!Be careful when editing this section!!!!
@Window_exp_box = Window_exp_box.new
@Window_exp_box.x = - 10
@Window_exp_box.y = - 200
@Window_exp_box.z = 640
@Window_exp_box.opacity = 0
#Drawing up the Exp And Ap bars
@Window_party_box = Window_party_box.new
@Window_party_box.x = - 10
@Window_party_box.y = - 200
@Window_party_box.z = 650
@Window_party_box.opacity = 0
#-------------------------------------------------------------------------------
#- Help Windows Show End - End Of Customization
#-------------------------------------------------------------------------------
# Drawing up the status window
@status_window = Window_MenuStatus.new
@status_window.x = - 10 #160 default
@status_window.y = - 200 # - 120
@status_window.z = 600
#@status_window.width = 450
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# ??????
update
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# Releasing the window
@command_window.dispose
@playtime_window.dispose
@gold_window.dispose
@status_window.dispose
@party_exp_window.dispose
@map.dispose
@Window_command_text.dispose
@Window_data_text.dispose
@Window_location_text.dispose
@Window_exp_box.dispose
@Window_party_box.dispose
@Background_window.dispose
end
#--------------------------------------------------------------------------
#Defining the delay
#--------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
# - Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the window
@command_window.update
@status_window.update
@playtime_window.update
@gold_window.update
@party_exp_window.update
@map.update
@Window_exp_box.update
@Window_party_box.update
#Moving Windows inplace (only when open Menu not when Exit)
#Moving Status Window
if @status_window.y < 0 # 60 before ok
@status_window.y += 16 # 25
end
#Moving the Window_exp_box
if @Window_exp_box.y < 0 # 50
@Window_exp_box.y +=16
end
#Moving the Ap, Hp bars
if @Window_party_box.y < 0 # 50
@Window_party_box.y +=16
end
#Moving command Window
if @command_window.x < - 9
@command_window.x += 34 #= 60
end
#Moving Party Exp Window
if @party_exp_window.x > 460
@party_exp_window.x -= 20
end
#Moving Gold Window
if @gold_window.x > 460
@gold_window.x -= 20
end
#Moving Playtime Window
if @playtime_window.x > 460
@playtime_window.x -= 20
end
#Moving the "location" window
if @Window_location_text.x > 520
@Window_location_text.x -= 20
end
#Moving Map Window
if @map.x > 320
@map.x -= 20
end
#Moving the Data_Help Window
if @Window_data_text.x > 500 # 560
@Window_data_text.x -= 20
end
#Moving the Command Help Window
if @Window_command_text.x < - 14
@Window_command_text.x += 208
end
# When the command window is active,: Update_command is called
if @command_window.active
update_command
return
end
# When the status window is active,: Update_status is called
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# - When frame renewal (the command window is active)
#--------------------------------------------------------------------------
def update_command
# The B when button is pushed
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to map picture
$scene = Scene_Map.new
return
end
# When C button is pushed
if Input.trigger?(Input::C)
# When party number of people with 0,its command other than saving and game end
if $game_party.actors.size == 0 and @command_window.index < 4
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# It diverges at cursor position of the command window
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # learning status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 6 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# - When frame renewal (the status window is active)
#--------------------------------------------------------------------------
def update_status
# The B when button is pushed
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# The command window is made active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# When C button is pushed
if Input.trigger?(Input::C)
# It diverges at cursor position of the command window
case @command_window.index
when 1 # Skill
# When conduct restriction of this actor is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to skill picture
$scene = Scene_Skill.new(@status_window.index)
when 2 # Equipment
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to equipment picture
$scene = Scene_Equip.new(@status_window.index)
when 3 # Status
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to status picture
$scene = Scene_Status.new(@status_window.index)
when 4 # learning status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Learning_Status.new(@status_window.index)
end
return
end
end
end
#-------------------------------------------------------------------------------
# - This is the Class that Handles the Creation of character Faces
#Create a new folder in the Characters folder, and call it Faces
#Adding faces: add a 80x80 picture with the same name as the characterset it
#corrosponds with in the Faces folder
#- ie: Arshes is 001-Fighter01 ect.
#If you do not want Faces, go to line 102
#and change delete the # of draw_actor_graphic
#and put a # infront of draw_actor_face
class Window_Base < Window
def draw_actor_face(actor, x, y)
face = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh) #0, 0
self.contents.blt(x - fw / 133, y - fh, face, src_rect) # 23
end
end
def draw_actor_battler_graphic(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)# 2
end
#-------------------------------------------------------------------------------
# - This is the class that creates and calculates the Total party Exp
#-------------------------------------------------------------------------------
class Window_party_exp < Window_Base # Begins
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 200) #0, 0, 160, 200
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 21
self.contents.font.name = "Georgia"
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(- 0, 56, 120, 32, "Exp. del Equipo:", 2) # 62
self.contents.font.color = system_color
$game_variables[12] = $game_actors[1].exp + $game_actors[2].exp + $game_actors[3].exp
self.contents.draw_text(8, 98, 120, 32,$game_variables[12].to_s, 2)
end
end # End of Window_party_exp
#========================================
#? Game_Map
#--------------------------------------------------------------------------------
# Setting functions for the Map # needed to create Location bar in menu
#========================================
class Game_Map
def name
$map_infos[@map_id]
end
end
#========================================
#? Window_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
#==============================================================================
# ? Window_Mapname
#------------------------------------------------------------------------------
# ?Draws the Map name
#==============================================================================
class Window_Mapname < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 50) # 360, 60
self.contents = Bitmap.new(width - 52, height - 32)
self.contents.font.name = "Georgia"
self.contents.font.size = 21
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Map Name
#map = $game_map.name
self.contents.font.color = system_color
self.contents.draw_text(0, - 8, 350, 32, $game_map.name) #120, 0, 170, 32
end
end
#--------------------------------------------------------------------------
# This creates the description windows delete if unwanted
# - ? - Window "Location" text Begins
#--------------------------------------------------------------------------
# Makes the Extra Window holding the text "location"
class Window_location_text < Window_Base
def initialize
super(0, 0, 120, 42) #92 & 42
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial Rounded MT Bold"
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(0, - 11, 200, 32, "Ubicación")
end
end
#--------------------------------------------------------------------------
# # - ? - Window_data_text Begins
#--------------------------------------------------------------------------
# Makes the Extra Window holding the text "Data"
class Window_data_text < Window_Base
def initialize
super(0, 0, 120, 42) # 360, 60
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial Rounded MT Bold"
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(0, - 11, 160, 32, "Información")
end
end
#--------------------------------------------------------------------------
# # - ? - Window_command_text Begins
#--------------------------------------------------------------------------
# Makes the Extra Window holding the text "Command"
class Window_command_text < Window_Base
def initialize
super(0, 0, 98, 42)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial Rounded MT Bold"
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(0, - 11, 160, 32, "Menú")
end
end
#-------------------------------------------------------------------------------
# - ?- Window_help_text Ends !.!All the Help Text Windows End Here!.!
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# - This creates the Party Exp boxes - IMPORTANT DONT DELETE!
#-------------------------------------------------------------------------------
class Window_party_box < Window_Base
def initialize
super (0, 0, 650, 650)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.color = system_color
self.contents.font.size = 16
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 0
x = i * 160
actor = $game_party.actors[i]
draw_actor_hp(actor, x + 38, y + 6)
draw_actor_sp(actor, x + 38, y + 36)
# draw_actor_name(actor, x + 20, - 14)
end
end
end
#-------------------------------------------------------------------------------
# - Refreshing the window - IMPORTANT DONT DELETE!
#-------------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 0
x = i * 160
actor = $game_party.actors[i]
draw_actor_hp(actor, x + 38, y + 6)
draw_actor_sp(actor, x + 38, y + 36)
self.contents.font.size = 20
end
end
#-------------------------------------------------------------------------------
# - This creates the actor Graphic !IMPORTANT DONT DELETE!
#-------------------------------------------------------------------------------
class Window_exp_box < Window_Base
def initialize
super (0, 0, 880, 680)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.color = system_color
self.contents.font.size = 16
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 10
x = i * 160
actor = $game_party.actors[i]
draw_actor_graphic(actor, x + 21, y + 56)
end
end
end
#-------------------------------------------------------------------------------
# - Refreshing the window !IMPORTANT DONT DELETE!
#-------------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 10
x = i * 160
actor = $game_party.actors[i]
draw_actor_graphic(actor, x + 12, y + 56)
end
end
#-------------------------------------------------------------------------------
# - Background_Window - This creates the background window
#-------------------------------------------------------------------------------
#This creates the Background Window (You can chose your own Windowskin for this)
class Background_window < Window_Base
def initialize
super(0, 0, 640, 680)
#@windowname.windowskin = RPG::Cache.windowskin(@"001-Blue01")
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial Rounded MT Bold"
self.contents.font.color = system_color
self.contents.font.size = 16
end
end
#==============================================================================
# ¡ Window_Base
#------------------------------------------------------------------------------
# I think this adds a new function to the Window_Base Class
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# EXP Bar setup (I didnt actually use this but I thought others might want to
#--------------------------------------------------------------------------
# ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æ‚ð draw_actor_sp_original ‚Æ–¼‘O•ÏX
alias :draw_actor_exp_original :draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
# •Ï”rate‚É Œ»Ý‚Ìexp/nextexp‚ð‘ã“ü
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# plus_x:XÀ•W‚̈ʒu•â³ rate_x:XÀ•W‚̈ʒu•â³(%) plus_y:YÀ•W‚̈ʒu•â³
# plus_width:•‚Ì•â³ rate_width:•‚Ì•â³(%) height:c•
# align1:•`‰æƒ^ƒCƒv1 0:¶‹l‚ß 1:’†‰›‘µ‚¦ 2:‰E‹l‚ß
# align2:•`‰æƒ^ƒCƒv2 0:ã‹l‚ß 1:’†‰›‘µ‚¦ 2:‰º‹l‚ß
# align3:ƒQ[ƒWƒ^ƒCƒv 0:¶‹l‚ß 1:‰E‹l‚ß
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0 # edit to suite your needs
rate_width = 50 # edit to suite your needs
height = 7 #larger numbers make the box bigger
align1 = 0
align2 = 1
align3 = 0
# ƒOƒ‰ƒf[ƒVƒ‡ƒ“Ý’è grade1:‹óƒQ[ƒW grade2:ŽÀƒQ[ƒW
# (0:‰¡‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“ 1:c‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf[ƒVƒ‡ƒ“(Œƒd)j
grade1 = 1
grade2 = 0
# FÝ’èBcolor1:ŠO˜gCcolor2:’†˜g
# color3:‹óƒQ[ƒWƒ_[ƒNƒJƒ‰[Ccolor4:‹óƒQ[ƒWƒ‰ƒCƒgƒJƒ‰[
# color5:ŽÀƒQ[ƒWƒ_[ƒNƒJƒ‰[Ccolor6:ŽÀƒQ[ƒWƒ‰ƒCƒgƒJƒ‰[
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# •Ï”exp‚É•`‰æ‚·‚éƒQ[ƒW‚Ì•‚ð‘ã“ü
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
# ƒQ[ƒW‚Ì•`‰æ
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æˆ—‚ðŒÄ‚Ño‚µ
draw_actor_exp_original(actor, x, y)
end
#--------------------------------------------------------------------------
# œ ƒQ[ƒW‚Ì•`‰æ
#--------------------------------------------------------------------------
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
# ˜g•`‰æ
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# ‹óƒQ[ƒW‚Ì•`‰æ
self.contents.gradation_rect(x + 2, y + 2, width - 5, height - 5,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# ŽÀƒQ[ƒW‚Ì•`‰æ
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
#------------------------------------------------------------------------------
# @BitmapƒNƒ‰ƒX‚ÉV‚½‚È‹@”\‚ð’ljÁ‚µ‚Ü‚·B
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# œ ‹éŒ`‚ðƒOƒ‰ƒf[ƒVƒ‡ƒ“•\Ž¦
# color1 : ƒXƒ^[ƒgƒJƒ‰[
# color2 : ƒGƒ“ƒhƒJƒ‰[
# align : 0:‰¡‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
# 1:c‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
# 2:ŽÎ‚߂ɃOƒ‰ƒf[ƒVƒ‡ƒ“iŒƒd‚ɂ‚«’ˆÓj
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
#==============================================================================
# ¡ Spriteƒ‚ƒWƒ…[ƒ‹ im not really sure on this as the description wasn't english
#------------------------------------------------------------------------------
# I think it the setup for the different colors for different stats (js a guess)
#==============================================================================
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80 + self.viewport.ox
@_damage_sprite.oy = 20 + self.viewport.oy
@_damage_sprite.x = self.x + self.viewport.rect.x
@_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
@_damage_sprite.z = 3000
@_damage_duration = 40
end
def animation(animation, hit)
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def loop_animation(animation)
return if animation == @_loop_animation
dispose_loop_animation
@_loop_animation = animation
return if @_loop_animation == nil
@_loop_animation_index = 0
animation_name = @_loop_animation.animation_name
animation_hue = @_loop_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_loop_animation_sprites = []
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_loop_animation_sprites.push(sprite)
end
update_loop_animation
end
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
sprite.y = self.y + self.viewport.rect.y -
self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end
#--------------------------------------------------------------------------------
# * Window_MenuStatus
#------------------------------------------------------------------------------
#It is the window which indicates the stats of the party member in menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 680, 480) # 640, 480
self.contents = Bitmap.new(width - 32, height - 32) # - 32, - 32
self.contents.font.size = 21
self.contents.font.name = "Georgia"
self.contents.font.color = system_color
self.opacity = 0
@column_max = 4
@item_max = 4
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# - All party members (FIX) !You all asked for it here it is!
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 0
x = i * 160 #x + 50
actor = $game_party.actors[i]
draw_actor_face(actor, x + 2, y + 80)
self.opacity = 0 # musy be changed to 255 when checking to make block curser
self.contents.font.color = system_color
end
end
end
#--------------------------------------------------------------------------
# - Rectangle renewal of cursor
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(160 + index * 260, 190, 428, 432)
end
class Window_Base
def draw_actor_hp(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 - 20, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 28, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 40, y, 48, 32, actor.maxhp.to_s)
end
end
def draw_actor_sp(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 - 20, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 28, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 40, y, 48, 32, actor.maxsp.to_s)
end
end
end
Demo:
Thx for your time.
See ya' later
[/code]