Item user PHA

Discussion in 'RGSSx Script Support' started by Topdod, Jan 1, 2019.

  1. Topdod

    Topdod Villager Member

    Likes Received:
    Not sure if I'm missing something obvious here or not but when from the item menu NOT in battle, using an item uses whoever has the highest PHA stat or leader.

    I'm using Hime's Custom Use Conditions script which allows me to have requirements to use an item which in this case is a state but here is the problem as whoever is in front of the party will only ever use the item on the rest of the party and the item's condition isn't used for anybody but the first actor.
    If actor 1 uses the item on themselves it locks out the entire party from using this item but if the item is used on anybody but the first it can be used until there is no more of the item left.

    I guess like the target of the item would use the item on themselves instead of whoever had the highest PHA.
    This would let me give a buff, make the party member wait X amount of battles for it to wear off and then they can use the item again.

    Ah, sorry about posting in the wrong place.
    Hime script
    Last edited: Jan 1, 2019
  2. Kes

    Kes Global Moderators Global Mod

    Likes Received:
    First Language:
    Primarily Uses:

    I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

    Would you please edit your post to include a link to the web page where you got that script. That way if anyone needs to check something before making a suggestion, they won't have to go hunting.
  3. Another Fen

    Another Fen Veteran Veteran

    Likes Received:
    First Language:
    Hey there,

    Haven't tested it yet or anything (again), but you could try to use this as an additional script:
    # ============================================================================
    #  * Menu Item User Fix
    #    Version 1.0 (January 4th, 2019)
    #    by Another Fen <>
    # ----------------------------------------------------------------------------
    #  This script attempts to change the "user" for items used from the menu, so...
    #  ...items with self-scope should now be used by the target.
    #  ...items are used by a party member that can actually use the item
    #     (e.g. if item usablility is restricted through other scripts).
    #  ...reusing an item after immobilizing the party with it does not cause an
    #     error.
    # ----------------------------------------------------------------------------
    #  Place this script within the "▼ Materials" section of the script editor.
    #  The script overwrites  Scene_ItemBase#user  and should be placed above
    #  other scripts that alias this method.
    # ============================================================================
    class Scene_ItemBase
      # Scene_ItemBase#user  (Redefined)
      # Try to find a user that can actually use the item, and fix self-scope
      def user
        users = (item && item.for_user?) ? item_target_actors : $game_party.members
        return { |a| a.usable?(item) }.max_by { |a| a.pha } || users[0]

Share This Page