|
  |
There's a glitch with MOG - Item Limit Script. Please help. |
|
|
|
|
Mar 14 2012, 01:51 PM
|

Level 10

Group: Revolutionary
Posts: 165
Type: Event Designer
RM Skill: Skilled

|
This script is meant to put a limit of how many you can carry of each item, like instead of being able to carry 99 potions, you can only carry 20 (just an example). But the thing is let's say I have 900 gold and a bomb costs 300 each, and the limit for the bomb is 5. That means I can only buy 3, but with this script I'm able to buy 5 bombs with 900 gold. Big problem. If I buy 3 bombs, then go back to the shop, I can't buy more. But if I buy 5 bombs all at once, I could. That means I can buy as many supplies I want as long as I can afford just 1. Please help me fix this. I really want an item limit script in my game but I don't want this glitch. CODE #_______________________________________________________________________________ # MOG Item Limit V1.8 #_______________________________________________________________________________ # 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 = { 1=>60, #Potion 2=>35, #Hi Potion 3=>20, #Full Potion 4=>45, #Perfume 5=>30, #Hi Perfume 6=>15, #Full Perfume 7=>10, #Elixir 8=>5, #Full Elixir 9=>35, #Tonic 10=>15, #Full Tonic 11=>70 #Antidote } #------------------------------------------------------------------------------- #Definição do limite maximo de armas. #------------------------------------------------------------------------------- WEAPON_LIMIT = { 1=>9, #Bronze Sword 2=>6, #Iron Sword 3=>3, #Steel Sword 4=>1, #Mythril Sword 5=>9, #Bronze Spear 6=>6, #Iron Spear 7=>3, #Steel Spear 8=>1 #Mythril Spear } #------------------------------------------------------------------------------- #Definição do limite maximo de armaduras. #------------------------------------------------------------------------------- ARMOR_LIMIT = { 1=>20, #Bronze Shield 2=>15, #Iron Shield 5=>20, #Bronze Helm 13=>10 #Bronze Armor } #------------------------------------------------------------------------------- #Definição do limite maximo de dinheiro #------------------------------------------------------------------------------- GOLD_LIMIT = 100000 #------------------------------------------------------------------------------- end
#=============================================================================== # Game_Party #=============================================================================== class Game_Party #-------------------------------------------------------------------------- # gain_item #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # gain_weapon #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # gain_armor #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # gain_gold #-------------------------------------------------------------------------- def gain_gold(n) @gold = [[@gold + n, 0].max, MOG::GOLD_LIMIT].min end end
#=============================================================================== # Scene_Shop #=============================================================================== class Scene_Shop #-------------------------------------------------------------------------- # Update #-------------------------------------------------------------------------- alias mog45_update update def update if @sell_window.active == true $sell = true else $sell = false end mog45_update end #-------------------------------------------------------------------------- # Update_buy #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # set #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- 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 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_Armor #=============================================================================== class Window_Armor < Window_Selectable #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item 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 % 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_ShopStatus #=============================================================================== class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # Refresh #-------------------------------------------------------------------------- alias mog45_refresh refresh def refresh if $mog_rgss_menu_shop != nil mog45_refresh return false end self.contents.clear if @item == nil return end case @item when RPG::Item number = $game_party.item_number(@item.id) item_max = MOG::ITEM_LIMIT[@item.id] when RPG::Weapon number = $game_party.weapon_number(@item.id) item_max = MOG::WEAPON_LIMIT[@item.id] when RPG::Armor number = $game_party.armor_number(@item.id) item_max = MOG::ARMOR_LIMIT[@item.id] end self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, 32, "Stock") self.contents.font.color = normal_color if item_max != nil self.contents.draw_text(155, 0, 80, 32, number.to_s + " / " + item_max.to_s, 2) else max_limit = MOG::DEFAULT_LIMIT self.contents.draw_text(155, 0, 80, 32, number.to_s + " / " + max_limit.to_s, 2) end if @item.is_a?(RPG::Item) return end for i in 0...$game_party.actors.size actor = $game_party.actors[i] if actor.equippable?(@item) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name) if @item.is_a?(RPG::Weapon) item1 = $data_weapons[actor.weapon_id] elsif @item.kind == 0 item1 = $data_armors[actor.armor1_id] elsif @item.kind == 1 item1 = $data_armors[actor.armor2_id] elsif @item.kind == 2 item1 = $data_armors[actor.armor3_id] else item1 = $data_armors[actor.armor4_id] end if actor.equippable?(@item) if @item.is_a?(RPG::Weapon) atk1 = item1 != nil ? item1.atk : 0 atk2 = @item != nil ? @item.atk : 0 change = atk2 - atk1 end if @item.is_a?(RPG::Armor) pdef1 = item1 != nil ? item1.pdef : 0 mdef1 = item1 != nil ? item1.mdef : 0 pdef2 = @item != nil ? @item.pdef : 0 mdef2 = @item != nil ? @item.mdef : 0 change = pdef2 - pdef1 + mdef2 - mdef1 end self.contents.draw_text(124, 64 + 64 * i, 112, 32, sprintf("%+d", change), 2) end if item1 != nil x = 4 y = 64 + 64 * i + 32 bitmap = RPG::Cache.icon(item1.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, item1.name) end end return true mog45_refresh end end
#=============================================================================== # Window_ShopSell #===============================================================================
class Window_ShopSell < Window_Selectable #-------------------------------------------------------------------------- # Initialize #-------------------------------------------------------------------------- def initialize if $mog_rgss_menu_shop != nil super(-10, 180, 305, 225) self.opacity = 0 @column_max = 1 refresh self.index = 0 else super(0, 128, 640, 352) @column_max = 2 refresh self.index = 0 end end #-------------------------------------------------------------------------- # Draw_item #-------------------------------------------------------------------------- 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.price > 0 self.contents.font.color = normal_color else self.contents.font.color = disabled_color end if $mog_rgss_menu_shop == nil 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 else self.contents.font.name = "Georgia" 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)) 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, 150, 32, item.name, 0) self.contents.font.color = Color.new(50,250,150,255) prc = item.price / 2 self.contents.draw_text(x + 180, y, 80, 32, "+G " + prc.to_s, 2) end end end
$mog_rgss_Item_Limit = true And yes this is a XP script. My last post was locked because people thought it was an VX script, it wasn't. XAS has both XP and VX versions, and I was talking about the XP version. By the way I got an answer for that post already, I need help with this now
__________________________
For goodness sake, let's have some cake!
|
|
|
|
|
|
|
|
|
Apr 5 2012, 06:59 PM
|

Level 71

Group: +Gold Member
Posts: 3,276
Type: Musician
RM Skill: Advanced
Rev Points: 10

|
I'm not a scripter and therefore can't help much, but I will say it looks as though his code is taking priority over Scene_Shop and then only checking whether you can carry more of the item you're trying to buy, and not whether you can afford it or not. I believe throwing something along the lines of: CODE if @item == nil or @item.price > $game_party.gold $game_system.se_play($data_system.buzzer_se) return in there would fix it, but I don't know near enough about syntax and scripting in general to tell you where or how. I wouldn't suggest trying it without first backing up a copy of whatever you're editing or consulting an actual scripter first.
__________________________
|
|
|
|
|
|
|
|
|
Apr 5 2012, 10:25 PM
|

Level 50

Group: +Gold Member
Posts: 1,520
Type: Scripter
RM Skill: Undisclosed

|
Close, Rast, but that line is supposed to check if an individual item costs more than the amount of gold in the party, and if it does it doesn't give you the option to select how many to buy. I tinkered around with that line as well.... Moghunter forgot 1 command, which I've added as line 264. CODE #_______________________________________________________________________________ # MOG Item Limit V1.8 #_______________________________________________________________________________ # 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 = { 1=>5, #Potion 2=>35, #Hi Potion 3=>20, #Full Potion 4=>45, #Perfume 5=>30, #Hi Perfume 6=>15, #Full Perfume 7=>10, #Elixir 8=>5, #Full Elixir 9=>35, #Tonic 10=>15, #Full Tonic 11=>70 #Antidote } #------------------------------------------------------------------------------- #Definição do limite maximo de armas. #------------------------------------------------------------------------------- WEAPON_LIMIT = { 1=>9, #Bronze Sword 2=>6, #Iron Sword 3=>3, #Steel Sword 4=>1, #Mythril Sword 5=>9, #Bronze Spear 6=>6, #Iron Spear 7=>3, #Steel Spear 8=>1 #Mythril Spear } #------------------------------------------------------------------------------- #Definição do limite maximo de armaduras. #------------------------------------------------------------------------------- ARMOR_LIMIT = { 1=>20, #Bronze Shield 2=>15, #Iron Shield 5=>20, #Bronze Helm 13=>10 #Bronze Armor } #------------------------------------------------------------------------------- #Definição do limite maximo de dinheiro #------------------------------------------------------------------------------- GOLD_LIMIT = 100000 #------------------------------------------------------------------------------- end
#=============================================================================== # Game_Party #=============================================================================== class Game_Party #-------------------------------------------------------------------------- # gain_item #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # gain_weapon #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # gain_armor #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # gain_gold #-------------------------------------------------------------------------- def gain_gold(n) @gold = [[@gold + n, 0].max, MOG::GOLD_LIMIT].min end end
#=============================================================================== # Scene_Shop #=============================================================================== class Scene_Shop #-------------------------------------------------------------------------- # Update #-------------------------------------------------------------------------- alias mog45_update update def update if @sell_window.active == true $sell = true else $sell = false end mog45_update end #-------------------------------------------------------------------------- # Update_buy #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # set #-------------------------------------------------------------------------- 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 @max = [@max, max].min @price = price @number = 1 refresh return mog45_set set(item, max, price) end end
#=============================================================================== # Window_Item #=============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- 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 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_Armor #=============================================================================== class Window_Armor < Window_Selectable #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item 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 % 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_ShopStatus #=============================================================================== class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # Refresh #-------------------------------------------------------------------------- alias mog45_refresh refresh def refresh if $mog_rgss_menu_shop != nil mog45_refresh return false end self.contents.clear if @item == nil return end case @item when RPG::Item number = $game_party.item_number(@item.id) item_max = MOG::ITEM_LIMIT[@item.id] when RPG::Weapon number = $game_party.weapon_number(@item.id) item_max = MOG::WEAPON_LIMIT[@item.id] when RPG::Armor number = $game_party.armor_number(@item.id) item_max = MOG::ARMOR_LIMIT[@item.id] end self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, 32, "Stock") self.contents.font.color = normal_color if item_max != nil self.contents.draw_text(155, 0, 80, 32, number.to_s + " / " + item_max.to_s, 2) else max_limit = MOG::DEFAULT_LIMIT self.contents.draw_text(155, 0, 80, 32, number.to_s + " / " + max_limit.to_s, 2) end if @item.is_a?(RPG::Item) return end for i in 0...$game_party.actors.size actor = $game_party.actors[i] if actor.equippable?(@item) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name) if @item.is_a?(RPG::Weapon) item1 = $data_weapons[actor.weapon_id] elsif @item.kind == 0 item1 = $data_armors[actor.armor1_id] elsif @item.kind == 1 item1 = $data_armors[actor.armor2_id] elsif @item.kind == 2 item1 = $data_armors[actor.armor3_id] else item1 = $data_armors[actor.armor4_id] end if actor.equippable?(@item) if @item.is_a?(RPG::Weapon) atk1 = item1 != nil ? item1.atk : 0 atk2 = @item != nil ? @item.atk : 0 change = atk2 - atk1 end if @item.is_a?(RPG::Armor) pdef1 = item1 != nil ? item1.pdef : 0 mdef1 = item1 != nil ? item1.mdef : 0 pdef2 = @item != nil ? @item.pdef : 0 mdef2 = @item != nil ? @item.mdef : 0 change = pdef2 - pdef1 + mdef2 - mdef1 end self.contents.draw_text(124, 64 + 64 * i, 112, 32, sprintf("%+d", change), 2) end if item1 != nil x = 4 y = 64 + 64 * i + 32 bitmap = RPG::Cache.icon(item1.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, item1.name) end end return true mog45_refresh end end
#=============================================================================== # Window_ShopSell #===============================================================================
class Window_ShopSell < Window_Selectable #-------------------------------------------------------------------------- # Initialize #-------------------------------------------------------------------------- def initialize if $mog_rgss_menu_shop != nil super(-10, 180, 305, 225) self.opacity = 0 @column_max = 1 refresh self.index = 0 else super(0, 128, 640, 352) @column_max = 2 refresh self.index = 0 end end #-------------------------------------------------------------------------- # Draw_item #-------------------------------------------------------------------------- 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.price > 0 self.contents.font.color = normal_color else self.contents.font.color = disabled_color end if $mog_rgss_menu_shop == nil 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 else self.contents.font.name = "Georgia" 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)) 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, 150, 32, item.name, 0) self.contents.font.color = Color.new(50,250,150,255) prc = item.price / 2 self.contents.draw_text(x + 180, y, 80, 32, "+G " + prc.to_s, 2) end end end
$mog_rgss_Item_Limit = true
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
  |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|