Main Menu
  • Welcome to The RPG Maker Resource Kit.

[Request] Character Specific Menu Items Script

Started by Caladbolg Luminaris, August 16, 2010, 01:58:45 PM

0 Members and 1 Guest are viewing this topic.

Caladbolg Luminaris

Good day everyone. My name is Caladbolg Luminaris, I have just registered in the forum, and I did that for the sole purpose of requesting a certain script, also, thanks for the amazing scripts of the forum's members, I was able to make very cool things with my project.  ^-^

Anyhoo, onto the script, you see, I am looking for a script which lets a certain character use a certain item.
In the way that "only actor nº1 can use this item" or "only nº001 and nº003 can use this item".

I'm talking about using menu items, like ones that increase HP and MP.

I wanted to make stat increasing menu items specificly for certain characters(or classes).

But I'm afraid my skill with RGSS is below average. :-[

Is there anyway to make this?

Terra-chan

Battle Engine Melody can both restrict what actors can use an item and what actors/enemies that item can be used on.

however I can understand it's a bit bulky (it's an entire battle engine with this function integrated into the battle engine code) but Melody has a lot of nice features and it has flexibility in offering different combat views and styles, so even if you're using default and want to continue using default, it allows you to do that.


~My Projects~

~ VocaloidVX ~ Second Life Project ~
~ RPG Maker Collective ~
To support this forum, it's the first place that will gets posted some updates of mine, check it out ^_~

Caladbolg Luminaris

Thank You, but doesn't this apply only to battles?   ???

if so than I must keep looking... might as well try it. Thanks Again

Terra-chan

#3
Neither of those scripts apply only to battles. They apply to the Scene_Item in the menu.

^_^; thought this was a different thread


~My Projects~

~ VocaloidVX ~ Second Life Project ~
~ RPG Maker Collective ~
To support this forum, it's the first place that will gets posted some updates of mine, check it out ^_~

Caladbolg Luminaris

That's strange...It's not working, I also try the effect nullify which also takes effect outside of battle, and it still doesn't work.

The Item still takes effect on the Class/Character which I had the effect nullified...  ???

TDS

Well here you go with no need to add a bulky battle system.

You did not specify if you used a custom scene item script, so I made it for the default one.


#============================================================================
# ** RPG::Item Module
#----------------------------------------------------------------------------
# This module handles item information.
#============================================================================   

module RPG
    class Item < UsableItem
    #-------------------------------------------------------------------------
    # * Make Item Usability Array
    #-------------------------------------------------------------------------
    def usable_by?
      self.note[/CAN_USE: (.*)/]         
      # Return false if match is nil or collected array of ID's
      return $1 == nil ? false : $1.split.collect! {|id| id.to_i}
    end         
  end 
end

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================

class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # * Update Target Selection
  #--------------------------------------------------------------------------
  alias tds_item_restriction_scene_item_update_target_selection update_target_selection
  def update_target_selection
    # If input trigger C
    if Input.trigger?(Input::C)     
      # If item does not have any usability limitations
      if @item.usable_by? != false
        # If Item is not usable by the selected character                   
        if !@item.usable_by?.include?($game_party.members[@target_window.index].id)
          # Play Buzzer SE
          Sound.play_buzzer
          return
        end
      end   
    end
    tds_item_restriction_scene_item_update_target_selection   
  end
end


To use just add into the note tags of the items the following:


CAN_USE: # # # # # #


#  = Are the ID's of the actors

Example:


CAN_USE: 1 2


The above example would make it so the item can only be used by actor 1 or 2 by the database ID.

Let me know if it works for you and have a nice day.

Caladbolg Luminaris

Holy... this is awesome!!

Thanks a bunch, it's works perfectly, I really needed something like this.  ;D