So I have a big problem with Moghunter Item Limit script, which limits the number of items you could have. The problem occurs when I buy items. It ignores the money I have, allowing me to buy
max number of items. For sample, if I have only 100$ and each potion costs 50$, it allow me to buy 99 potions, even considering that I don't have enough money, the purchase is completed.
I have also looked in the forum and found a suggestion to put Item Limit above scene_shop, but it didn't worked. It gives me an error message: "undefined method 'update' for class 'scene_shop´". If anyone has solved this problem, it would be of great help, because my project is stuck here due to this problem. Also I've posted bellow the Moghunter Item Limit:
max number of items. For sample, if I have only 100$ and each potion costs 50$, it allow me to buy 99 potions, even considering that I don't have enough money, the purchase is completed.
I have also looked in the forum and found a suggestion to put Item Limit above scene_shop, but it didn't worked. It gives me an error message: "undefined method 'update' for class 'scene_shop´". If anyone has solved this problem, it would be of great help, because my project is stuck here due to this problem. Also I've posted bellow the Moghunter Item Limit:
Code:
#_______________________________________________________________________________# MOG Item Limit V1.7#_______________________________________________________________________________# By Moghunter# [URL="http://www.atelier-rgss.com#_______________________________________________________________________________%23"]http://www.atelier-rgss.com#_______________________________________________________________________________#[/URL] Portuguese:# Permite definir o limite maximo para cada item, armas# ou armaduras.## English:# Set the maximum limit for each item, weapons# Or armor.#_______________________________________________________________________________module MOG#-------------------------------------------------------------------------------# Definição do limite padrão.# Items Limit Definition#-------------------------------------------------------------------------------DEFAULT_LIMIT = 99#-------------------------------------------------------------------------------# A => B## A = ID do item, armadura ou arma (ID of the item, weapon or armor).# B = Quantidade de itens maximo (amount of items).##-------------------------------------------------------------------------------#Definição do limite maximo de Itens.#Definition of Item maximum limit.#-------------------------------------------------------------------------------ITEM_LIMIT = {1=>20, #Potion}#-------------------------------------------------------------------------------#Definição do limite maximo de armas.#Definition of weapons maximum limit.#-------------------------------------------------------------------------------WEAPON_LIMIT = {}#-------------------------------------------------------------------------------#Definição do limite maximo de armaduras.#Definition of armors maximum limit.#-------------------------------------------------------------------------------ARMOR_LIMIT = {}#-------------------------------------------------------------------------------#Definição do limite maximo de dinheiro#Definition of maximum money limit.#-------------------------------------------------------------------------------GOLD_LIMIT = 1000000000#-------------------------------------------------------------------------------end$mogscript = {} if $mogscript == nil$mogscript["Item_Limit"] = true############### Game_Party ###############class Game_Partyalias mog45_gain_item gain_itemdef gain_item(item_id, n)if item_id > 0item_limit = MOG::ITEM_LIMIT[item_id]if item_limit != nil@items[item_id] = [[item_number(item_id) + n, 0].max, item_limit].minelse@items[item_id] = [[item_number(item_id) + n, 0].max, MOG::DEFAULT_LIMIT].minendendreturnmog45_gain_item(item_id, n)endalias mog45_gain_weapon gain_weapondef gain_weapon(weapon_id, n)if weapon_id > 0weapon_limit = MOG::WEAPON_LIMIT[weapon_id]if weapon_limit !=nil@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, weapon_limit].minelse@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, MOG::DEFAULT_LIMIT].minendendreturnmog45_gain_weapon(weapon_id, n)endalias mog45_gain_armor gain_armordef gain_armor(armor_id, n)if armor_id > 0armor_limit = MOG::ARMOR_LIMIT[armor_id]if armor_limit != nil@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, armor_limit].minelse@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, MOG::DEFAULT_LIMIT].minendendreturnmog45_gain_armorenddef gain_gold(n)@gold = [[@gold + n, 0].max, MOG::GOLD_LIMIT].minendend############### Scene_Shop ###############class Scene_Shopalias mog45_update updatedef updateif @sell_window.active == true$sell = trueelse$sell = falseendmog45_updateendalias mog45_update_buy update_buydef update_buyif Input.trigger?(Input::C)@item = @buy_window.itemcase @itemwhen RPG::Itemnumber = $game_party.item_number(@item.id)item_limit = MOG::ITEM_LIMIT[@item.id]if item_limit != nilif number >= item_limit$game_system.se_play($data_system.buzzer_se)returnendelseif number == MOG::DEFAULT_LIMIT$game_system.se_play($data_system.buzzer_se)returnendendwhen RPG::Weaponnumber = $game_party.weapon_number(@item.id)weapon_limit = MOG::WEAPON_LIMIT[@item.id]if weapon_limit != nilif number >= weapon_limit$game_system.se_play($data_system.buzzer_se)returnendelseif number == MOG::DEFAULT_LIMIT$game_system.se_play($data_system.buzzer_se)returnendendwhen RPG::Armornumber = $game_party.armor_number(@item.id)armor_limit = MOG::ARMOR_LIMIT[@item.id]if armor_limit != nilif number >= armor_limit$game_system.se_play($data_system.buzzer_se)returnendelseif number == MOG::DEFAULT_LIMIT$game_system.se_play($data_system.buzzer_se)returnendendendendmog45_update_buyendend###################### Window_ShopNumber ######################class Window_ShopNumber < Window_Basealias mog45_set setdef set(item, max, price)@item = itemcase @itemwhen RPG::Itemnumber = $game_party.item_number(@item.id)item_limit = MOG::ITEM_LIMIT[@item.id]if item_limit!= nilif $sell == truevalor = item_limit - number@max = item_limit - valorelse@max = item_limit - numberendelseif $sell == truevalor = MOG::DEFAULT_LIMIT - number@max = MOG::DEFAULT_LIMIT - valorelse@max = MOG::DEFAULT_LIMIT - numberendendwhen RPG::Weaponnumber = $game_party.weapon_number(@item.id)weapon_limit = MOG::WEAPON_LIMIT[@item.id]if weapon_limit!= nilif $sell == truevalor = weapon_limit - number@max = weapon_limit - valorelse@max = weapon_limit - numberendelseif $sell == truevalor = MOG::DEFAULT_LIMIT - number@max = MOG::DEFAULT_LIMIT - valorelse@max = MOG::DEFAULT_LIMIT - numberendendwhen RPG::Armornumber = $game_party.armor_number(@item.id)armor_limit = MOG::ARMOR_LIMIT[@item.id]if armor_limit!= nilif $sell == truevalor = armor_limit - number@max = armor_limit - valorelse@max = armor_limit - numberendelseif $sell == truevalor = MOG::DEFAULT_LIMIT - number@max = MOG::DEFAULT_LIMIT - valorelse@max = MOG::DEFAULT_LIMIT - numberendendend@price = price@number = 1refreshreturnmog45_set set(item, max, price)endend################ Window_Item ################class Window_Item < Window_Selectabledef draw_item(index)item = @data[index]case itemwhen RPG::Itemnumber = $game_party.item_number(item.id)item_number = MOG::ITEM_LIMIT[item.id]when RPG::Weaponnumber = $game_party.weapon_number(item.id)item_number = MOG::WEAPON_LIMIT[item.id]when RPG::Armornumber = $game_party.armor_number(item.id)item_number = MOG::ARMOR_LIMIT[item.id]endif item.is_a?(RPG::Item) and$game_party.item_can_use?(item.id)self.contents.font.color = normal_colorelseself.contents.font.color = disabled_colorendx = 4 + index % 2 * (288 + 32)y = index / 2 * 32rect = 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 : 128self.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 != nilself.contents.draw_text(x + 220, y, 60, 32, number.to_s + " / " + item_number.to_s, 2)elsemax_limit = MOG::DEFAULT_LIMITself.contents.draw_text(x + 220, y, 60, 32, number.to_s + " / " + max_limit.to_s, 2)endendend