RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[SOLVED/Thanks TDS!] Equip for one-player only

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 89
One-player weapon equip
~22.08.2010



Summary
Okay, so that's what I'm looking for...
I want player to be able equip WEAPON from the item inventory, something like map-usable items.
The game has ONLY ONE MEMBER IN TEAM, and this won't change for sure. No party, so I need this just for first hero on database character list.
If this is important, I used "Limited Inventory" script by modern_algebra, too.
And one more thing: why not default euqip scene? As I said, no party, so the selections windows are useless, and this isn't standard RPG game, so I don't need those weapon/character stats, too.

Features Desired
  • Equip option for weapons, but if not a problem - also for other accesories
  • Attaching just for the first player in the party!

Mockups
Dreamed version should look like this:
http://ifotos.pl/img/dream_wesaqp.PNG

Games its been in
  • Harvest Moon



Did you search?
Yes

Where did you search?

What did you search for?
  • equip/ment
  • weapon
  • cms
  • one-player
  • scene_equip

I'll credit, and I'll be very grateful for help!!  :tpg:



« Last Edit: August 27, 2010, 11:40:40 PM by Fizzly »
Regards,
Mike

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
I see you fixed up your request topic.

This should do it.

Code: [Select]
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================

class Scene_Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Equip Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def equip_item       
    # Get main actor
    main_actor = $game_actors[1]
    # Get Equip
    equip = @item_window.item
    type = @item_window.item.is_a?(RPG::Weapon) ? 0 : @item_window.item.kind + 1   
    # Chage equipment
    main_actor.change_equip(type, equip)
    # Play Equip SE
    Sound.play_equip   
  end 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_command_selection
    removed_from_loot = false
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # Deactivate Command Window
      @command_window.active = false
      @command_window.index = -1
      @command_window.visible = false
      # Reactivat previous Window
      @active_window.active = true
    elsif Input.trigger?(Input::C)
      if @active_window == @item_window
        case @command_window.index
        when 0 # Use   
          # If Item is not a RPG Item
          if !@item_window.item.is_a?(RPG::Item)
            # Equip Item
            equip_item           
            # Set Command Window To false
            @command_window.active = false         
            @item_window.active = true
            @item_window.refresh           
            return
          end                   
          moal_rfkl9_invntr_limit_upditmselect_1hr4
          @command_window.active = false if $game_party.item_can_use?(@item) && @item.scope != 0                             
        when 1 # Discard
          # Get slot
          slot = @item_window.ma_grfkl_lim_nvtry_item_8rn
          unless slot.item.ma_discardable?
            Sound.play_buzzer
            return
          end
          type, id, n = slot.item_type, slot.item_id, slot.amount
          # Discard additional slots
          $game_party.limit_inventory.remove_item (type, id, n)
          $game_temp.slots_to_discard.add_item (type, id, n)
          # Deactivate Command Window
          @command_window.active = false
          @command_window.index = -1
          @command_window.visible = false
          # Reactivate previous Window
          if @loot_window.visible
            @item_window.refresh ($game_party.limit_inventory, 1)
            @loot_window.refresh ($game_temp.slots_to_discard, 1)
          else
            show_loot
          end
          @item_window.active = true
          RPG::SE.new (Sound::MA_DISCARD_SE).play
        end
        @emptycount_window.refresh ($game_party.limit_inventory)
      else # Called from Loot Window
        slot = @loot_window.ma_grfkl_lim_nvtry_item_8rn
        # Get slot stats
        type, id, n = slot.item_type, slot.item_id, slot.amount
        case @command_window.index
        when 0 # Take
          # If inventory has empty spaces
          if $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn)
            # Remove from loot and add to Inventory
            n2 = $game_party.limit_inventory.add_item (type, id, n)
            $game_temp.slots_to_discard.remove_item (type, id, n - n2)
            RPG::SE.new (Sound::MA_TAKE_SE).play
            removed_from_loot = true
          else
            Sound.play_buzzer
          end
        when 1 # Exchange
          # Deactivate Command Window
          @command_window.visible = false
          @command_window.active = false
          # Activate Item Window
          @item_window.active = true
          @item_window.index = 0
          @active_window = @item_window
          Sound.play_decision
        when 2 # Destroy
          $game_party.drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (slot.item, -1*n)
          $game_temp.slots_to_discard.remove_item (type, id, n)
          RPG::SE.new (Sound::MA_DESTROY_SE).play
          removed_from_loot = true
        end
        if removed_from_loot
          @command_window.active = false
          @command_window.visible = false
          check_to_hide_loot
        end
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Command Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def start_command_window
    # Set command window based on which window it is called from
    if @item_window.active
      item = @item_window.item     
      use_command = item.is_a?(RPG::Item) ? Vocab::MA_COMMAND_USE : "Equip"
      @command_window.reset_commands ([use_command, Vocab::MA_COMMAND_DISCARD])
      @command_window.draw_item (0, false) unless $game_party.item_can_use? (item) or !item.is_a?(RPG::Item)
      @command_window.draw_item (1, false) unless item.ma_discardable?
    elsif @loot_window.active
      cmnds = [Vocab::MA_COMMAND_TAKE, Vocab::MA_COMMAND_EXCHANGE, Vocab::MA_COMMAND_DESTROY]
      @command_window.reset_commands (cmnds)
      @command_window.draw_item (0, $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn))
    end
    rect = @active_window.item_rect (@active_window.index)
    x = @active_window.x + 16 + rect.x
    if x < (Graphics.width / 2)
      x += rect.width
    else
      x -= @command_window.width
    end
    @command_window.x = x
    # Get y coordinate
    y = @active_window.y + 16 + rect.y - ((@command_window.height - rect.height) / 2)
    y = (y + @command_window.height) > Graphics.height ? (Graphics.height - @command_window.height) : y
    @command_window.y = y < @active_window.y ? @active_window.y : y
    @command_window.index = 0
    @command_window.visible = true
    @command_window.active = true
    # Deactivate last window
    @active_window.active = false
    @activated_frame = true
  end
end

Place it below modern algebra script.

Let me know if it works for you and if you need anything changed.

Have a nice day.

***
Rep:
Level 89
I see you fixed up your request topic.
Yeah, didn't noticed topic template earlier, sorry.

Btw, thank you TDS, for taking this request!!! It works, I'm very grateful.  :lol:
The only problem is, that I can't change weapon multiple times until I'll close and open item window again. For example: equipped bow, and I want to change it for a sword - I can't do that in one session. I hope it's just a little oversight with one line of code (update) or sth? I don't want to abuse your good will. Can you please look at it again? And thank one more time!

Now I can continue my project, I'm so happy.
« Last Edit: August 27, 2010, 09:36:56 PM by Fizzly »
Regards,
Mike

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
I can change it just fine. Try testing the script on a new project with modern algebra's script and see if the problem continues.

Remember that it has to be directly below his script.

If that does not work please provide a small demo where the error appears.

***
Rep:
Level 89
Yes, checked this exactly that way.
And the problem is with when I try to equip nondiscardable item after normal one.
Please, take a look:
http://www.mediafire.com/?9jm7exz8ibubwcy

Regards,
Mike

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
This one should do it.

Code: [Select]
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================

class Scene_Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Equip Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def equip_item       
    # Get main actor
    main_actor = $game_actors[1]
    # Get Equip
    equip = @item_window.item   
    type = @item_window.item.is_a?(RPG::Weapon) ? 0 : @item_window.item.kind + 1   
    # Chage equipment
    main_actor.change_equip(type, equip)
    # Play Equip SE
    Sound.play_equip   
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_command_selection
    removed_from_loot = false
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # Deactivate Command Window
      @command_window.active = false
      @command_window.index = -1
      @command_window.visible = false
      # Reactivat previous Window
      @active_window.active = true
    elsif Input.trigger?(Input::C)
      if @active_window == @item_window
        case @command_window.index
        when 0 # Use                       
          # If Item is not a RPG Item
          if !@item_window.item.is_a?(RPG::Item) and @item_window.item != nil
            # Equip Item
            equip_item           
            # Set Command Window To false
            @command_window.active = false         
            @item_window.active = true
            @item_window.refresh           
            return
          end                   
          moal_rfkl9_invntr_limit_upditmselect_1hr4
          @command_window.active = false if $game_party.item_can_use?(@item) && @item.scope != 0                             
        when 1 # Discard
          # Get slot
          slot = @item_window.ma_grfkl_lim_nvtry_item_8rn
          unless slot.item.ma_discardable?
            Sound.play_buzzer
            return
          end
          type, id, n = slot.item_type, slot.item_id, slot.amount
          # Discard additional slots
          $game_party.limit_inventory.remove_item (type, id, n)
          $game_temp.slots_to_discard.add_item (type, id, n)
          # Deactivate Command Window
          @command_window.active = false
          @command_window.index = -1
          @command_window.visible = false
          # Reactivate previous Window
          if @loot_window.visible
            @item_window.refresh ($game_party.limit_inventory, 1)
            @loot_window.refresh ($game_temp.slots_to_discard, 1)
          else
            show_loot
          end
          @item_window.active = true
          RPG::SE.new (Sound::MA_DISCARD_SE).play
        end
        @emptycount_window.refresh ($game_party.limit_inventory)
      else # Called from Loot Window
        slot = @loot_window.ma_grfkl_lim_nvtry_item_8rn
        # Get slot stats
        type, id, n = slot.item_type, slot.item_id, slot.amount
        case @command_window.index
        when 0 # Take
          # If inventory has empty spaces
          if $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn)
            # Remove from loot and add to Inventory
            n2 = $game_party.limit_inventory.add_item (type, id, n)
            $game_temp.slots_to_discard.remove_item (type, id, n - n2)
            RPG::SE.new (Sound::MA_TAKE_SE).play
            removed_from_loot = true
          else
            Sound.play_buzzer
          end
        when 1 # Exchange
          # Deactivate Command Window
          @command_window.visible = false
          @command_window.active = false
          # Activate Item Window
          @item_window.active = true
          @item_window.index = 0
          @active_window = @item_window
          Sound.play_decision
        when 2 # Destroy
          $game_party.drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (slot.item, -1*n)
          $game_temp.slots_to_discard.remove_item (type, id, n)
          RPG::SE.new (Sound::MA_DESTROY_SE).play
          removed_from_loot = true
        end
        if removed_from_loot
          @command_window.active = false
          @command_window.visible = false
          check_to_hide_loot
        end
      end
    end
  end 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Item Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias moal_rfkl9_invntr_limit_upditmselect_1hr4 update_item_selection
  def update_item_selection
    @command_window.visible = false if @command_window.visible
    # Switch between windows by pressing Left or Right
    if @loot_window.visible && (Input.trigger? (Input::LEFT) || Input.trigger? (Input::RIGHT))
      Sound.play_cursor
      @active_window.index = -1
      loot_window_active = @loot_window.active
      @active_window.active = false
      @active_window = loot_window_active ? @item_window : @loot_window
      @active_window.active = true
      @active_window.index = 0
      @activated_frame = true
    end
    # IF ESC pressed
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)     
      # If exchanging
      if @loot_window.index > -1 && @item_window.active
        slot = @active_window.ma_grfkl_lim_nvtry_item_8rn
        slot2 = @loot_window.ma_grfkl_lim_nvtry_item_8rn
        type, id, n = slot2.item_type, slot2.item_id, slot2.amount
        if slot != nil
          if !slot.item.ma_discardable? # Undiscardable Item
            Sound.play_buzzer
            return
          else
            type2, id2, n2 = slot.item_type, slot.item_id, slot.amount
            $game_temp.slots_to_discard.add_item (type2, id2, n2)
            $game_party.limit_inventory.remove_item (type2, id2, n2)
          end
        end
        $game_party.limit_inventory.add_item (type, id, n)
        $game_temp.slots_to_discard.remove_item (type, id, n)
        RPG::SE.new (Sound::MA_EXCHANGE_SE).play
        check_to_hide_loot
        @loot_window.active = false
        @loot_window.index = -1       
      else # If selecting
        item = @active_window.item

        # If Item is not an RPG Item
        if item != nil and !item.is_a?(RPG::Item) and @item_window.active and !@loot_window.visible
          Sound.play_decision
          @active_window = @item_window
          start_command_window         
          return
        end

        if item != nil && (@loot_window.active || item.ma_discardable? || $game_party.item_can_use? (item))
          Sound.play_decision
          @active_window = @loot_window.active ? @loot_window : @item_window
          start_command_window
        else
          Sound.play_buzzer
        end
      end
    end
  end   
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Command Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def start_command_window
    # Set command window based on which window it is called from
    if @item_window.active
      item = @item_window.item     
      use_command = item.is_a?(RPG::Item) ? Vocab::MA_COMMAND_USE : "Equip"
      @command_window.reset_commands ([use_command, Vocab::MA_COMMAND_DISCARD])
      @command_window.draw_item (0, false) unless $game_party.item_can_use? (item) or !item.is_a?(RPG::Item)
      @command_window.draw_item (1, false) unless item.ma_discardable?
    elsif @loot_window.active
      cmnds = [Vocab::MA_COMMAND_TAKE, Vocab::MA_COMMAND_EXCHANGE, Vocab::MA_COMMAND_DESTROY]
      @command_window.reset_commands (cmnds)
      @command_window.draw_item (0, $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn))
    end
    rect = @active_window.item_rect (@active_window.index)
    x = @active_window.x + 16 + rect.x
    if x < (Graphics.width / 2)
      x += rect.width
    else
      x -= @command_window.width
    end
    @command_window.x = x
    # Get y coordinate
    y = @active_window.y + 16 + rect.y - ((@command_window.height - rect.height) / 2)
    y = (y + @command_window.height) > Graphics.height ? (Graphics.height - @command_window.height) : y
    @command_window.y = y < @active_window.y ? @active_window.y : y
    @command_window.index = 0
    @command_window.visible = true
    @command_window.active = true
    # Deactivate last window
    @active_window.active = false
    @activated_frame = true
  end
end

It should allow you to equip now, but test it and let me know if it worked out for you.

***
Rep:
Level 89
It works like a charm! THANK YOU one more time.  :tpg:
« Last Edit: August 27, 2010, 11:48:02 PM by Fizzly »
Regards,
Mike

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
It works like a harm! THANK YOU one more time.  :tpg:

He he... Harm.

And you're welcome.

***
Rep:
Level 89
Omg, haha, sorry... Just checked what "harm" means, and it's definitely not what I mean! Of course "charm". Sorry, my english isn't very good.
Regards,
Mike