[XP] Drago Inventory System

Started by LiTTleDRAgo, March 31, 2012, 11:54:43 am

Previous topic - Next topic

LiTTleDRAgo

fixed

update, added "unequip" function in equip menu

QuentinWhite

Beautiful  8)

Everything is perfect now. Havent found a single bug.

LiTTleDRAgo

update, fixed a glitch in "unequip" when player can unequip a fixed equipment

kmart002

Have you fixed the discard problem yet?

LiTTleDRAgo

I believe it's already fixed

update script to 1.96
can use separate inventory for each actor and added "transfer inventory"

to disable it, change to nil in the config
QuoteTRANSFER_COM   = "Transfer"    # Insert nil to disable permanently

kmart002

I just tested it and I had 4 Potions in my inventory, clicked discard and it discarded them all.

LiTTleDRAgo

ah, you mean you want to discard one-by-one?

find this section and change the striked word
Quote#--------------------------------------------------------------------------
  # * Discard Item Processing
  #--------------------------------------------------------------------------
  def discard_item
    slot = @item_window[0].inventory.slot_reverse(@item) rescue nil
    return if slot.nil?
    type, id, n = slot.item_type, slot.item_id, slot.amount 1
    if LiTTleDRAgo::NONDISCARD[type].include?(id)
      return sound_play('buzzer')
    end
    $game_party.no_multi_use = true
    sound_play('decision')
    $game_party.reduce_item(@item, n)
    $game_party.limit_inventory.remove_item_reverse (type, id, n)
    @welcome_window.refresh
    @item_window.each {|i| i.refresh }
    @item_window[0].active = true
    @item_window[0].index = [@item_window[0].index - 1, 0].max
    @invcom_window.each {|i|  i.active = i.visible = false }
    $game_party.no_multi_use = false
    @window_eq_active = false
    @must_update = true
  end


I guess I'll add a feature to select the amount you want to discard later

kmart002

Haha yes that's it. Thanks a ton, this script is fucking awesome.

LiTTleDRAgo

update 1.99, added feature to select amount you want to discard

kmart002

With the discard feature...when I click to discard, but then I just exit out without discarding, the game freezes, I don't know if that's a script problem or the game itself.

kmart002

Also, I used the maximum amount of writing in the description for an item, but when it shows in the item menu, it's cut off. any way to separate it with more lines, or paragraph?

LiTTleDRAgo

Quote from: kmart002 on November 07, 2012, 05:41:01 pm
With the discard feature...when I click to discard, but then I just exit out without discarding, the game freezes, I don't know if that's a script problem or the game itself.


it seems I can't reproduce the problem, but probably it's already fixed now

Quote from: kmart002 on November 08, 2012, 01:16:37 am
Also, I used the maximum amount of writing in the description for an item, but when it shows in the item menu, it's cut off. any way to separate it with more lines, or paragraph?


fixed

kmart002

Yes the discard thing is fixed, and the paragraph thing is fixed as well. There's one more problem lol when I get an item, go into the menu to look at it, it'll show the name/stats/etc. When I go out of the menu back to the game, then go into the menu AGAIN, the name of the item disappears


Vexus

Mind telling me what parts are updated (For the freeze on discard, I have it too.) since mine is edited and would need to re-change everything if I had to take the newest version again?

Thanks
Current Project/s:

LiTTleDRAgo

November 09, 2012, 09:31:38 am #35 Last Edit: November 09, 2012, 09:34:53 am by LiTTleDRAgo
I believe it is something in
def cancel_combination

I don't have PC right now (currently in mobile) so I can't answer the details
you can compare the code by yourself

Vexus

That part is slightly different in the newest version than mine but it doesn't solve it but gives me an error so probably more than that should be added.
Current Project/s:

LiTTleDRAgo

November 10, 2012, 10:21:28 am #37 Last Edit: November 10, 2012, 10:06:57 pm by LiTTleDRAgo
probably this part
Spoiler: ShowHide
Quote
  #--------------------------------------------------------------------------
  # * cancel_combination
  #--------------------------------------------------------------------------
  def cancel_combination
    sound_play('cancel')
    discard_item_value(0) if @inpnum_window[0].active
    @item_window[0].active  = true  unless @inpnum_window[0].active
    @item_window[0].visible = true  unless @inpnum_window[0].active
    @item_window[1].active  = false unless @inpnum_window[0].active
    @item_window[1].visible = false unless @inpnum_window[0].active
    @invcom_window.each {|i|  i.active = i.visible = false }
    @inpnum_window.each {|i|  i.active = i.visible = false }
    @equip_window_active = @number_overload = nil
    @sta_window['well'].refresh
    @number_item = 0
    return
  end
Quote
  #--------------------------------------------------------------------------
  # * discard_item_value
  #--------------------------------------------------------------------------
  def discard_item_value(number = @inpnum_window[0].number)
    slot = @item_window[0].inventory.slot_reverse(@item) rescue nil
    return if slot.nil?
    type, id, n = slot.item_type, slot.item_id, number
    return sound_play('buzzer') if LiTTleDRAgo::NONDISCARD[type].include?(id)
    sound_play(number > 0 ? 'decision' : 'cancel')
    $game_party.no_multi_use = true
    n.times {  $game_party.lose_item(@item, 1) if item_number(@item) > 0  }
    @sta_window['well'].refresh
    @item_window.each {|i| i.refresh }
    @inpnum_window.each {|i| i.active = i.visible = false }
    @item_window[0].active = true
    @item_window[0].index = [[@item_window[0].index-1,0].max,
                              @item_window[0].item_max-1].min
    $game_party.no_multi_use = false
    @equip_window_active = false
    @must_update = true
  end


btw about your horizontal command (add this above the script)
Spoiler: ShowHide
Quote#==============================================================================
# ** Window_Command_Hor
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================

class Window_Command_Hor < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    super(width*commands.size, commands)
    self.height = 64
    @column_max = commands.size
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Get Row Count
  #--------------------------------------------------------------------------
  def row_max() 1 end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new((self.width/4)*index+4, 0, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end
end


then change Window_Command.new in this part (code may differ)
Spoiler: ShowHide
Quote#--------------------------------------------------------------------------
  # * create_inv_com_window
  #--------------------------------------------------------------------------
  def create_inv_com_window
    comb = combine_not_exist? ? '' : LiTTleDRAgo::COMBINE_COM
    equ  = equip_not_exist?   ? '' : LiTTleDRAgo::EQ_COM
    del  = [LiTTleDRAgo::DIS_COM, LiTTleDRAgo::CANCEL_COM]
    use  = LiTTleDRAgo::USE_COM
    nocb = combine_not_exist? ||  $game_party.disable_combine
    noeq = equip_not_exist? || $game_party.disable_equip
    tra  = transfer_com
    command_item = tra != '' && !bypass_one_actor?(1) ?
              (nocb ? [use,tra,del[0],del[1]] : [use,tra,comb,del[0]]) :
              (nocb ? [use,del].flatten       : [use, comb, del[0]] )
    command_weap = tra != '' && !bypass_one_actor?(1)  ?
              (nocb ? noeq ? [del[0],tra,del[1]] : [equ,tra,del[0]] :
               noeq ? [comb,tra,del[0],del[1]] : [comb,tra,equ,del[0]]) :
              (nocb ? noeq ? [del].flatten : [equ,del[0]] :
               noeq ? [comb,del[0],del[1]] : [comb,equ,del[0]])       
    @invcom_window = [Window_Command.new(160, command_item),
                      Window_Command.new(160, command_weap),
                      Window_Command.new(160,[comb,del[1]]),
                      Window_Command.new(190,['',''])]

    @invcom_window.each_with_index {|i,s|  i.x = s == 3 ? 228 : 258
                              i.y = 160 + 1*32
                              i.z = @item_window[0].z + 200
                              i.active = i.visible = false }
  end

to
QuoteWindow_Command_Hor.new


and change the x position in this part(code may differ)
Spoiler: ShowHide
Quote@invcom_window.each_with_index {|i,s|  i.x = s == 3 ? 228 : 258
                              i.x = ?
                              i.y = 160 + 1*32 ?
                              i.z = @item_window[0].z + 200
                              i.active = i.visible = false }

Vexus

It no longer gives me an error and "works" but now after the menu goes away x item that I cancelled from discarding gets sorted in the first slot if you try on another item that item gets sorted in the first slot and the previous goes back to it's real position.

Pretty weird stuff haha.

Ps. Thanks for the command window.
Current Project/s:

Kiwa

Hey!

I really like the item system. Tho I haven't tested it fully.
however i found something right off the bat that i wasn't sure was intended.
But im guessing it may be since no one brought it up in this thread

When i hit Spell Book, Equip, or Status. all bring me to your delightful item menu.
if it is intended, is there a way i can separate them?
i skimmed thru the code but cant find anything (tho i'm talentless with code lol).
id like only clicking "Item" to bring me to your system if possible.

Thanks :D