alias ayene_gm_prt_initialize initialize
def initialize
ayene_gm_prt_initialize
@amount = 0
end
def gain_item(item_id, n)
if LIMIT_PRZEDMIOTÓW && @amount < $game_variables[ZMIENNA_MAX_PRZEDMIOTÓW]
if item_id > 0
@items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
@amount += n if @items.include?(item_id)
end
end
end
def gain_weapon(weapon_id, n)
if LIMIT_PRZEDMIOTÓW && @amount < $game_variables[ZMIENNA_MAX_PRZEDMIOTÓW]
if weapon_id > 0
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
@amount += n if @weapons.include?(weapon_id)
end
end
end
def gain_armor(armor_id, n)
if LIMIT_PRZEDMIOTÓW && @amount < $game_variables[ZMIENNA_MAX_PRZEDMIOTÓW]
if armor_id > 0
@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
@amount += n if @armors.include?(armor_id)
end
end
end
end
class Scene_Shop
alias ayene_scsh_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)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
if LIMIT_PRZEDMIOTÓW && $game_party.amount >= $game_variables[ZMIENNA_MAX_PRZEDMIOTÓW]
$game_system.se_play($data_system.buzzer_se)
return
end
end
ayene_scsh_update_buy
end
end
class Window_ShopNumber < Window_Base
def set(item, max, price)
@item = item
number = $game_party.amount
LIMIT_PRZEDMIOTÓW ? @max = ($game_variables[ZMIENNA_MAX_PRZEDMIOTÓW] - number) : @max = max
@price = price
@number = 1
refresh
end
end
class Window_ShopBuy < Window_Selectable
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.price <= $game_party.gold and number < 99 and $game_party.amount < $game_variables[ZMIENNA_MAX_PRZEDMIOTÓW]
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 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)
self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
end
end
Kod:
ZMIENNA_MAX_PRZEDMIOTÓW = 1
ID zmiennej, która ma ustalać limit przedmiotów.
Już nie zdążyłam (muszę pilnie wyjść), ale można jeszcze dodać do okienek w Menu i Sklepie dodatkowe, w którym znajdowałaby się informacja o ilości przedmiotów i limicie
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