raffy2010 Posted January 13, 2014 Share Posted January 13, 2014 DescrizioneQuesto script permette di impone un limite all'inventario del giocatore ed aggiunge la possibilita di scartare oggettihttp://3.bp.blogspot.com/-kuPP_aKGwig/UhDrfPdBbHI/AAAAAAAABMk/ziL9QOiS53I/s400/limited01.jpghttp://2.bp.blogspot.com/-8449bOTP6Nw/UhDrfR4PbxI/AAAAAAAABMo/t8qOmt1fM2c/s400/limited02.jpgAutore TheoAllegati N/AIstruzioni per l'usoInserisci lo script sotto materials Script# =============================================================================# TheoAllen - Limited Inventory# Version : 1.2c# Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com# (English Documentation)# =============================================================================($imported ||= {})[:Theo_LimInventory] = true# =============================================================================# CHANGE LOGS:# -----------------------------------------------------------------------------# 2013.10.07 - Bugfix. Item doesn't removed when discarded# - Bugfix. Inventory amount not refreshed when item is discarded# 2013.10.04 - Compatibility fix with chest system# 2013.08.30 - Now unable to discard key item# 2013.08.22 - Bugfix. Item size notetag isn't working# 2013.08.19 - Bugfix when gained item# - Bugfix when disable display item size in shop menu# 2013.08.18 - Finished script# ==============================================================================begin# ---------------------------------------------------------------------------Introduction :This script allow you to limit your inventory by overall possesed itemsinstead of individual items# ---------------------------------------------------------------------------How to Use :Put this script below material but above mainIf you're using YEA - Shop Option, put it below that scriptEdit configurations and the notetags as described below# ---------------------------------------------------------------------------Notetags :write down these notetags to the notebox in your databaseUse this notetag where the n is a numeric value which is determine the sizeof item. Use 0 for unlimited item. Only works for item and equipment such asweapon or armor.Use this notetag to determine the additional avalaible free inventory slot.This notetag avalaible for Actor, Class, Equip, and States. If it's foractor, avalaible inventory slot will increase when a new actor entered party.If it's for equip, the avalaible slot will be increase if the certain equipis equipped. And so do statesInverse of . It will decrease the avalaible inventory slot. Prettyclear I think.# ---------------------------------------------------------------------------Script call :If you want to force gain an item even the inventory is full, you can do itby script call. Just write this following lineforce_gain_item($data_items[id],amount)id is an item id in your database# ---------------------------------------------------------------------------Terms of use :Credit me, TheoAllen. You are free to edit this script by your own. As longas you don't claim it yours. For commercial purpose, don't forget to give mea free copy of the game.=end# =============================================================================# Configurations :# =============================================================================module THEOmodule LimInv# --------------------------------------------------------------------------# General Settings (just put true / false)# --------------------------------------------------------------------------DynamicSlot = true# Total avalaible inventory slot depends on actor, states, total party# members, etc ...Display_ItemSize = true# Diplay item size in item menuInclude_Equip = true# Total used inventory slot will also include actor equipment.DrawTotal_Size = true# If true, item size window will show total weight of specified item. For# example, you have 10 potions. And each potion has 3 size/weight. The window# will show 30 instead of 3# --------------------------------------------------------------------------# Numeric Settings# --------------------------------------------------------------------------Default_FreeSlot = 100# Default free slot which is provided each actor. Of course, you may change# it by notetag. If DynamicSlot is set to false, it will be the the total# avalaible slotNearMaxed_Percent = 25# Percentage to determine if the inventory is almost maxed out or notNearMaxed_Color = 21# If inventory is almost maxed out, the inventory window will be drawn in# different color. The color code is same as \C[n] in messageUseCommand_Size = 200# The width of use item command window# --------------------------------------------------------------------------# Vocab Settings (Self-explanatory I think)# --------------------------------------------------------------------------InvSlotVocab = "Inventory: " # Inventory VocabInvSizeVocab = "Item Size: " # Item size / weightSlotVocabShort = "Inv:" # Abbreviation for InventoryUseVocab = "Use item" # Use itemDiscardVocab = "Discard item" # Discard ItemCancelVocab = "Cancel" # Cancelendend# ============================================================================# Do not touch anything pass this line.# ============================================================================# I told you ...# ============================================================================# Altered built in modules and classes# ============================================================================class << DataManageralias theo_limited_item_load_db load_databasedef load_databasetheo_limited_item_load_dbload_limited_slotenddef load_limited_slotdatabase = $data_actors + $data_classes + $data_weapons + $data_armors +$data_states + $data_itemsdatabase.compact.each do |db|db.load_limited_invendendendclass RPG::BaseItemattr_accessor :inv_size # Item inventory sizeattr_accessor :inv_mod # Inventory slot modifierdef load_limited_inv@inv_size = 1@inv_mod = self.is_a?(RPG::Actor) ? THEO::LimInv::Default_FreeSlot : 0self.note.split(/[\r\n]+/).each do |line|case linewhen /<(?:INV_SIZE|inv size): [ ]*(\d+)>/i@inv_size = $1.to_iwhen /<(?:INV_PLUS|inv plus): [ ]*(\d+)>/i@inv_mod = $1.to_iwhen /<(?:INV_MINUS|inv minus): [ ]*(\d+)>/i@inv_mod = -$1.to_iendendendend# ============================================================================# Data structures and workflows goes here# ============================================================================class Game_Actor < Game_Battlerdef equip_sizereturn 0 unless THEO::LimInv::Include_Equipequips.compact.inject(0) {|total,equip| total + equip.inv_size}enddef inv_maxresult = $data_actors[id].inv_modresult += $data_classes[class_id].inv_modresult += states.inject(0) {|total,db| total + db.inv_mod}result += equips.compact.inject(0) {|total,db| total + db.inv_mod}resultendendclass Game_Party < Game_Unitdef inv_maxreturn THEO::LimInv::Default_FreeSlot unless THEO::LimInv::DynamicSlotreturn members.inject(0) {|total,member| total + member.inv_max}enddef inv_maxed?inv_max <= total_inv_sizeenddef total_inv_sizeresult = all_items.inject(0) {|total,item| total +(item_number(item) * item.inv_size)}result += members.inject(0) {|total,member| total + member.equip_size}resultendalias theo_liminv_max_item max_item_numberdef max_item_number(item)$BTEST ? theo_liminv_max_item(item) : inv_max_item(item) + item_number(item)enddef inv_max_item(item)return 9999999 if item.nil? || item.inv_size == 0free_slot / item.inv_sizeenddef free_slotinv_max - total_inv_sizeendalias theo_liminv_item_max? item_max?def item_max?(item)$BTEST ? theo_liminv_item_max?(item) : inv_maxed?enddef near_maxed?free_slot.to_f / inv_max <= THEO::LimInv::NearMaxed_Percent/100.0enddef item_size(item)return 0 unless itemitem.inv_size * item_number(item)enddef force_gain_item(item, amount)container = item_container(item.class)return unless containerlast_number = item_number(item)new_number = last_number + amountcontainer[item.id] = [new_number, 0].maxcontainer.delete(item.id) if container[item.id] == 0$game_map.need_refresh = trueendendclass Game_Interpreterdef force_gain_item(item, amount)$game_party.force_gain_item(item, amount)endend# ============================================================================# Window related class goes here# ============================================================================class Window_Base < Windowdef draw_inv_slot(x,y,width = contents.width,align = 2)txt = sprintf("%d/%d",$game_party.total_inv_size, $game_party.inv_max)color = THEO::LimInv::NearMaxed_Colorif $game_party.near_maxed?change_color(text_color(color))elsechange_color(normal_color)enddraw_text(x,y,width,line_height,txt,align)change_color(normal_color)enddef draw_inv_info(x,y,width = contents.width)change_color(system_color)draw_text(x,y,width,line_height,THEO::LimInv::InvSlotVocab)change_color(normal_color)draw_inv_slot(x,y,width)enddef draw_item_size(item,x,y,total = true,width = contents.width)rect = Rect.new(x,y,width,line_height)change_color(system_color)draw_text(rect,THEO::LimInv::InvSizeVocab)change_color(normal_color)number = (THEO::LimInv::DrawTotal_Size && total) ?$game_party.item_size(item) : item.nil? ? 0 : item.inv_sizedraw_text(rect,number,2)endendclass Window_MenuLimInv < Window_Basedef initialize(width)super(0,0,width,fitting_height(1))refreshenddef refreshcontents.clearchange_color(system_color)txt = THEO::LimInv::SlotVocabShortdraw_text(0,0,contents.width,line_height,txt)draw_inv_slot(0,0)endendclass Window_ItemSize < Window_Basedef initialize(x,y,width)super(x,y,width,fitting_height(1))enddef set_item(item)@item = itemrefreshenddef refreshcontents.cleardraw_item_size(@item,0,0)endendclass Window_FreeSlot < Window_Basedef initialize(x,y,width)super(x,y,width,fitting_height(1))refreshenddef refreshcontents.cleardraw_inv_info(0,0)endendclass Window_ItemUseCommand < Window_Commandinclude THEO::LimInvdef initializesuper(0,0)self.openness = 0enddef set_item(item)@item = itemrefreshenddef window_widthUseCommand_Sizeenddef make_command_listadd_command(UseVocab, :use, $game_party.usable?(@item))add_command(DiscardVocab, :discard, discardable?(@item))add_command(CancelVocab, :cancel)enddef to_centerself.x = Graphics.width/2 - width/2self.y = Graphics.height/2 - height/2enddef discardable?(item)return false if item.nil?!(item.is_a?(RPG::Item) && item.itype_id == 2)endendclass Window_DiscardAmount < Window_Baseattr_accessor :cmn_windowattr_accessor :itemlistattr_accessor :freeslotdef initialize(x,y,width)super(x,y,width,fitting_height(1))self.openness = 0@amount = 0enddef set_item(item)@item = item@amount = 0refreshenddef refreshcontents.clearreturn unless @itemdraw_item_name(@item,0,0,true,contents.width)txt = sprintf("%d/%d",@amount, $game_party.item_number(@item))draw_text(0,0,contents.width,line_height,txt,2)enddef draw_item_name(item, x, y, enabled = true, width = 172)return unless itemdraw_icon(item.icon_index, x, y, enabled)change_color(normal_color, enabled)draw_text(x + 24, y, width, line_height, item.name + ":")enddef updatesuperreturn unless open?change_amount(1) if Input.repeat?(:RIGHT)change_amount(-1) if Input.repeat?(:LEFT)change_amount(10) if Input.repeat?(:UP)change_amount(-10) if Input.repeat?(:DOWN)lose_item if Input.trigger?(:C)close_window if Input.trigger?(:B)enddef change_amount(num)@amount = [[@amount+num,0].max,$game_party.item_number(@item)].minSound.play_cursorrefreshenddef lose_item$game_party.lose_item(@item,@amount)@itemlist.redraw_current_item@freeslot.refreshif $game_party.item_number(@item) == 0@itemlist.refreshendclose_windowenddef close_windowclose@cmn_window.activateSound.play_okendendclass Window_ItemList < Window_Selectableattr_reader :item_size_windowdef item_size_window=(window)@item_size_window = windowupdate_helpendalias theo_liminv_update_help update_helpdef update_helptheo_liminv_update_help@item_size_window.set_item(item) if @item_size_windowendalias theo_liminv_height= height=def height=(height)self.theo_liminv_height = heightrefreshenddef enable?(item)return !item.nil?endendclass Window_ShopNumber < Window_Selectableattr_accessor :modealias theo_liminv_init initializedef initialize(x, y, height)theo_liminv_init(x, y, height)@mode = :buyendalias theo_liminv_refresh refreshdef refreshtheo_liminv_refreshdraw_itemsizeenddef draw_itemsizeitem_size = @number * @item.inv_sizetotal_size = $game_party.total_inv_size +(@mode == :buy ? item_size : -item_size)txt = sprintf("%d/%d",total_size,$game_party.inv_max)ypos = item_y + line_height * ($imported["YEA-ShopOptions"] ? 5 : 4)rect = Rect.new(4,ypos,contents.width-8,line_height)change_color(system_color)draw_text(rect,THEO::LimInv::InvSlotVocab)change_color(normal_color)draw_text(rect,txt,2)endendclass Window_ShopStatus < Window_Baseif THEO::LimInv::Display_ItemSizealias theo_liminv_draw_posses draw_possessiondef draw_possession(x, y)theo_liminv_draw_posses(x,y)y += line_heightdraw_item_size(@item,x,y,false, contents.width-(x*2))endif $imported["YEA-ShopOptions"]def draw_actor_equip_info(dx, dy, actor)dy += line_heightenabled = actor.equippable?(@item)change_color(normal_color, enabled)draw_text(dx, dy, contents.width, line_height, actor.name)item1 = current_equipped_item(actor, @item.etype_id)draw_actor_param_change(dx, dy, actor, item1) if enabledendend # $imported["YEA-ShopOption"]end # Display item sizeend# ============================================================================# Scene classes goes here# ============================================================================class Scene_Menu < Scene_MenuBasealias theo_liminv_start startdef starttheo_liminv_startcreate_liminv_windowenddef create_liminv_window@lim_inv = Window_MenuLimInv.new(@gold_window.width)@lim_inv.x = @command_window.x@lim_inv.y = @command_window.heightendendclass Scene_Item < Scene_ItemBasealias theo_liminv_start startdef starttheo_liminv_startresize_item_windowcreate_freeslot_windowcreate_itemsize_windowcreate_usecommand_windowcreate_discard_amountenddef resize_item_window@item_window.height -= @item_window.line_height * 2enddef create_freeslot_windowwy = @item_window.y + @item_window.heightwh = THEO::LimInv::Display_ItemSize ? Graphics.width/2 : Graphics.width@freeslot = Window_FreeSlot.new(0,wy,wh)@freeslot.viewport = @viewportenddef create_itemsize_windowreturn unless THEO::LimInv::Display_ItemSizewx = @freeslot.widthwy = @freeslot.yww = wx@itemsize = Window_ItemSize.new(wx,wy,ww)@itemsize.viewport = @viewport@item_window.item_size_window = @itemsizeenddef create_usecommand_window@use_command = Window_ItemUseCommand.new@use_command.to_center@use_command.set_handler(:use, method(:use_command_ok))@use_command.set_handler(:discard, method(:on_discard_ok))@use_command.set_handler(:cancel, method(:on_usecmd_cancel))@use_command.viewport = @viewportenddef create_discard_amountwx = @use_command.xwy = @use_command.y + @use_command.heightww = @use_command.width@discard_window = Window_DiscardAmount.new(wx,wy,ww)@discard_window.cmn_window = @use_command@discard_window.itemlist = @item_window@discard_window.freeslot = @freeslot@discard_window.viewport = @viewportendalias theo_liminv_item_ok on_item_okdef on_item_ok@use_command.set_item(item)@use_command.open@use_command.activate@use_command.select(0)endalias theo_liminv_use_item use_itemdef use_item@use_command.closetheo_liminv_use_item@freeslot.refreshenddef use_command_oktheo_liminv_item_ok@use_command.closeenddef on_discard_ok@discard_window.set_item(item)@discard_window.openenddef on_usecmd_cancel@item_window.activate@use_command.close@use_command.deactivateendendclass Scene_Shop < Scene_MenuBasealias theo_liminv_buy_ok on_buy_okdef on_buy_ok@number_window.mode = :buytheo_liminv_buy_okendalias theo_liminv_sell_ok on_sell_okdef on_sell_ok@number_window.mode = :selltheo_liminv_sell_okendend Bugs e Conflitti NotiN/A Altri dettagliN/A http://wwwdonnemanagernapoli.files.wordpress.com/2013/03/napoli-calcio.jpg Link to comment Share on other sites More sharing options...
Guardian of Irael Posted January 13, 2014 Share Posted January 13, 2014 Ah buono script per gli oggetti limitati nel menù, utile pure per altri generi di giochi! Per fortuna vedo anche il comando per forzare l'ottenimento di un oggetto, altrimenti rischiava di farti sprecare oggetti importanti o rari D:^ ^ (\_/)(^ ^) <----coniglietto rosso, me! (> <) Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^ http://i.imgur.com/KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^ http://i.imgur.com/FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^ REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^ 🖤http://www.rpg2s.net/dax_games/r2s_regali2s.png E:3 http://www.rpg2s.net/dax_games/xmas/gifnatale123.gifhttp://i.imgur.com/FfvHCGG.png by Testament (notare dettaglio in basso a destra)! E:3http://i.imgur.com/MpaUphY.jpg by Idriu E:3Membro Onorario, Ambasciatore dei Coniglietti (Membro n.44) http://i.imgur.com/PgUqHPm.pngUfficiale"Ad opera della sua onestà e del suo completo appoggio alla causa dei Panda, Guardian Of Irael viene ufficialmente considerato un Membro portante del Partito, e Ambasciatore del suo Popolo presso di noi"http://i.imgur.com/TbRr4iS.png<- Grazie Testament E:3Ricorda...se rivolgi il tuo sguardo ^ ^ a Guardian anche Guardian volge il suo sguardo ^ ^ a te ^ ^http://i.imgur.com/u8UJ4Vm.gifby Flame ^ ^http://i.imgur.com/VbggEKS.gifhttp://i.imgur.com/2tJmjFJ.gifhttp://projectste.altervista.org/Our_Hero_adotta/ado2.pngGrazie Testament XD Fan n°1 ufficiale di PQ! :DVivail Rhaxen! <- Folletto te lo avevo detto (fa pure rima) che nonavevo programmi di grafica per fare un banner su questo pc XD (ora ho dinuovo il mio PC veramente :D) Rosso Guardiano dellahttp://i.imgur.com/Os5rvhx.pngRpg2s RPG BY FORUM:Nome: Darth Reveal PV totali 2PA totali 16Descrizione: ragazzo dai lunghi capelli rossi ed occhi dello stesso colore. Indossa una elegante giacca rossa sopra ad una maglietta nera. Porta pantaloni rossi larghi, una cintura nera e degli stivali dello stesso colore. E' solito trasportare lo spadone dietro la schiena in un fodero apposito. Ha un pendente al collo e tiene ben legato un pezzo di stoffa (che gli sta particolarmente a cuore) intorno al braccio sinistro sotto la giacca, copre una cicatrice.Bozze vesti non definitive qui.Equipaggiamento:Indossa:60$ e 59$ divisi in due tasche interneLevaitanSpada a due mani elsa lungaGuanti del Defender (2PA)Anello del linguaggio animale (diventato del Richiamo)Scrinieri da lanciere (2 PA)Elmo del Leone (5 PA)Corazza del Leone in Ferro Corrazzato (7 PA) ZAINO (20) contenente:Portamonete in pelle di cinghiale contenente: 100$Scatola Sanitaria Sigillata (può contenere e tenere al sicuro fino a 4 oggetti curativi) (contiene Benda di pronto soccorso x3, Pozione di cura)CordaBottiglia di idromeleForma di formaggioTorcia (serve ad illuminare, dura tre settori)Fiasca di ceramica con Giglio Amaro (Dona +1PN e Velocità all'utilizzatore)Ampolla BiancaSemi di Balissa CAVALLO NORMALE + SELLA (30 +2 armi) contentente:66$Benda di pronto soccorso x3Spada a due maniFagotto per Adara (fazzoletto ricamato) Link to comment Share on other sites More sharing options...
Enom Posted January 13, 2014 Share Posted January 13, 2014 carino ecco qualcosa in piu per attirare il mio interesse grazie raffy, e con questo ho tutti gli script per l'aspetto tecnico, ho quasi tutta la grafica, e ho una storia da inserire, insomma grazie a te posso anche iniziare a darmi da fare xD If you can dream it, you can do it! ^^ Leggete http://www.naiot.it/LaParolaFile/AAVV/Unastoriacarina.htm progetti completati Lino Adventures: minigameLink: http://www.rpg2s.net/forum/index.php/topic/19649-lino-adventures/?view=getnewpost Il genio e il labirinto: minigame (correzione totale e miglioramento incorso) Link: http://www.rpg2s.net/forum/index.php/topic/20071-short-2015-il-labirinto-e-il-genio/?do=findComment&comment=390821 Ringrazio profondamente Guardian of Irael per avermi fatto conoscere uno dei migliori giochi al mondo! XD Premi XD http://www.rpg2s.net/dax_games/r2s_regali3s.png http://www.rpg2s.net/dax_games/uova/pulci1.png Flame http://www.rpg2s.net/dax_games/r2s_regali6sx.pnghttp://img29.imageshack.us/img29/9633/flameswordman.gif Link to comment Share on other sites More sharing options...
raffy2010 Posted January 13, 2014 Author Share Posted January 13, 2014 carino ecco qualcosa in piu per attirare il mio interesse grazie raffy, e con questo ho tutti gli script per l'aspetto tecnico, ho quasi tutta la grafica, e ho una storia da inserire, insomma grazie a te posso anche iniziare a darmi da fare xDPrg u.u http://wwwdonnemanagernapoli.files.wordpress.com/2013/03/napoli-calcio.jpg Link to comment Share on other sites More sharing options...
Kingartur2 Posted January 13, 2014 Share Posted January 13, 2014 Uno delle caratteristiche che ho sempre odiato in un gioco, l'inventario limitato, è odioso e anti-produttivo xD Per qualsiasi motivo non aprite questo spoiler. Ho detto di non aprirlo ! Se lo apri ancora esplode il mondo. Aaaaaa è un vizio. Contento? Il mondo è esploso, sono tutti morti per colpa della tua curiosità . Vuoi che ti venga anche il morbillo, la varicella e l'AIDS??? O bravo ora sei un malato terminale e nessuno ti puo curare, sono tutti morti ! Se clicchi ancora una volta il PC esplode. E dai smettila !! Uff!! Hai cliccato tante volte che ho dovuto sostituirlo con un codebox. http://s8.postimg.org/yntv9nxld/Banner.png http://img204.imageshack.us/img204/8039/sccontest3octpl3.gif Link to comment Share on other sites More sharing options...
Cris_93 Posted March 23, 2014 Share Posted March 23, 2014 Per chi fosse interessato a questo script, vi segnalo che la versione presente nel primo post è vecchia e che qui di seguito ho messo l'ultima versione ! Update logs:- Bugfix. Unequip item causes lose the item if inventory is full- Ability to change base inventory limit using script call- Ability to make your custom formula for inventory limit Ultima versione script : https://raw.github.com/theoallen/RGSS3/master/Limited%20Inventory%20(ENG) Link to comment Share on other sites More sharing options...
raffy2010 Posted March 23, 2014 Author Share Posted March 23, 2014 Grazie per l'informazione ^^ http://wwwdonnemanagernapoli.files.wordpress.com/2013/03/napoli-calcio.jpg Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now