Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
Hello.

I am using Theo limited inventory script for my project. (vx ace)

Theo limited inventory

I want to know if it is possible to add an option to equip the item or weapon from the inventory.

I am using falcao pearl abs script and it allows you to use a key to open a window and there you can choose which weapon to equip.

but some people have told me that they find this way of equipping weapons unintuitive because they get confused and think they have to access the inventory to equip it.

IMG_20220303_193447.jpg

Would it be possible to add this option to equip above "use" option? it would really help me a lot in my project.

Thanks
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
*updated below
 
Last edited:
Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Equip From Item Menu - Falco ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║    For Falco ABS Game               ╠════════════════════╣
# ║ Equip items from Item menu          ║    04 Mar 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Plug & play                                              ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use:                       ║
# ║ Free for all uses in RPG Maker      ║
# ╚═════════════════════════════════════╝

module Theo
  module LimInv
    EquipVocab      = "Equip item"    # Use item
  end
end

class Window_ItemUseCommand < Window_Command
  alias r2_equip_limit_item_command make_command_list
  def make_command_list
    add_command(EquipVocab, :equip, !$game_party.usable?(@item))
    r2_equip_limit_item_command
  end
end

class Scene_Item < Scene_ItemBase
  def create_usecommand_window
    @use_command = Window_ItemUseCommand.new
    @use_command.to_center
    @use_command.set_handler(:equip, method(:equip_command_ok))
    @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 = @viewport
  end
 
  def equip_command_ok
    @use_command.close
    show_sub_window(@actor_window)
    @actor_window.select_equip_item(item)
    id = @actor_window.index
    return unless id.between?(0,9)
    @act_id = $game_party.members[id]
    if @sel_item.etype_id == 0
      perform_item_ok(@sel_item, @act_id)
    elsif @sel_item.etype_id == 1
      perform_item_ok(@sel_item, @act_id)
    else
      hide_sub_window(@actor_window)
      Sound.play_buzzer
      @use_command.activate
    end
  end
 
  def act_id
    return @act_id
  end

  def sel_itm
    return @sel_item
  end
 
  alias r2_liminv_item_ok on_item_ok
  def on_item_ok
    @sel_item = @item_window.item
    r2_liminv_item_ok
  end

  def perform_item_ok(item, pid)
    return if item.nil?
    case item
    when RPG::Weapon
      pid.change_equip_by_id(0, item.id)
    when RPG::Armor
      pid.change_equip_by_id(1, item.id)
    end
  end
 
  def on_actor_ok
    if @actor.equippable?(item)
      equip_item
    elsif item_usable?
      use_item
    else
      Sound.play_buzzer
    end
  end
 
  def equip_item
    user.equippable?(item)
    Sound.play_equip
    check_common_event
    check_gameover
    hide_sub_window(@actor_window)
  end

end

class Window_MenuActor < Window_MenuStatus
  def select_equip_item(item)
    select($game_party.menu_actor.index)
  end
end

class Window_Selectable < Window_Base
  def process_ok
    if current_item_enabled?
      Sound.play_ok
      Input.update
      deactivate
      call_ok_handler
    else
      if SceneManager.scene_is?(Scene_Item)
        if SceneManager.scene.act_id.equippable?(SceneManager.scene.sel_itm)
          return
        else
          Sound.play_buzzer
        end
      else
        Sound.play_buzzer
      end
    end
  end
end

oh thank you very much, it works but i get an error when i select "use" on a weapon.

use item.png

Wouldn't it be better to hide the "use" option for weapons and armors?

This error also occurs when I try to equip an item (for example a potion).

In conclusion:

Equip weapon -> Works!
Equip Item->Error
Use Object->Works!
Use Weapon->Error
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
Equip weapon -> Works!
Equip Item->Error
Use Object->Works!
Use Weapon->Error
Try moving the scripts around. You have something else that is overwriting.
1646404505898.png1646404516416.png
But I can try and see if the command can be not present for those circumstances
 
Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
Try moving the scripts around. You have something else that is overwriting.
But I can try and see if the command can be not present for those circumstances
Oh thanks,
I have this script just above Main.

I think it's best to hide "use" for weapons.

the "equip" option for objects is deactivated, it should be activated and the error should not appear, falcao also allows you to equip objects.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
*updated below
 
Last edited:
Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
Updated the ItemUseCommand section. Try again

"Use" option no longer appears on weapons, great!

But you hid the "equip" option for items. It should be possible to equip an item in one of the two slots that falcao script allows.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
The best way to do that is to use the quicktool scene.
*updated below
 
Last edited:
Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
The best way to do that is to use the quicktool scene.
Ruby:
module Theo
  module LimInv
    EquipVocab      = "Equip item"    # Use item
  end
end

class Window_ItemUseCommand < Window_Command
  def make_command_list
    add_command(EquipVocab, :equip)
    add_command(UseVocab, :use) if $game_party.usable?(@item)
    add_command(DiscardVocab, :discard, discardable?(@item))
    add_command(CancelVocab, :cancel)
  end
end

class Scene_Item < Scene_ItemBase
  def create_usecommand_window
    @use_command = Window_ItemUseCommand.new
    @use_command.to_center
    @use_command.set_handler(:equip, method(:equip_command_ok))
    @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 = @viewport
  end
 
  def equip_command_ok
    @use_command.close
    show_sub_window(@actor_window)
    @actor_window.select_equip_item(item)
    id = @actor_window.index
    return unless id.between?(0,9)
    @act_id = $game_party.members[id]
    if @sel_item.class == RPG::Item
      SceneManager.call(Scene_QuickTool)
    else
      if @sel_item.etype_id == 0
        perform_item_ok(@sel_item, @act_id)
      elsif @sel_item.etype_id == 1
        perform_item_ok(@sel_item, @act_id)
      else
        hide_sub_window(@actor_window)
        Sound.play_buzzer
        @use_command.activate
      end
    end
  end
 
  def act_id
    return @act_id
  end

  def sel_itm
    return @sel_item
  end
 
  alias r2_liminv_item_ok on_item_ok
  def on_item_ok
    @sel_item = @item_window.item
    r2_liminv_item_ok
  end

  def perform_item_ok(item, pid)
    return if item.nil?
    case item
    when RPG::Weapon
      pid.change_equip_by_id(0, item.id)
    when RPG::Armor
      pid.change_equip_by_id(1, item.id)
    end
  end
 
  def on_actor_ok
    if @actor.equippable?(item)
      equip_item
    elsif item_usable?
      use_item
    else
      Sound.play_buzzer
    end
  end
 
  def equip_item
    user.equippable?(item)
    Sound.play_equip
    check_common_event
    check_gameover
    hide_sub_window(@actor_window)
  end

end

class Window_MenuActor < Window_MenuStatus
  def select_equip_item(item)
    select($game_party.menu_actor.index)
  end
end

class Window_Selectable < Window_Base
  def process_ok
    if current_item_enabled?
      Sound.play_ok
      Input.update
      deactivate
      call_ok_handler
    else
      if SceneManager.scene_is?(Scene_Item)
        if SceneManager.scene.act_id.equippable?(SceneManager.scene.sel_itm)
          return
        else
          Sound.play_buzzer
        end
      else
        Sound.play_buzzer
      end
    end
  end
end
Ruby:
class Scene_Skill < Scene_ItemBase
  alias r2_falco_equip_skill_command  create_command_window
  def create_command_window
    r2_falco_equip_skill_command
    @command_window.set_handler(:equip,    method(:command_equip))
  end
  def command_equip
    SceneManager.call(Scene_QuickTool)
  end
end
class Window_SkillCommand < Window_Command
  def make_command_list
    return unless @actor
    @actor.added_skill_types.sort.each do |stype_id|
      name = $data_system.skill_types[stype_id]
      add_command(name, :skill, true, stype_id)
    end
    add_command("Equip Skill", :equip)
  end
end
With this new script, equipping an item does not equip it but instead opens Falcao's "quick tool" window. That would confuse players a bit, and they might say, "But why do I have to open two windows to equip an item, and only one window to equip a weapon?"

There is no way to equip the item directly?

sorry for so much inconvenience.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
opens Falcao's "quick tool" window.
I know. I made it that way.
This is the easy way. Then the player doesn't need to learn to press other buttons besides Z and X.
My first attempt was just to load the falco scene when selecting equip on anything. I could change it all back to that if you want?

The other way is to rewrite the falco script altogether. Since equipping an item requires selecting a slot just like skills.
I may get to doing this, but it will take time as I'm not interested in redoing the entire script to include most of falco's functions.

they might say, "But why do I have to open two windows to equip an item, and only one window to equip a weapon?"
Because they are lazy and don't want to remember to push a button instead of opening the menu.
Which was the reason for your request.

There is no way to equip the item directly?
No items and skills require selecting a slot which would involve loading most of falco's script functions. (remaking the script)

sorry for so much inconvenience.
You're trying to accommodate to the lowest denominator. I understand.
But I figured you would be asking for more and more because you want this to function like the falco menu doesn't exist instead of telling players to press N.
Making it easy for the player to not have to learn too much.

This will probably take a few days as I have lots of other things to do. The first version only took 2 hours to figure out.

*updated below
 
Last edited:
Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
I know. I made it that way.
This is the easy way. Then the player doesn't need to learn to press other buttons besides Z and X.
My first attempt was just to load the falco scene when selecting equip on anything. I could change it all back to that if you want?

The other way is to rewrite the falco script altogether. Since equipping an item requires selecting a slot just like skills.
I may get to doing this, but it will take time as I'm not interested in redoing the entire script to include most of falco's functions.


Because they are lazy and don't want to remember to push a button instead of opening the menu.
Which was the reason for your request.


No items and skills require selecting a slot which would involve loading most of falco's script functions. (remaking the script)


You're trying to accommodate to the lowest denominator. I understand.
But I figured you would be asking for more and more because you want this to function like the falco menu doesn't exist instead of telling players to press N.
Making it easy for the player to not have to learn too much.

This will probably take a few days as I have lots of other things to do. The first version only took 2 hours to figure out.

I know, I understand that it is a bit difficult.

But it is that some people who have tried my game strongly criticize that the equipment menu is not very intuitive, they have even uninstalled the demo because the controls are not very intuitive. RPG Maker is the culprit haha.

People are used to dynamic Stardew Valley type menus, where you can select any item and easily equip it to the slot (PearlSkill) without having to enter any other menus.

I key:-> Inventory: See description, use and discard.
N key: ->Equip item. (Same inventory but equip) XD

People who have not played RPG Maker games do not assimilate that, they are not used to it, and that is why they criticize this type of system so much.

Thank you if you manage to advance something these days, I'm not in a hurry.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
I was wrong I copied over a few methods and got it working for items.
I'll look into skill later. Got to go.
*updated below
 
Last edited:
Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
I was wrong I copied over a few methods and got it working for items.
I'll look into skill later. Got to go.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Equip From Item Menu - Falco ║  Version: 1.02     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║    For Falco ABS Game               ╠════════════════════╣
# ║ Equip items from Item menu          ║    04 Mar 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Plug & play                                              ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use:                       ║
# ║ Free for all uses in RPG Maker      ║
# ╚═════════════════════════════════════╝

module Theo
  module LimInv
    EquipVocab      = "Equip item"    # Use item
  end
end

class Window_ItemUseCommand < Window_Command
  def make_command_list
    add_command(EquipVocab, :equip)
    add_command(UseVocab, :use) if $game_party.usable?(@item)
    add_command(DiscardVocab, :discard, discardable?(@item))
    add_command(CancelVocab, :cancel)
  end
end

class Scene_Item < Scene_ItemBase
  def create_usecommand_window
    @use_command = Window_ItemUseCommand.new
    @use_command.to_center
    @use_command.set_handler(:equip, method(:equip_command_ok))
    @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 = @viewport
  end
 
  def create_slot_confirm
    @slot_confirm = Window_SlotConfirm.new(Graphics.width / 2 - 60 / 2,
     Graphics.height / 2 - 85 / 2, :item)
    if @sel_item.class == RPG::Item
      @slot_confirm.set_handler(:slot1,     method(:open_slots))
      @slot_confirm.set_handler(:slot2,     method(:open_slots))
    else
      @slot_confirm.set_handler(:slot1,     method(:open_slots))
      @slot_confirm.set_handler(:slot2,     method(:open_slots))
      @slot_confirm.set_handler(:slot3,     method(:open_slots))
      @slot_confirm.set_handler(:slot4,     method(:open_slots))
    end
  end

  def open_slots
    if @sel_item.class == RPG::Item
      case @slot_confirm.current_symbol
      when :slot1 then @act_id.assigned_item  = @sel_item
      when :slot2 then @act_id.assigned_item2 = @sel_item
      end
    else
      case @slot_confirm.current_symbol
      when :slot1 then @act_id.assigned_skill  = @sel_item
      when :slot2 then @act_id.assigned_skill2 = @sel_item
      when :slot3 then @act_id.assigned_skill3 = @sel_item
      when :slot4 then @act_id.assigned_skill4 = @sel_item
      end
    end
    Sound.play_equip
    @item_window.activate
    @slot_confirm.deactivate
    @slot_confirm.dispose
    @slot_confirm = nil
  end

  def equip_command_ok
    @use_command.close
    show_sub_window(@actor_window)
    @actor_window.select_equip_item(item)
    id = @actor_window.index
    return unless id.between?(0,9)
    @act_id = $game_party.members[id]
    if @sel_item.class == RPG::Item
      hide_sub_window(@actor_window)
      create_slot_confirm
      @slot_confirm.z = 1000
      @item_window.deactivate
      @slot_confirm.activate
    else
      if @sel_item.etype_id == 0
        perform_item_ok(@sel_item, @act_id)
      elsif @sel_item.etype_id == 1
        perform_item_ok(@sel_item, @act_id)
      else
        hide_sub_window(@actor_window)
        Sound.play_buzzer
        @use_command.activate
      end
    end
  end
 
  def act_id
    return @act_id
  end

  def sel_itm
    return @sel_item
  end
 
  alias r2_liminv_item_ok on_item_ok
  def on_item_ok
    @sel_item = @item_window.item
    r2_liminv_item_ok
  end

  def perform_item_ok(item, pid)
    return if item.nil?
    case item
    when RPG::Weapon
      pid.change_equip_by_id(0, item.id)
    when RPG::Armor
      pid.change_equip_by_id(1, item.id)
    end
  end
 
  def on_actor_ok
    if @actor.equippable?(item)
      equip_item
    elsif item_usable?
      use_item
    else
      Sound.play_buzzer
    end
  end
 
  def equip_item
    user.equippable?(item)
    Sound.play_equip
    check_common_event
    check_gameover
    hide_sub_window(@actor_window)
  end

end

class Window_MenuActor < Window_MenuStatus
  def select_equip_item(item)
    select($game_party.menu_actor.index)
  end
end

class Window_Selectable < Window_Base
  def process_ok
    if current_item_enabled?
      Sound.play_ok
      Input.update
      deactivate
      call_ok_handler
    else
      if SceneManager.scene_is?(Scene_Item)
        if SceneManager.scene.act_id.equippable?(SceneManager.scene.sel_itm)
          return
        else
          Sound.play_buzzer
        end
      else
        Sound.play_buzzer
      end
    end
  end
end

oh, thank you very much, actually I don't need the skill.

The only thing that is missing is the armor, but it is natural that it does not allow, since the armor I am using with another script called "Blackmorning Advanced Equip ",

thank you very much really.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
Added cancel command
*Updated below
 
Last edited:

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
482
Reaction score
202
First Language
English
Primarily Uses
RMXP
@Roninator2

Ruby:
class Window_ItemUseCommand < Window_Command

Since Ruby classes are always open, you DON'T need to repeat its inheritance declaration over and over again. Only new / custom classes you made for a given script that are not found in previous ones would need that kind of declaration.

Ruby:
      @slot_confirm.set_handler(:slot1,     method(:open_slots))
      @slot_confirm.set_handler(:slot2,     method(:open_slots))
      @slot_confirm.set_handler(:cancel,    method(:equip_cancel))

Since those three calls are repeated in your new code, you better keep them outside the conditional statement for good. You see, the so called handler is a hash after all so there is no actual need to add those menthods in a specific order. (Only later versions of Ruby library would care about when you add a hash key. Version 1.9 is just too old to make you sweat because of later changes to the internal implementation of hashes.)

Ruby:
return unless id.between?(0,9)

There it would be better to define it as follows:

Ruby:
return if id > 9

It would be more efficient than your statement.

Also true here:

Ruby:
if @sel_item.etype_id == 0
  perform_item_ok(@sel_item, @act_id)
elsif @sel_item.etype_id == 1
  perform_item_ok(@sel_item, @act_id)
else
  # some code here
end

Ruby:
  if @sel_item.etype_id < 2
    perform_item_ok(@sel_item, @act_id)
  end
 
Last edited:
Joined
Aug 13, 2019
Messages
69
Reaction score
12
First Language
english
Primarily Uses
RMVXA
@Roninator2

Ruby:
class Window_ItemUseCommand < Window_Command

Since Ruby classes are always open, you DON'T need to repeat its inheritance declaration over and over again. Only new / custom classes you made for a given script that are not found in previous ones would need that kind of declaration.

Ruby:
      @slot_confirm.set_handler(:slot1,     method(:open_slots))
      @slot_confirm.set_handler(:slot2,     method(:open_slots))
      @slot_confirm.set_handler(:cancel,    method(:equip_cancel))

Since those three calls are repeated in your new code, you better keep them outside the conditional statement for good. You see, the so called handler is a hash after all so there is no actual need to add those menthods in a specific order. (Only later versions of Ruby library would care about when you add a hash key. Version 1.9 is just too old to make you sweat because of later changes to the internal implementation of hashes.)

Ruby:
return unless id.between?(0,9)

There it would be better to define it as follows:

Ruby:
return if id > 9

It would be more efficient than your statement.

Also true here:

Ruby:
if @sel_item.etype_id == 0
  perform_item_ok(@sel_item, @act_id)
elsif @sel_item.etype_id == 1
  perform_item_ok(@sel_item, @act_id)
else
  # some code here
end

Ruby:
  if @sel_item.etype_id < 2
    perform_item_ok(@sel_item, @act_id)
  end

I didn't understand much, so what would the new efficient script look like?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
so what would the new efficient script look like?
There would be no change to the functionality, just the efficiency of the code.

you DON'T need to repeat its inheritance declaration over and over again.
You have mentioned this to me several times.
While it may not be necessary, since it doesn't cause issues I would prefer to have them there. It allows me to make a quick reference in my mind of what inheritance I'm using and makes it easier to understand when something goes wrong when I'm expecting a method from a separate class, but it can't be called, as an odd example.

As for the rest, I could make the changes (and may still do so for programming efficiency), but my problem was that the code was developed as you see through my trials of testing/learning what data is used where. Once I got the situation working I normally leave it. So you would be right in that respect, I should optimize my code/evaluate my code for effectiveness.

Thank you
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
482
Reaction score
202
First Language
English
Primarily Uses
RMXP
I suspect Roninator2 left an extra "end" when he posted the following as a replacement of his original code:

Ruby:
if @sel_item.etype_id < 2
    perform_item_ok(@sel_item, @act_id)
  end

Yeah, I'm talking about that final end in my fixed code suggestion right above.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,140
Reaction score
1,109
First Language
English
Primarily Uses
RMVXA
I suspect Roninator2 left an extra "end" when he posted the following as a replacement of his original code:
Thank you, Obviously not watching what I'm doing.

Updated script
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Equip From Menu - Falco ABS  ║  Version: 1.06     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║    For Falco ABS Game               ╠════════════════════╣
# ║ Equip items from Item menu          ║    04 Mar 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires:                                                ║
# ║   Theoallen Limited Inventory                            ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║   Fixed system equipping weapons before selecting actor  ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use:                       ║
# ║ Free for all uses in RPG Maker      ║
# ╚═════════════════════════════════════╝

module Theo
  module LimInv
    EquipVocab      = "Equip item"    # Use item
    SkillVocab      = "Equip Skill"
    UseSKVocab      = "Use Skill"
  end
end

class Window_ItemUseCommand < Window_Command
  def make_command_list
    add_command(EquipVocab, :equip)
    add_command(UseVocab, :use) if $game_party.usable?(@item)
    add_command(DiscardVocab, :discard, discardable?(@item))
    add_command(CancelVocab, :cancel)
  end
end

class Scene_Item < Scene_ItemBase
  attr_reader :actor
  def create_usecommand_window
    @use_command = Window_ItemUseCommand.new
    @use_command.to_center
    @use_command.set_handler(:equip, method(:equip_command_ok))
    @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 = @viewport
  end
 
  def create_slot_confirm
    return if @slot_confirm
    @slot_confirm = Window_SlotConfirm.new(Graphics.width / 2 - 60 / 2,
     Graphics.height / 2 - 85 / 2, :item)
    if @sel_item.class == RPG::Item
      @slot_confirm.set_handler(:slot1,     method(:open_slots))
      @slot_confirm.set_handler(:slot2,     method(:open_slots))
      @slot_confirm.set_handler(:cancel,    method(:equip_cancel))
    else
      @slot_confirm.set_handler(:slot1,     method(:open_slots))
      @slot_confirm.set_handler(:slot2,     method(:open_slots))
      @slot_confirm.set_handler(:slot3,     method(:open_slots))
      @slot_confirm.set_handler(:slot4,     method(:open_slots))
      @slot_confirm.set_handler(:cancel,    method(:equip_cancel))
    end
  end

  def open_slots
    if @sel_item.class == RPG::Item
      case @slot_confirm.current_symbol
      when :slot1 then @actor.assigned_item  = @sel_item
      when :slot2 then @actor.assigned_item2 = @sel_item
      when :cancel then @sel_item = nil
      end
    else
      case @slot_confirm.current_symbol
      when :slot1 then @actor.assigned_skill  = @sel_item
      when :slot2 then @actor.assigned_skill2 = @sel_item
      when :slot3 then @actor.assigned_skill3 = @sel_item
      when :slot4 then @actor.assigned_skill4 = @sel_item
      when :cancel then @sel_item = nil
      end
    end
    Sound.play_equip
    @item_window.activate
    @slot_confirm.deactivate
    @slot_confirm.close
  end

  def equip_command_ok
    @use_command.close
    @actor_window.select_equip_item(item)
    show_sub_window(@actor_window)
    @actor_window.select(0)
  end
 
  def sub_select_ok
    id = @actor_window.index
    @actor = $game_party.members[id]
    if @sel_item.etype_id < 2
      perform_item_ok(@sel_item, @actor)
    else
      hide_sub_window(@actor_window)
      Sound.play_buzzer
      @use_command.activate
    end
  end

  def equip_item
    id = @actor_window.index
    @actor = $game_party.members[id]
    hide_sub_window(@actor_window)
    create_slot_confirm
    @slot_confirm.open
    @slot_confirm.z = 1000
    @item_window.deactivate
    @slot_confirm.activate
  end
 
  def sel_itm
    return @sel_item
  end
 
  alias r2_liminv_item_ok on_item_ok
  def on_item_ok
    @sel_item = @item_window.item
    r2_liminv_item_ok
  end

  def perform_item_ok(item, actor)
    return if item.nil?
    case item
    when RPG::Weapon
      actor.change_equip_by_id(0, item.id)
    when RPG::Armor
      actor.change_equip_by_id(1, item.id)
    end
  end
 
  def on_actor_ok
    if @actor.equippable?(item)
      sub_select_ok
      equip_tool
    elsif item.is_a?(RPG::Item) && !item.key_item? && @use_command.index == 1
      use_item
    elsif item.is_a?(RPG::Item)
      equip_item
    else
      Sound.play_buzzer
    end
  end
 
  def equip_tool
    user.equippable?(item)
    Sound.play_equip
    check_common_event
    check_gameover
    hide_sub_window(@actor_window)
  end
 
  def equip_cancel
    @item_window.activate
    @slot_confirm.deactivate
    @slot_confirm.dispose
    @slot_confirm = nil
  end
end

class Window_MenuActor < Window_MenuStatus
  def select_equip_item(item)
    select($game_party.menu_actor.index)
  end
end

class Window_Selectable < Window_Base
  def process_ok
    if current_item_enabled?
      Sound.play_ok
      Input.update
      deactivate
      call_ok_handler
    else
      if SceneManager.scene_is?(Scene_Item)
        if SceneManager.scene.actor.equippable?(SceneManager.scene.sel_itm)
          return
        else
          Sound.play_buzzer
        end
      else
        Sound.play_buzzer
      end
    end
  end
end

class Window_SlotConfirm < Window_Command
  def window_height() return @kind == :item ? 100 : 140   end
  def make_command_list
    case @kind
    when :item
      add_command('Slot ' + Key::Item[1],    :slot1)
      add_command('Slot ' + Key::Item2[1],   :slot2)
      add_command('Cancel',   :cancel)
    when :skill
      add_command('Slot ' + Key::Skill[1],   :slot1)
      add_command('Slot ' + Key::Skill2[1],  :slot2)
      add_command('Slot ' + Key::Skill3[1],  :slot3)
      add_command('Slot ' + Key::Skill4[1],  :slot4)
      add_command('Cancel',   :cancel)
    end
  end
end

class Window_SkillList < Window_Selectable
  def enable?(item)
    @actor
  end
end

class Window_EquipUseCommand < Window_Command
  include Theo::LimInv

  def initialize
    super(Graphics.width / 2 - window_width / 2, Graphics.height / 2 - 48)
    self.openness = 0
  end
 
  def window_width
    160
  end
 
  def set_skill(skill)
    @skill = skill
  end
 
  def make_command_list
    add_command(SkillVocab, :equip)
    add_command(UseSKVocab, :use)
    add_command(CancelVocab, :cancel)
  end
 
  def to_center
    self.x = Graphics.width/2 - width/2
    self.y = Graphics.height/2 - height/2
  end
 
end

class Scene_Skill < Scene_ItemBase
  alias r2_skill_equip_falco_start  start
  def start
    r2_skill_equip_falco_start
    create_equip_window
  end
 
  def command_equip
    @use_command.close
    create_slot_confirm
    @slot_confirm.z = 1000
    @item_window.deactivate
    @slot_confirm.activate
  end
 
  alias r2_equip_skill_ok on_item_ok
  def on_item_ok
    if item.nil?
      @item_window.activate
      return
    end
    @use_command.open
    @use_command.activate
    @use_command.select(0)
  end
 
  def use_command_ok
    if @actor.usable?(item)
      r2_equip_skill_ok
      @use_command.close
    else
      Sound.play_buzzer
      @use_command.activate
      return
    end
  end

  def on_usecmd_cancel
    @item_window.activate
    @use_command.close
    @use_command.deactivate
  end

  def create_equip_window
    @use_command = Window_EquipUseCommand.new
    @use_command.to_center
    @use_command.set_handler(:equip,    method(:command_equip))
    @use_command.set_handler(:use, method(:use_command_ok))
    @use_command.set_handler(:cancel, method(:on_usecmd_cancel))
    @use_command.viewport = @viewport
  end

  def create_slot_confirm
    @slot_confirm = Window_SlotConfirm.new(Graphics.width / 2 - 60 / 2,
    Graphics.height / 2 - 85 / 2, :skill)
    @slot_confirm.set_handler(:slot1,     method(:open_slots))
    @slot_confirm.set_handler(:slot2,     method(:open_slots))
    @slot_confirm.set_handler(:slot3,     method(:open_slots))
    @slot_confirm.set_handler(:slot4,     method(:open_slots))
  end

  def open_slots
    case @slot_confirm.current_symbol
    when :slot1 then @actor.assigned_skill  = item
    when :slot2 then @actor.assigned_skill2 = item
    when :slot3 then @actor.assigned_skill3 = item
    when :slot4 then @actor.assigned_skill4 = item
    end
    Sound.play_equip
    @item_window.activate
    @slot_confirm.deactivate
    @slot_confirm.dispose
    @slot_confirm = nil
  end
 
end
 
Last edited:

Latest Threads

Latest Profile Posts

Dog saliva is an antiseptic.
NghNgE9.gif
Oh man. IGMC's finally back. I really want to participate, but I'm not sure if I have the time.
It is DC's turn to be celebrating her leveling up and starts her 20th year. We were many to think she wouldn't live that long. Starts your cats motors and make 'em purr!
why_hello_mira.jpg

I made myself a cult leader, and a concept scene for him as well. :LZSexcite:

Forum statistics

Threads
123,318
Messages
1,155,748
Members
161,739
Latest member
Ken_Brightblade
Top