Conectarse
Buscar
Últimos temas
Los posteadores más activos del mes
No hay usuarios |
Estadísticas
Tenemos 98 miembros registradosEl último usuario registrado es Lawdesifi
Nuestros miembros han publicado un total de 6208 mensajes en 777 argumentos.
Inventario estilo diablo
Drupogame :: RPG Maker :: RPG maker XP :: Scripts
Página 1 de 1.
Inventario estilo diablo
Hola makeradictos hoy les trigo un script con el que me acabo de encontrar, aun no lo he probado, pero bueno lo que hace es colocar un inventario estilo diablo
- Spoiler:
- Código:
#==========================================================================#====
# Sistema de Inventário Estilo Mu e Diablo 2.0
# ou Diablo Waypoint, como muitos preferem dizer...
#------------------------------------------------------------------------------
# Criado por DarkSchneider
# Adaptado por Raphael Nunes
#------------------------------------------------------------------------------
=begin
O script cria um menu de itens de slots, semelhantes ao que vemos em
jogos como Diablo, Mu, Dungeon Siege e assim vai...
Ótimo para quem está fazendo um game de ABS, e quer que seu inventário seja
limitado...
Ai vocíª deve estar se perguntando... O que esse palhaço fez?
Ai eu respondo:
Esse palhaço (eu) adaptei o script para funcionar em qualquer script de menu,
seja ele complexo ou não, seja o jogo online ou não...Alem de traduzir certas coisas
e adicionar algumas coisas que faziam o script dar incompatibilidade com o SDK...
Do que ele prescisa: Apenas que cada Character tenha um Battlers com o mesmo nome, se
o character se chamar Zé_Peneira, o Battler tambem deve se chamar Zé_Peneira...
O resto...Bem...É o resto... ^^
Podem acreditar...É um ótimo script...
Caso queiram mudar o tamanho dos slots dos itens, bem,,,Melhor tirar o cavalinho
da chuva, pois para fazer isso, será nescessário modificar todos os cáuculos do
sistema...
Para usar, apenas coloque o acima do Main e acima tambem do sue menu...
E pronto...
PS: Seu menu não pode modificar o Scene_Item...
=end
#==============================================================================
class Scene_Item
def initialize(actor_index = 0)
@actor_index = actor_index
end
def main
# Make help window, item window
s1 = "Usar"
s2 = "Mover"
s3 = "jogar"
@command_window = Window_Command.new(193, [s1, s2 , s3])
@command_window.y = 64
@help_window = Window_Help.new
@grid = Window_Grid.new(@actor_index)
@grid.active = false
# Associate help window
@grid.help_window = @help_window
# Make target window (set to invisible / inactive)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
@window_pc = Window_Base.new(0,192,193,287)
@window_pc.contents = Bitmap.new(161,255)
@window_pc.draw_actor_name($game_party.actors[@actor_index], 10, 0)
@window_pc.draw_actor_picture($game_party.actors[@actor_index], 80, 250)
# 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
@cursor_icon.dispose if @cursor_icon != nil
# Dispose of windows
@command_window.dispose
@help_window.dispose
#@item_window.dispose
@target_window.dispose
@grid.dispose
@window_pc.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@help_window.update
@target_window.update
@grid.update
if @command_window.active
update_command
return
end
# If item window is active: call update_item
if @grid.active
case @grid.mode
when 0
update_usa
when 1
@cursor_icon = Cursor_Icon.new if @cursor_icon == nil
@cursor_icon.visible = false
update_muovi
when 2
update_lascia
when 3
@cursor_icon.update
update_muovi2
end
return
end
# If target window is active: call update_target
if @target_window.active
update_target
return
end
end
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 menu screen
$scene = Scene_Menu.new(0)
return
end
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # use
# Play decision SE
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@grid.active = true
@grid.set = 0
@grid.mode = @command_window.index
when 1 # move
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@grid.active = true
@grid.set = 0
@grid.mode = @command_window.index
when 2 # drop
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@grid.active = true
@grid.set = 0
@grid.mode = @command_window.index
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_usa
# 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
@command_window.active = true
@grid.active = false
@grid.set = - 1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @grid.item
# If not a use item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If it can't be used
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is an ally
if @item.scope >= 3
# Activate target window
@grid.active = false
#@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# If effect scope is other than an ally
else
# If command event ID is valid
if @item.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @item.common_event_id
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1, false)
# Draw item window item
@grid.delete_item
end
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If unable to use because items ran out
unless $game_party.item_can_use?(@item.id)
# Remake item window contents
@grid.refresh
end
# Erase target window
@grid.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If items are used up
if @grid.item_del?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply item effects to entire party
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# If single target
if @target_window.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# If an item was used
if used
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1, false)
# Redraw item window item
@grid.delete_item
end
# Remake target window contents
@target_window.refresh
# If all party members are dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If common event ID is valid
if @item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @item.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
def update_muovi
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
@command_window.active = true
@grid.active = false
@grid.set = - 1
return
end
if Input.trigger?(Input::C)
if @grid.item != nil
@grid.get_item
bitmap = Bitmap.new(32,32)
x = 4 + (@grid.cursor_rect.width == 32 ? 0 : 18)
y = 4 + (@grid.cursor_rect.height == 32 ? 0 : 32)
bitmap.blt(0,0,@grid.contents,Rect.new(@grid.cursor_rect.x + x,
@grid.cursor_rect.y + y,@grid.cursor_rect.width,@grid.cursor_rect.height))
@cursor_icon.refresh(bitmap, @grid.item_saved[1])
@grid.cursor_rect.width = @cursor_icon.bitmap.width
@grid.cursor_rect.height = @cursor_icon.bitmap.height
@cursor_icon.x = @grid.cursor_rect.x + @grid.x + 16
@cursor_icon.y = @grid.cursor_rect.y + @grid.y + 16
@cursor_icon.visible = true
@grid.delete_item
@grid.mode = 3
end
return
end
end
def update_lascia
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
@command_window.active = true
@grid.active = false
@grid.set = - 1
return
end
if Input.trigger?(Input::C)
if @grid.item != nil
@grid.delete_item
end
return
end
end
def update_muovi2
@grid.cursor_rect.width = @cursor_icon.bitmap.width
@grid.cursor_rect.height = @cursor_icon.bitmap.height
@cursor_icon.x = @grid.cursor_rect.x + @grid.x + 16
@cursor_icon.y = @grid.cursor_rect.y + @grid.y + 16
if @grid.empty?
@cursor_icon.blink_on
@cursor_icon.tone.set(0,0,0,0)
else
@cursor_icon.blink_off
@cursor_icon.tone.set(0,0,0,255)
end
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
@grid.redraw_item(false)
@grid.mode = 1
return
end
if Input.trigger?(Input::C)
if @grid.empty?
@grid.redraw_item
@cursor_icon.visible = false
@grid.mode = 1
end
return
end
end
end
class Window_Selectable < Window_Base
alias old_initialize initialize
def initialize(x, y, width, height)
old_initialize(x, y, width, height)
if self.is_a?(Window_Grid)
@x = 0
@y = 0
end
end
alias old_update update
def update
if !self.is_a?(Window_Grid)
old_update
return
end
super
item = $game_party.actors[@actor_index].item_grid
# If cursor is movable
if self.active and @item_max > 0 and @x >= 0
# If pressing down on the directional buttons
if Input.repeat?(Input::DOWN)
@y = -1 if @y == item.size - (self.cursor_rect.height == 96 ? 3 : 1)
@y += 2 if item[@y][@x][1] == "w" or item[@y][@x][1] == "a"
if item[@y + 1][@x][1] == "r" and item[@y + 1][@x - 1][1] == "a"
@x -= 1
end
@y += 1
$game_system.se_play($data_system.cursor_se)
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
@y = item.size if @y - 1 == -1
@y -= 2 if item[@y - 1][@x][1] == "e" or item[@y - 1][@x][1] == "r"
@x -= 1 if item[@y - 1][@x - 1][1] == "a"
@y -= 1
$game_system.se_play($data_system.cursor_se)
end
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
if @x + (self.cursor_rect.width == 64 ? 2 : 1) == item[@y].size
@x = 0
@y -= 1 if item[@y - 1][@x][1] == "a"
@y -= 2 if item[@y - 2][@x][1] == "a"
else
@x += 1 if item[@y][@x][1] == "a"
if item[@y][@x + 1][1] == "r"
@y -= 1 if item[@y - 1][@x + 1][1] == "a"
@y -= 2 if item[@y - 2][@x + 1][1] == "a"
end
if item[@y][@x + 1][1] == "e"
@y -= 1
@y -= 1 if item[@y - 1][@x + 1][1] == "w"
end
@x += 1
end
$game_system.se_play($data_system.cursor_se)
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
@x = item[@y].size if @x - 1 == -1
if item[@y][@x - 1][1] == "r"
@x -= 1
@y -= 1 if item[@y - 1][@x - 1][1] == "a"
@y -= 2 if item[@y - 2][@x - 1][1] == "a"
end
if item[@y][@x - 1][1] == "e"
@y -= 1
@y -= 1 if item[@y - 1][@x - 1][1] == "w"
end
@x -= 1
$game_system.se_play($data_system.cursor_se)
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
class Window_Grid < Window_Selectable
attr_accessor :mode
attr_reader :item_saved
def initialize(actor_index)
super(192,64,448,416)
self.contents = Bitmap.new(width - 32, height - 32) #icone oggetti
self.opacity = 0
@window = Window_Base.new(x , y , width, height) #griglia bianca
@window.contents = Bitmap.new(width - 32, height - 32)
@window.z = self.z - 4
@grid_color = Sprite.new #colori oggetti
@grid_color.bitmap = Bitmap.new(width - 32, height - 32)
@grid_color.x = self.x + 16
@grid_color.y = self.y + 16
@grid_color.z = @window.z + 2
@actor_index = actor_index
@mode = 0
@mini_help = Mini_Help.new
self.set = -1
n = self.contents.width / 32
m = self.contents.height / 32
@column_max = n
draw_grid
refresh
end
def draw_grid
@window.contents.fill_rect(0, 0, width - 32, height - 32, Color.new(255,255,255))
i = 0
color = Color.new(0,0,0)
while i < self.contents.height
draw_line(0, i, self.contents.width, i, color)
i += 32
end
i = 0
while i < self.contents.width
draw_line(i, 0, i, self.contents.width, color)
i += 32
end
end
def draw_line(sx, sy, ex, ey, color)
rad = Math.atan2(ey-sy, ex-sx)
dx = Math.cos(rad)
dy = Math.sin(rad)
while (sx - ex).abs > 1 || (sy - ey).abs > 1
sx += dx
sy += dy
@window.contents.set_pixel(sx, sy, color)
end
end
def refresh
@item_max = 0
item = $game_party.actors[@actor_index].item_grid
for i in 0..item.size - 1
for j in 0..item[i].size - 1
if item[i][j][0]!= 0 and item[i][j][1] != "r" and item[i][j][1] != "e"
@item_max += 1
end
end
end
for i in 0..item.size - 1
for j in 0..item[i].size - 1
draw_item(item[i][j][0], item[i][j][1], i , j)
end
end
end
def update_cursor_rect
# If cursor position is less than 0
if @x < 0
self.cursor_rect.empty
return
end
# Calculate cursor width
case $game_party.actors[@actor_index].item_grid[@y][@x][1]
when "i"
cursor_width = 32
cursor_height = 32
when "w"
cursor_width = 32
cursor_height = 96
when "a"
cursor_width = 64
cursor_height = 96
else
cursor_width = 32
cursor_height = 32
end
# Calculate cursor coordinates
x = @x * 32
y = @y * 32
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, cursor_height)
end
def delete_item
case $game_party.actors[@actor_index].item_grid[@y][@x][1]
when "i"
@grid_color.bitmap.fill_rect(@x*32+1, @y*32+1, 31, 31, Color.new(0,0,0,0))
self.contents.fill_rect(@x*32, @y*32, 32, 32, Color.new(0,0,0,0))
$game_party.actors[@actor_index].item_grid[@y][@x][0] = 0
$game_party.actors[@actor_index].item_grid[@y][@x][1] = ""
when "w"
@grid_color.bitmap.fill_rect(@x*32+1, @y*32+1, 31, 95, Color.new(0,0,0,0))
self.contents.fill_rect(@x*32, @y*32 + 4 + 32, 32, 32, Color.new(0,0,0,0))
$game_party.actors[@actor_index].item_grid[@y][@x][0] = 0
$game_party.actors[@actor_index].item_grid[@y][@x][1] = ""
$game_party.actors[@actor_index].item_grid[@y + 1][@x][0] = 0
$game_party.actors[@actor_index].item_grid[@y + 1][@x][1] = ""
$game_party.actors[@actor_index].item_grid[@y + 2][@x][0] = 0
$game_party.actors[@actor_index].item_grid[@y + 2][@x][1] = ""
when "a"
@grid_color.bitmap.fill_rect(@x*32+1, @y*32+1, 63, 95, Color.new(0,0,0,0))
self.contents.fill_rect(@x*32 + 18, @y*32 + 4 + 32, 32, 32, Color.new(0,0,0,0))
$game_party.actors[@actor_index].item_grid[@y][@x][0] = 0
$game_party.actors[@actor_index].item_grid[@y][@x][1] = ""
$game_party.actors[@actor_index].item_grid[@y + 1][@x][0] = 0
$game_party.actors[@actor_index].item_grid[@y + 1][@x][1] = ""
$game_party.actors[@actor_index].item_grid[@y + 2][@x][0] = 0
$game_party.actors[@actor_index].item_grid[@y + 2][@x][1] = ""
$game_party.actors[@actor_index].item_grid[@y][@x + 1][0] = 0
$game_party.actors[@actor_index].item_grid[@y][@x + 1][1] = ""
$game_party.actors[@actor_index].item_grid[@y + 1][@x + 1][0] = 0
$game_party.actors[@actor_index].item_grid[@y + 1][@x + 1][1] = ""
$game_party.actors[@actor_index].item_grid[@y + 2][@x + 1][0] = 0
$game_party.actors[@actor_index].item_grid[@y + 2][@x + 1][1] = ""
end
end
def item
i = $game_party.actors[@actor_index].item_grid[@y][@x][0]
case $game_party.actors[@actor_index].item_grid[@y][@x][1]
when "i"
return $data_items[i]
when "w"
return $data_weapons[i]
when "a"
return $data_armors[i]
else return nil
end
end
def item_del?
if $game_party.actors[@actor_index].item_grid[@y][@x][0] == 0
# Unusable
return true
else
return false
end
end
def dispose
super
@window.dispose
@grid_color.dispose
@mini_help.dispose
end
def update_help
@mini_help.contents.font.color = (($game_party.item_can_use?(item.id) and item.is_a?(RPG::Item))? normal_color : disabled_color)
@help_window.set_text(item == nil ? "" : item.description)
@mini_help.set_text(item == nil ? "" : item.name)
@mini_help.visible = false if item == nil
@mini_help.x = self.cursor_rect.x + self.cursor_rect.width + 192 +
(self.contents.width - self.cursor_rect.x - self.cursor_rect.width < @mini_help.width ? -@mini_help.width : 18)
@mini_help.y = self.cursor_rect.y + self.cursor_rect.height + 64 +
(self.contents.height - self.cursor_rect.y - self.cursor_rect.height < @mini_help.height ? -@mini_help.height : 18)
end
def get_item
@item_saved = [$game_party.actors[@actor_index].item_grid[@y][@x][0],
$game_party.actors[@actor_index].item_grid[@y][@x][1], @x, @y]
end
def redraw_item(f = true)
if f
x = 4 + (@x * 32)
y = @y * 32
else
x = 4 + (@item_saved[2] * 32)
y = @item_saved[3] * 32
tx = @x
ty = @y
@x = @item_saved[2]
@y = @item_saved[3]
end
draw_item(@item_saved[0], @item_saved[1], @y , @x)
case @item_saved[1]
when "i"
$game_party.actors[@actor_index].item_grid[@y][@x][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y][@x][1] = @item_saved[1]
when "w"
$game_party.actors[@actor_index].item_grid[@y][@x][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y][@x][1] = @item_saved[1]
$game_party.actors[@actor_index].item_grid[@y + 1][@x][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y + 1][@x][1] = "e"
$game_party.actors[@actor_index].item_grid[@y + 2][@x][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y + 2][@x][1] = "e"
when "a"
$game_party.actors[@actor_index].item_grid[@y][@x][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y][@x][1] = @item_saved[1]
$game_party.actors[@actor_index].item_grid[@y + 1][@x][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y + 1][@x][1] = "r"
$game_party.actors[@actor_index].item_grid[@y + 2][@x][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y + 2][@x][1] = "r"
$game_party.actors[@actor_index].item_grid[@y][@x + 1][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y][@x + 1][1] = "r"
$game_party.actors[@actor_index].item_grid[@y + 1][@x + 1][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y + 1][@x + 1][1] = "r"
$game_party.actors[@actor_index].item_grid[@y + 2][@x + 1][0] = @item_saved[0]
$game_party.actors[@actor_index].item_grid[@y + 2][@x + 1][1] = "r"
end
@x = tx if @x != tx and tx != nil
@y = ty if @y != ty and ty != nil
end
def empty?
case @item_saved[1]
when "i"
return true if $game_party.actors[@actor_index].item_grid[@y][@x][1] == ""
when "w"
if $game_party.actors[@actor_index].item_grid[@y][@x][1] == "" and
$game_party.actors[@actor_index].item_grid[@y + 1][@x][1] == "" and
$game_party.actors[@actor_index].item_grid[@y + 2][@x][1] == ""
return true
end
when "a"
if $game_party.actors[@actor_index].item_grid[@y][@x][1] == "" and
$game_party.actors[@actor_index].item_grid[@y + 1][@x][1] == "" and
$game_party.actors[@actor_index].item_grid[@y + 2][@x][1] == "" and
$game_party.actors[@actor_index].item_grid[@y][@x + 1][1] == "" and
$game_party.actors[@actor_index].item_grid[@y + 1][@x + 1][1] == "" and
$game_party.actors[@actor_index].item_grid[@y + 2][@x + 1][1] == ""
return true
end
end
return false
end
def set=(set)
@x = set
@y = set
@mini_help.visible = (set == 0 ? true : false)
end
def draw_item(item_id, type, i , j)
if type == "i" and
$game_party.item_can_use?($data_items[item_id].id)
opacity = 255
else
opacity = 128
end
if item_id != 0
case type
when "i"
x = 4 + (j * 32)
y = i * 32
bitmap = RPG::Cache.icon($data_items[item_id].icon_name)
@grid_color.bitmap.fill_rect(j*32+1, i*32+1, 31, 31, Color.new(0,0,200))
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
when "w"
x = 4 + (j * 32)
y = i * 32
bitmap = RPG::Cache.icon($data_weapons[item_id].icon_name)
@grid_color.bitmap.fill_rect(j*32+1, i*32+1, 31, 95, Color.new(200,0,0))
self.contents.blt(x, y + 4 + 32, bitmap, Rect.new(0, 0, 24, 24), opacity)
when "a"
x = 4 + (j * 32)
y = i * 32
bitmap = RPG::Cache.icon($data_armors[item_id].icon_name)
@grid_color.bitmap.fill_rect(j*32+1, i*32+1, 63, 95, Color.new(0,200,0))
self.contents.blt(x + 18, y + 4 + 32, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
end
end
end
class Mini_Help < Window_Base
alias old_initialize initialize
def initialize
super(0, 0, 180, 40)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 14
self.back_opacity = 170
self.z = 102
self.visible = false
end
def set_text(text, align = 1)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
#self.contents.font.color = normal_color
self.contents.draw_text(4, -12, self.width - 40, 32, text, align)
#self.width = self.contents.text_size(text).width
@text = text
@align = align
@actor = nil
end
self.visible = true
end
end
class Game_Actor < Game_Battler
attr_accessor :item_grid
alias old_initialize initialize
def initialize(actor_id)
old_initialize(actor_id)
@item_grid = Array.new(12)
for i in 0..@item_grid.size - 1
@item_grid[i] = Array.new(13)
for k in 0..@item_grid[i].size - 1
@item_grid[i][k] = Array.new(2)
@item_grid[i][k][0] = 0
@item_grid[i][k][1] = ""
end
end
end
end
class Game_Party
def gain_item(item_id, n)
if item_id > 0
for k in 1..n
for i in 0..self.actors.size - 1
break if set_item(item_id, "i", i) == nil
end
end
end
end
def gain_weapon(weapon_id, n)
if weapon_id > 0
for k in 1..n
for i in 0..self.actors.size - 1
break if set_item(weapon_id, "w", i) == nil
end
end
end
end
def gain_armor(armor_id, n)
if armor_id > 0
for k in 1..n
for i in 0..self.actors.size - 1
break if set_item(armor_id, "a", i) == nil
end
end
end
end
def lose_item(item_id, n, random = true)
if random == true
if item_id > 0
for k in 1..n
del_item(item_id, "i")
end
end
end
@items[item_id] = [[item_number(item_id) + -n, 0].max, 99].min
end
def lose_weapon(weapon_id, n, random = true)
if random == true
if weapon_id > 0
for k in 1..n
del_item(weapon_id, "w")
end
end
end
@weapons[weapon_id] = [[weapon_number(weapon_id) + -n, 0].max, 99].min
end
def lose_armor(armor_id, n, random = true)
if random == true
if armor_id > 0
for k in 1..n
del_item(armor_id, "a")
end
end
end
@armors[armor_id] = [[armor_number(armor_id) + -n, 0].max, 99].min
end
def set_item(item_id, type, i)
for a in 0..self.actors[i].item_grid.size - 1
for b in 0..self.actors[i].item_grid[a].size - 1
if self.actors[i].item_grid[a][b][0] == 0
case type
when "i"
self.actors[i].item_grid[a][b][0] = item_id
self.actors[i].item_grid[a][b][1] = type
@items[item_id] = [[item_number(item_id) + 1, 0].max, 99].min
return
when "w"
if a < self.actors[i].item_grid.size - 2
if self.actors[i].item_grid[a + 1][b][0] == 0 and
self.actors[i].item_grid[a + 2][b][0] == 0
self.actors[i].item_grid[a][b][0] = item_id
self.actors[i].item_grid[a][b][1] = type
self.actors[i].item_grid[a + 1][b][0] = item_id
self.actors[i].item_grid[a + 1][b][1] = "e"
self.actors[i].item_grid[a + 2][b][0] = item_id
self.actors[i].item_grid[a + 2][b][1] = "e"
@weapons[item_id] = [[weapon_number(item_id) + 1, 0].max, 99].min
return
end
end
when "a"
if b < self.actors[i].item_grid[a].size - 1 and a < self.actors[i].item_grid.size - 2
if self.actors[i].item_grid[a + 1][b][0] == 0 and self.actors[i].item_grid[a + 2][b][0] == 0 and
self.actors[i].item_grid[a][b + 1][0] == 0 and
self.actors[i].item_grid[a + 1][b + 1][0] == 0 and self.actors[i].item_grid[a + 2][b + 1][0] == 0
self.actors[i].item_grid[a][b][0] = item_id
self.actors[i].item_grid[a][b][1] = type
self.actors[i].item_grid[a + 1][b][0] = item_id
self.actors[i].item_grid[a + 1][b][1] = "r"
self.actors[i].item_grid[a + 2][b][0] = item_id
self.actors[i].item_grid[a + 2][b][1] = "r"
self.actors[i].item_grid[a][b + 1][0] = item_id
self.actors[i].item_grid[a][b + 1][1] = "r"
self.actors[i].item_grid[a + 1][b + 1][0] = item_id
self.actors[i].item_grid[a + 1][b + 1][1] = "r"
self.actors[i].item_grid[a + 2][b + 1][0] = item_id
self.actors[i].item_grid[a + 2][b + 1][1] = "r"
@armors[item_id] = [[armor_number(item_id) + 1, 0].max, 99].min
return
end
end
end
end
end
end
end
def del_item(item_id, type)
for i in 0..self.actors.size - 1
for a in 0..self.actors[i].item_grid.size - 1
for b in 0..self.actors[i].item_grid[a].size - 1
if self.actors[i].item_grid[a][b][0] == item_id and
self.actors[i].item_grid[a][b][1] == type
case type
when "i"
self.actors[i].item_grid[a][b][0] = 0
self.actors[i].item_grid[a][b][1] = ""
return
when "w"
self.actors[i].item_grid[a][b][0] = 0
self.actors[i].item_grid[a][b][1] = ""
self.actors[i].item_grid[a + 1][b][0] = 0
self.actors[i].item_grid[a + 1][b][1] = ""
self.actors[i].item_grid[a + 2][b][0] = 0
self.actors[i].item_grid[a + 2][b][1] = ""
return
when "a"
self.actors[i].item_grid[a][b][0] = 0
self.actors[i].item_grid[a][b][1] = ""
self.actors[i].item_grid[a + 1][b][0] = 0
self.actors[i].item_grid[a + 1][b][1] = ""
self.actors[i].item_grid[a + 2][b][0] = 0
self.actors[i].item_grid[a + 2][b][1] = ""
self.actors[i].item_grid[a][b + 1][0] = 0
self.actors[i].item_grid[a][b + 1][1] = ""
self.actors[i].item_grid[a + 1][b + 1][0] = 0
self.actors[i].item_grid[a + 1][b + 1][1] = ""
self.actors[i].item_grid[a + 2][b + 1][0] = 0
self.actors[i].item_grid[a + 2][b + 1][1] = ""
return
end
end
end
end
end
end
end
class Cursor_Icon < RPG::Sprite
def initialize
super
@color = Color.new(255,255,0,150)
@rect = Rect.new(0, 0, 24, 24)
end
def refresh(bitmap, item)
case item
when "i"
x = 4
y = 4
width = 32
height = 32
when "w"
x = 4
y = 36
width = 32
height = 96
when "a"
x = 22
y = 36
width = 64
height = 96
end
if self.bitmap == nil or (self.bitmap.width != width or self.bitmap.height != height)
self.bitmap = Bitmap.new(width, height)
else
self.bitmap.clear
end
self.bitmap.fill_rect(0,0,width,height, @color)
self.bitmap.blt(x, y , bitmap, @rect)
self.z = 9999
end
end
class Window_Base
def draw_actor_picture(actor, x, y)
bitmap = RPG::Cache.battler(actor.character_name, actor.character_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)
end
end
class Scene_Menu
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
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
@command_window.active = false
@status_window.active = true
@status_window.index = 0
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 # 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 5 # 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
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new(@status_window.index)
when 1 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# 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 skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
The_King_Jaas- Co-Administrador
- Mensajes : 1737
Fecha de inscripción : 02/02/2011
Temas similares
» El mejor estilo de la resident
» [Script XP] Menu Estilo FF III
» Plataforma estilo mario
» Blizzard busca "un ingeniero especializado en PS3” para el equipo de Diablo 3
» [Script XP] Menu Estilo FF III
» Plataforma estilo mario
» Blizzard busca "un ingeniero especializado en PS3” para el equipo de Diablo 3
Drupogame :: RPG Maker :: RPG maker XP :: Scripts
Página 1 de 1.
Permisos de este foro:
No puedes responder a temas en este foro.
Lun Ene 23, 2012 11:32 pm por edux
» edux returns
Lun Ene 23, 2012 11:30 pm por edux
» The Elder Scrolls IV: Oblivion
Vie Ene 20, 2012 11:28 pm por Aljevalsar
» Kojima promete que habrá un Metal Gear Solid de auténtico sigilo
Jue Dic 22, 2011 7:33 pm por Anime_Maker
» Este fin de semana habrá nuevos modos para Modern Warfare 3
Jue Dic 15, 2011 12:03 pm por Akeo
» Kojima quiso crear un Metal Gear Solid 5 ambientado en la Segunda Guerra Mundial
Jue Dic 15, 2011 11:01 am por Akeo
» Darksiders II se dejará ver en los Spike VGA
Miér Dic 14, 2011 11:50 am por Akeo
» El creador de Bayonetta desmiente estar implicado en el desarrollo de Metal Gear Rising
Miér Dic 14, 2011 1:54 am por Akeo
» Los creadores de Bayonetta se encargan del desarrollo de Metal Gear Rising
Miér Dic 14, 2011 1:52 am por Akeo
» En Construccion: Mundo Abismal
Lun Oct 24, 2011 4:03 am por SagahonArturo
» Visceral Games busca nuevo personal para la franquicia Dead Space
Mar Oct 11, 2011 3:22 am por The_King_Jaas
» buenas
Mar Oct 11, 2011 3:21 am por The_King_Jaas
» Batman: Arkham City llegará "sin ninguna limitación"
Sáb Oct 08, 2011 1:44 am por Akeo
» Los creadores de Bulletstorm admiten divertidos que el juego tenía demasiadas palabras malsonantes
Sáb Oct 08, 2011 1:41 am por Akeo
» PES 2012: El primer DLC estará disponible el 11 de octubre
Sáb Oct 08, 2011 1:39 am por Akeo