1 Limite de Itens Dom 14 Out 2012, 03:25
Carlos
Administrador
Introdução:
Script que permite defini limites diferentes para cada item, podendo ultrapassar o máximo de 99.
Screenshots:
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Como usar:
Apenas cole o script acima do main.
Configurando:
Para configura o limite de itens procure por:
Você deve adicionar a ID do item, seguida de => depois o valor do limite. Separando com vígula os itens diferentes.
Exemplo:
Isso significa que o item da ID 1 terá limite de 150, o da ID 2 terá limite de 100, o da ID 3 terá limite de 50.
O processo é o mesmo para armas e armaduras
Para definir o limite de dinheiro o processo é mais simples, basta inserir o valor após:
Exemplo:
Significa que o limite de gold é 100000
Você pode também definir um limite padrão para os itens. Procure por:
Basta adicionar o valor que você quiser.
Todos os itens que não tiverem seu limite especificado terão este valor como padrão
Script
Créditos:
Feito por Moghunter
Script que permite defini limites diferentes para cada item, podendo ultrapassar o máximo de 99.
Screenshots:
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Como usar:
Apenas cole o script acima do main.
Configurando:
Para configura o limite de itens procure por:
- Código:
ITEM_LIMIT = {} # para limite dos itens
WEAPON_LIMIT = {} # para limite das armas
ARMOR_LIMIT = {} # para limite das armas
Você deve adicionar a ID do item, seguida de => depois o valor do limite. Separando com vígula os itens diferentes.
Exemplo:
- Código:
ITEM_LIMIT = {1=>150, 2 => 100, 3 => 50 }
Isso significa que o item da ID 1 terá limite de 150, o da ID 2 terá limite de 100, o da ID 3 terá limite de 50.
O processo é o mesmo para armas e armaduras
Para definir o limite de dinheiro o processo é mais simples, basta inserir o valor após:
- Código:
GOLD_LIMIT =
Exemplo:
- Código:
GOLD_LIMIT = 100000
Significa que o limite de gold é 100000
Você pode também definir um limite padrão para os itens. Procure por:
- Código:
DEFAULT_LIMIT =
Basta adicionar o valor que você quiser.
Todos os itens que não tiverem seu limite especificado terão este valor como padrão
Script
- Código:
=begin
CARACTERÍSTICAS
Atualizado o script que permite definir o limite máximo dos itens.
- O script ficou compatível com os scripts Shop Felicia e Item Laura.
- Adicionado a função de definir a quantidade de dinheiro máximo
- Algumas melhorias na apresentação do limite de itens.
________________________________________________________________________
SCRIPT
CODE
=end
#_______________________________________________________________________________
# MOG Item Limit V1.7
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Permite definir o limite maximo para cada item, armas
# ou armaduras.
#_______________________________________________________________________________
module MOG
#-------------------------------------------------------------------------------
# Definição do limite padrão.
#-------------------------------------------------------------------------------
DEFAULT_LIMIT = 50
#-------------------------------------------------------------------------------
# A => B
#
# A = ID do item, armadura ou arma
# B = Quantidade de itens maximo.
#
#-------------------------------------------------------------------------------
#Definição do limite maximo de Itens.
#-------------------------------------------------------------------------------
ITEM_LIMIT = {}
#-------------------------------------------------------------------------------
#Definição do limite maximo de armas.
#-------------------------------------------------------------------------------
WEAPON_LIMIT = {}
#-------------------------------------------------------------------------------
#Definição do limite maximo de armaduras.
#-------------------------------------------------------------------------------
ARMOR_LIMIT = {}
#-------------------------------------------------------------------------------
#Definição do limite maximo de dinheiro
#-------------------------------------------------------------------------------
GOLD_LIMIT = 100000
#-------------------------------------------------------------------------------
end
$mogscript = {} if $mogscript == nil
$mogscript["Item_Limit"] = true
##############
# Game_Party #
##############
class Game_Party
alias mog45_gain_item gain_item
def gain_item(item_id, n)
if item_id > 0
item_limit = MOG::ITEM_LIMIT[item_id]
if item_limit != nil
@items[item_id] = [[item_number(item_id) + n, 0].max, item_limit].min
else
@items[item_id] = [[item_number(item_id) + n, 0].max, MOG::DEFAULT_LIMIT].min
end
end
return
mog45_gain_item(item_id, n)
end
alias mog45_gain_weapon gain_weapon
def gain_weapon(weapon_id, n)
if weapon_id > 0
weapon_limit = MOG::WEAPON_LIMIT[weapon_id]
if weapon_limit !=nil
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, weapon_limit].min
else
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, MOG::DEFAULT_LIMIT].min
end
end
return
mog45_gain_weapon(weapon_id, n)
end
alias mog45_gain_armor gain_armor
def gain_armor(armor_id, n)
if armor_id > 0
armor_limit = MOG::ARMOR_LIMIT[armor_id]
if armor_limit != nil
@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, armor_limit].min
else
@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, MOG::DEFAULT_LIMIT].min
end
end
return
mog45_gain_armor
end
def gain_gold(n)
@gold = [[@gold + n, 0].max, MOG::GOLD_LIMIT].min
end
end
##############
# Scene_Shop #
##############
class Scene_Shop
alias mog45_update update
def update
if @sell_window.active == true
$sell = true
else
$sell = false
end
mog45_update
end
alias mog45_update_buy update_buy
def update_buy
if Input.trigger?(Input::C)
@item = @buy_window.item
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
item_limit = MOG::ITEM_LIMIT[@item.id]
if item_limit != nil
if number >= item_limit
$game_system.se_play($data_system.buzzer_se)
return
end
else
if number == MOG::DEFAULT_LIMIT
$game_system.se_play($data_system.buzzer_se)
return
end
end
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
weapon_limit = MOG::WEAPON_LIMIT[@item.id]
if weapon_limit != nil
if number >= weapon_limit
$game_system.se_play($data_system.buzzer_se)
return
end
else
if number == MOG::DEFAULT_LIMIT
$game_system.se_play($data_system.buzzer_se)
return
end
end
when RPG::Armor
number = $game_party.armor_number(@item.id)
armor_limit = MOG::ARMOR_LIMIT[@item.id]
if armor_limit != nil
if number >= armor_limit
$game_system.se_play($data_system.buzzer_se)
return
end
else
if number == MOG::DEFAULT_LIMIT
$game_system.se_play($data_system.buzzer_se)
return
end
end
end
end
mog45_update_buy
end
end
#####################
# Window_ShopNumber #
#####################
class Window_ShopNumber < Window_Base
alias mog45_set set
def set(item, max, price)
@item = item
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
item_limit = MOG::ITEM_LIMIT[@item.id]
if item_limit!= nil
if $sell == true
valor = item_limit - number
@max = item_limit - valor
else
@max = item_limit - number
end
else
if $sell == true
valor = MOG::DEFAULT_LIMIT - number
@max = MOG::DEFAULT_LIMIT - valor
else
@max = MOG::DEFAULT_LIMIT - number
end
end
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
weapon_limit = MOG::WEAPON_LIMIT[@item.id]
if weapon_limit!= nil
if $sell == true
valor = weapon_limit - number
@max = weapon_limit - valor
else
@max = weapon_limit - number
end
else
if $sell == true
valor = MOG::DEFAULT_LIMIT - number
@max = MOG::DEFAULT_LIMIT - valor
else
@max = MOG::DEFAULT_LIMIT - number
end
end
when RPG::Armor
number = $game_party.armor_number(@item.id)
armor_limit = MOG::ARMOR_LIMIT[@item.id]
if armor_limit!= nil
if $sell == true
valor = armor_limit - number
@max = armor_limit - valor
else
@max = armor_limit - number
end
else
if $sell == true
valor = MOG::DEFAULT_LIMIT - number
@max = MOG::DEFAULT_LIMIT - valor
else
@max = MOG::DEFAULT_LIMIT - number
end
end
end
@price = price
@number = 1
refresh
return
mog45_set set(item, max, price)
end
end
###############
# Window_Item #
###############
class Window_Item < Window_Selectable
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
item_number = MOG::ITEM_LIMIT[item.id]
when RPG::Weapon
number = $game_party.weapon_number(item.id)
item_number = MOG::WEAPON_LIMIT[item.id]
when RPG::Armor
number = $game_party.armor_number(item.id)
item_number = MOG::ARMOR_LIMIT[item.id]
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
if item_number != nil
self.contents.draw_text(x + 220, y, 60, 32, number.to_s + " / " + item_number.to_s, 2)
else
max_limit = MOG::DEFAULT_LIMIT
self.contents.draw_text(x + 220, y, 60, 32, number.to_s + " / " + max_limit.to_s, 2)
end
end
end
##################
# Window_Item_Ex #
##################
class Window_Item_Ex < Window_Selectable
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
item_number = MOG::ITEM_LIMIT[item.id]
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.name = "Georgia"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
if item_number != nil
self.contents.draw_text(x + 195, y, 60, 32, number.to_s + " / " + item_number.to_s, 2)
else
max_limit = MOG::DEFAULT_LIMIT
self.contents.draw_text(x + 195, y, 60, 32, number.to_s + " / " + max_limit.to_s, 2)
end
end
end
#################
# Window_Weapon #
#################
class Window_Weapon < Window_Selectable
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
item_number = MOG::WEAPON_LIMIT[item.id]
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
end
end
Créditos:
Feito por Moghunter