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.
Equipment Constraints

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Equipment Constraints
Version: 2.5b
Author: modern algebra & Tsunokiette
Date: September 26, 2008

Version History


  • <Version 2.5b> - September 26, 2008 - Fixed a bug with clicking an empty skill or item
  • <Version 2.5> - July 22, 2008 - Can now specify whether actor stats should be strictly greater than, strictly less than, equal to, or less than or equal to. Further, you can now set a state requirement. Also, you can specify the number of items for possession requirements and you can have the use of an item or skill consume reagants. It now shows the items you can't use as disabled in the items menu, rather than not show them at all
  • <Version 2.0> - June 27, 2008 - Added six parameters for Equip requirements from Tsunokiette's Equipment Requisites script, namely - item, weapon, armor and skill prerequisites are now possible
  • <Version 1.0> - June 26, 2008 - Original Release

Description


This script allows the user to set prerequisites for equipping weapons and armors.

Features

  • Allows you to set requirements for any piece of equipment, item, or skill
  • Can set a requirement on level, maxhp, maxmp, atk, def, spi, agi, weapons equipped, armors equipped, items in possession, weapons in possession, armors in possession, state, and/or skills learned.
  • Can easily set whether the actor's stats should be greater than, less than, equal to, less than or equal to, or greater than or equal to the specified number
  • Can consume reagants upon item or skill use
  • Intuitive and easy to configure

Instructions

See the header of the script

Script


Code: [Select]
#==============================================================================
# ** Item/Equipment/Skill Conditions
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This script allows you to set stats and/or level requirements for weapons
#  and armor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    Place above Main and below Materials
#
#    To configure this script, you have to place codes in the Notes Field of
#   the respective items. These codes are:
#    
#     \LVLR[<level_requirement>]           *Actor must be at least this level
#     \HPR[<hp_requirement>]               *Actor must have this much HP
#     \MPR[<mp_requirement>]               *Actor must have this much MP
#     \ATKR[<attack_requirement>]          *Actor must have this much Attack
#     \DEFR[<defense_requirement>]         *Actor must have this much Defense
#     \SPIR[<spirit_requirement>]          *Actor must have this much Spirit
#     \AGIR[<agility_requirement>]         *Actor must have this much Agility
#     \WPNR[<weapon_id>]                   *Weapon must be equipped
#     \ARMR[<armor_id>]                    *Armor must be equipped
#     \ITMR[<item_id>, <n>]                *At least n of item_id in possession
#     \ITMR[<item_id>, <n>]C               *As above and consumed upon use.
#     \PWPNR[<possession_weapon_id>, <n>]  *At least n of weapon_id in possession
#     \PWPNR[<possession_weapon_id>, <n>]C *As above and consumed upon use.
#     \PARMR[<possession_armor_id>, <n>]   *At least n of armor_id in possession
#     \PARMR[<possession_armor_id>, <n>]C  *As above and consumed upon use.
#     \SKLR[<skill_id>]                    *Skill must be learned
#     \STER[<state_id>]                    *State must be added
#
#    After any of them that make sense, you can also add these restrictions:
#      >= - greater than or equal to - default
#      <= - less than or equal to
#      >  - strictly greater than
#      <  - strictly less than
#      =  - strictly equal to
#
#    You can leave out any or all or none of them and the script will only
#   restrict the attributes you set
#
#   EXAMPLE:
#     If Club has a Notes Field like this:
#
#       \LVLR[6]<
#       \ATKR[37]
#       \AGIR[27]>
#
#      then an actor could only use that club if he was less than level 6, had
#     an Attack of at least 37 and an Agility of at least 28.
#==============================================================================
# ** RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes
#    new method - requirements_field
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Requirement Field
  #--------------------------------------------------------------------------
  #  This method returns an array of restrictions on using each item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def requirement_field
    r_field = []
    # Dissect Note
    text = self.note.dup
    text.sub! (/\\lvlr\[(\d+?)\](<*>*=*)/i) { '' }
    r_field.push ([$1.to_i, $2.to_s])
    # HP Requirement
    text.sub! (/\\hpr\[(\d+?)\](<*>*=*)/i) { '' }
    r_field.push ([$1.to_i, $2.to_s])
    # MP Requirement
    text.sub! (/\\mpr\[(\d+?)\](<*>*=*)/i) { '' }
    r_field.push ([$1.to_i, $2.to_s])
    # Attack Requirement
    text.sub! (/\\atkr\[(\d+?)\](<*>*=*)/i) { '' }
    r_field.push ([$1.to_i, $2.to_s])
    # Defense Requirement
    text.sub! (/\\defr\[(\d+?)\](<*>*=*)/i) { '' }
    r_field.push ([$1.to_i, $2.to_s])
    # Spirit Requirement
    text.sub! (/\\spir\[(\d+?)\](<*>*=*)/i) { '' }
    r_field.push ([$1.to_i, $2.to_s])
    # Agility Requirement
    text.sub! (/\\agir\[(\d+?)\](<*>*=*)/i) { '' }
    r_field.push ([$1.to_i, $2.to_s])
    r_field.push ([], [], [], [], [], [], [], [], [], [])
    # Weapon Requirement
    r_field[7].push ($1.to_i) while text.sub! (/\\wpnr\[(\d+?)\]/i) {''} != nil
    # Armor Requirement
    r_field[8].push ($1.to_i) while text.sub! (/\\armr\[(\d+?)\]/i) {''} != nil
    # Item Possession Requirement
    while text.sub! (/\\itmr\[(\d+),*\s*(\d*)\](C*)(<*>*=*)/i) { '' } != nil
      r_field[9].push ([$1.to_i, [$2.to_i, 1].max, $4.to_s])
      # Consumable items
      r_field[14].push ([$1.to_i, [$2.to_i, 1].max, $4.to_s]) if $3 != ""
    end
    # Weapon Possession Requirement
    while text.sub! (/pwpnr\[(\d+),*\s*(\d*)\](C*)(<*>*=*)/i) {''} != nil
      r_field[10].push ([$1.to_i, [$2.to_i, 1].max, $4.to_s])
      # Consumable weapons
      r_field[15].push ([$1.to_i, [$2.to_i, 1].max, $4.to_s]) if $3 != nil
    end
    # Armor Possession Requirement
    while text.sub! (/parmr\[(\d+),*\s*(\d*)\](C*)(<*>*=*)/i) {''} != nil
      r_field[11].push ([$1.to_i, [$2.to_i, 1].max, $4.to_s])
      # Consumable Armors\
      r_field[16].push ([$1.to_i, [$2.to_i, 1].max, $4.to_s]) if $3 != nil
    end
    # Skill Requirement
    r_field[12].push ($1.to_i) while text.sub! (/\\sklr\[(\d+?)\]/i) {''} != nil
    # State Requirement
    r_field[13].push ($1.to_i) while text.sub! (/\\ster\[(\d+?)\]/i) {''} != nil
    return r_field
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check requirements
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def check_reqs (user)
    actor_stats = [user.level, user.maxhp, user.maxmp, user.atk, user.def, user.spi, user.agi]
    reqs = self.requirement_field
    # Stats
    for i in 0...7
      case reqs[i][1]
      when "" # Assume Greater than or Equal to
        return false unless actor_stats[i] >= reqs[i][0]
      else # Other
        begin
          eval ("return false unless actor_stats[i] #{reqs[i][1]} reqs[i][0]")
        rescue
        end
      end
    end
    data = [$data_items, $data_weapons, $data_armors]
    # Weapons and Armor equips
    for i in 7...9
      reqs[i].each { |j|
        return false unless user.equips.include? (data[i-6][j])
      }
    end
    # Items, Weapons, Armors in possession
    for i in 9...12
      reqs[i].each { |j|
        case j[2]
        when ""
          return false unless $game_party.item_number (data[i-9][j[0]]) >= j[1]
        else
          begin
            eval ("return false unless $game_party.item_number (data[i-9][j[0]]) #{j[2]} j[1]")
          rescue
          end
        end
      }
    end
    # Skills learned
    self.requirement_field[12].each { |i| return false unless user.skill_learn? ($data_skills[i]) }
    # States
    self.requirement_field[13].each { |i| return false unless user.state? (i) }
    return true
  end
end
  
#==============================================================================
# ** Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new method - check_reqs, consume_reagants
#    aliased_methods - equippable?, setup, level_down, maxhp=, maxmp=, atk=,
#                      def=, spi=, agi=
#    modified super - skill_effect, item_effect, skill_can_use?, item_effective?
#==============================================================================

class Game_Actor < Game_Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup
  #     actor_id : actor ID
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_equip_required_actor_stp_7ht1 setup
  def setup (actor_id)
    # Run Original Method
    modalg_equip_required_actor_stp_7ht1 (actor_id)
    # Make sure all starting items are allowed to be on the hero
    check_equip_reqs
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Determine if Equippable
  #     item : item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_eqp_reqs_actor_check_equip_5js9 equippable?
  def equippable?(item)
    return false if item == nil
    return modalg_eqp_reqs_actor_check_equip_5js9 (item) & item.check_reqs (self)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Determine Usable Skills
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def skill_can_use? (skill)
    test = super (skill)
    return skill.check_reqs (self) if test
    return test
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Determine if an Item can be Used
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item_effective?(user, item)
    return super (user, item) if user.is_a? (Game_Enemy)
    return super (user, item) & item.check_reqs (user)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Apply Item Effects
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item_effect(user, item)
    super (user, item)
    # Consume reagants if consumable
    consume_reagants (item)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Apply Skill Effects
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def skill_effect(user, skill)
    super (user, skill)
    # Consume reagants if consumable
    consume_reagants (skill)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check Equipment Requirements
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def check_equip_reqs
    @checking_equipment = true
    equip_array = equips.dup
    for i in 0...5
      # Unequip everything
      change_equip (i, nil, true)
      test = equippable? (equip_array[i])
      change_equip (i, equip_array[i], true)
      # Unequip item for real if requirements not met
      change_equip (i, nil) unless test
    end
    @checking_equipment = false
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Consume Reagants
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def consume_reagants (item)
    unless @skipped || @missed || @evaded
      # Remove items, weapons, and armors
      item.requirement_field[14].each { |i| $game_party.lose_item ($data_items[i[0]], i[1]) }
      item.requirement_field[15].each { |i| $game_party.lose_item ($data_weapons[i[0]], i[1]) }
      item.requirement_field[16].each { |i| $game_party.lose_item ($data_armors[i[0]], i[1]) }
    end
  end
  #--------------------------------------------------------------------------
  # * Make sure requirements still met if stats decrease in any way
  #--------------------------------------------------------------------------
  alias modalg_eqpreqs_lvlup_check_9dn4 level_up
  def level_up
    modalg_eqpreqs_lvlup_check_9dn4
    check_equip_reqs
  end
  
  alias modalg_equip_reqs_changelvl_check_5hy2 level_down
  def level_down
    modalg_equip_reqs_changelvl_check_5hy2
    check_equip_reqs
  end
  
  alias modalg_equip_reqs_changemaxhp_check_h83d maxhp=
  def maxhp=(new_maxhp)
    modalg_equip_reqs_changemaxhp_check_h83d (new_maxhp)
    check_equip_reqs
  end
  
  alias modalg_equip_reqs_changemxmp_check_8fjq maxmp=
  def maxmp=(new_maxmp)
    modalg_equip_reqs_changemxmp_check_8fjq (new_maxmp)
    check_equip_reqs
  end
  
  alias modalg_equip_reqs_change_atk_94nd atk=
  def atk=(new_atk)
    modalg_equip_reqs_change_atk_94nd (new_atk)
    check_equip_reqs
  end
  
  alias modernalg_chck_reqs_def_73ij def=
  def def=(new_def)
    modernalg_chck_reqs_def_73ij (new_def)
    check_equip_reqs
  end
  
  alias modalgebra_reqs_chck_sprit_8dsn spi=
  def spi=(new_spi)
    modalgebra_reqs_chck_sprit_8dsn (new_spi)
    check_equip_reqs
  end
  
  alias modalgebra_requirements_equipment_agi_6hdt agi=
  def agi=(new_agi)
    modalgebra_requirements_equipment_agi_6hdt (new_agi)
    check_equip_reqs
  end
  
  alias ma_chck_eqp_reqs_chnge_equip_7fn change_equip
  def change_equip (equip_type, item, test = false)
    ma_chck_eqp_reqs_chnge_equip_7fn (equip_type, item, test)
    check_equip_reqs if @checking_equipment == nil || !@checking_equipment && !test
  end
  
  alias ma_frgt_skill_check_eqp_reqs_8her forget_skill
  def forget_skill (skill_id)
    ma_frgt_skill_check_eqp_reqs_8her (skill_id)
    check_equip_reqs if @checking_equipment == nil || !@checking_equipment
  end
end

#==============================================================================
# ** Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - item_can_use?
#==============================================================================

class Game_Party
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item Can Use?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_req_itm_party_use_9m43 item_can_use?
  def item_can_use? (item)
    # Run Original Method
    test = modalg_req_itm_party_use_9m43 (item)
    return false unless test
    if $game_temp.in_battle
      return test & item.check_reqs ($scene.active_battler)
    else
      $game_party.members.each { |i| return test if item.check_reqs (i) }
      return false
    end
  end
end

#==============================================================================
# ** Scene_Battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    makes public - active_battler
#==============================================================================

class Scene_Battle < Scene_Base
  attr_reader :active_battler
end

#==============================================================================
# ** Scene_Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - use_item_nontarget
#==============================================================================

class Scene_Item < Scene_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Use Item (apply effects to non-ally targets)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_eqp_reqs_consume_regnts_refresh_rn4 use_item_nontarget
  def use_item_nontarget
    # Run Original Method
    modalg_eqp_reqs_consume_regnts_refresh_rn4
    # Refresh Item Window
    @item_window.refresh
  end
end

Credit


  • modern algebra
  • Tsunokiette

Support


Just post here at rmrk for support


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:46:11 PM by Modern Algebra »

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Updated with Tsunokiette's additional requirements for having other items equipped.

**
Rep: +0/-0Level 85
I love this script, but I'd like to make a request.  Would it be possible to add in a feature that you can add to the notes of an item to only allow it to certain actor Id's specified?  The problem is that in the database you can go to classes and restrict which classes can use which weapon and armor, but you can't restrict which items they can use, so this script would be AWESOME for fixing that.

Also, is it better for me to asks requests to already existing scripts in the topic like I did here, or to make a new request in the requests subforum?

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
If it's an addition to a script, like the one here, it is better to ask it here. If it was an entirely new script, then it would be better to make a topic in Script Requests.

Anyway, I will probably update this script soon.

**
Rep:
Level 85
Is there an "or" option for conditions?

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
No, but that is a good feature - I will likely add it when I find the time

**
Rep:
Level 88
When use the <A> button to select a skill or item that isn't there (no skills learned, for example), the following definition bugs out:

Code: [Select]
  def skill_can_use?(skill)
    return super (skill) & skill.check_reqs (self)
  end

Pretty awesome script, though; I'm using this script combined with your skill learning script to make it so that certain passive skills let characters equip different types of weapons/cast spells from various schools (so in the middle of the game a character could learn FAN TRAINING and be able to equip fans and use fan attack skills or whatever).

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Mmm, you're right. that is an oversight on my part.

Change it to:

Code: [Select]
def skill_can_use? (skill)
  test = super (skill)
  return skill.check_reqs if test
  return test
end

Just replace your script with the one in the first post, as there was a similar error with the Item menu as well
« Last Edit: September 26, 2008, 11:33:58 PM by modern algebra »

**
Rep: +0/-0Level 84
Still bugs out on line 199 saying wrong number of arguments (0 for 1). Line 199 is     return skill.check_reqs if test
Tried to set it to self but it didn't work properly. Wouldn't allow me to equip a piece of chain armor with the required skill learnt.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Hmm... Well I would say that it should be:

Code: [Select]
def skill_can_use? (skill)
  test = super (skill)
  return skill.check_reqs (self) if test
  return test
end

But you say that it messes up there?

Can you show me what you have? Is there another condition interfering?

**
Rep: +0/-0Level 84
What I am trying to do is setup with Sykvals Passive Skills script the ability for actors to equip certain "types" of items based on the "skill" known to the actor. So in order for a player to equip Chain based armor the actor needs to know the skill Chain Mail. So in the notes for the Item I put in /SKLR[98] which relates to the Chain Mail skill. In testing I give the player the skill, and then give the player the chain item. But when I go to the equip screen the chain item does not display as one the user is eligible to wear. Unless it requires that the class be able to equip the item first, which in thinking of it, would make sense. Hmmm I think I solved my own problem.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Yeah, it would require that the class be able to equip it.

If that doesn't solve the problem, then can you link me to Syvkal's script - I suspect there could be an incompatibility depending on how Syvkal stores passive skills.

**
Rep: +0/-0Level 84
Awesome. Yea it was just that I needed to select the item in class screen. Is there a way to get around that though?? So I can check if a certain skill is learnt and such and go from there?
« Last Edit: October 14, 2008, 05:41:07 PM by Selacius »

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
As in not have the class? I could script it in, but I don't really see it as necessary, and it would add in a number of complications.

**
Rep: +0/-0Level 84
More so that you don't need to select which armor a certain class can use from within the database.

pokeball joyOfflineFemale
*
Rep:
Level 85
I heard the voice of the salt in the desert
2012 Best RPG Maker User (Mapping)Project of the Month winner for June 20092010 Best RPG Maker User (Creativity)2011 Best RPG Maker User (Mapping)2011 Best RPG Maker User (Creativity)Winner - 2011 Winter Project of the Season2010 Best RPG Maker User (Mapping)2010 Best RPG Maker User (Graphical)2010 Best Artist2014 Best RPG Maker User - Graphics2014 Best RPG Maker User - Mapping2014 Best Artist2013 Best RPG Maker User (Graphical)2013 Best RPG Maker User (Mapping)2010 Most Unsung Member2010 Most Attractive Female Member
Hey man,

So, have several skills which I want to consume reagents to use. It does check to make sure the player has enough, however I can't seem to get it to actually consume them.

Example of the notes field code:  \ITMR[026, 1]C

What am I doing wrong?

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Hey man,

So, have several skills which I want to consume reagents to use. It does check to make sure the player has enough, however I can't seem to get it to actually consume them.

Example of the notes field code:  \ITMR[026, 1]C

What am I doing wrong?

hmm, well it might be something I did wrong. One thing though, you should not put the 0 there. 26 ought to work. The only thing I can think of is that if the skill is missed, evaded, or skipped then it won't consume the reagants. It's kind of silly to make that requirements thinking about it now. So if removing the 0 doesn't work, go down to the method consume_reagants and change:

Code: [Select]
unless @skipped || @missed || @evaded
      # Remove items, weapons, and armors
      item.requirement_field[14].each { |i| $game_party.lose_item ($data_items[i[0]], i[1]) }
      item.requirement_field[15].each { |i| $game_party.lose_item ($data_weapons[i[0]], i[1]) }
      item.requirement_field[16].each { |i| $game_party.lose_item ($data_armors[i[0]], i[1]) }
    end

to:

Code: [Select]
unless @skipped
      # Remove items, weapons, and armors
      item.requirement_field[14].each { |i| $game_party.lose_item ($data_items[i[0]], i[1]) }
      item.requirement_field[15].each { |i| $game_party.lose_item ($data_weapons[i[0]], i[1]) }
      item.requirement_field[16].each { |i| $game_party.lose_item ($data_armors[i[0]], i[1]) }
    end


And see if that works.

pokeball joyOfflineFemale
*
Rep:
Level 85
I heard the voice of the salt in the desert
2012 Best RPG Maker User (Mapping)Project of the Month winner for June 20092010 Best RPG Maker User (Creativity)2011 Best RPG Maker User (Mapping)2011 Best RPG Maker User (Creativity)Winner - 2011 Winter Project of the Season2010 Best RPG Maker User (Mapping)2010 Best RPG Maker User (Graphical)2010 Best Artist2014 Best RPG Maker User - Graphics2014 Best RPG Maker User - Mapping2014 Best Artist2013 Best RPG Maker User (Graphical)2013 Best RPG Maker User (Mapping)2010 Most Unsung Member2010 Most Attractive Female Member
Did both things you suggested, still isn't consuming the items. It's quite odd, once it did consume, then after dozens more tries with the same parameters it would never repeat it.

Edit:  Actually, it's not that big a deal, I can just attach a common event to the skill to remove the item consumed.
« Last Edit: May 22, 2009, 02:06:22 AM by joy »

**
Rep: +0/-0Level 82
There's there an extra code or something to add so that only a certain actor/class can use any item/skill/equipment?  Like.. only a black mage can learn Fire when reading the Fire Tomb?

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
No, though there ought to be. One solution could be to set the base skill for that class as the requirement. If the class or actor has a specific skill at the start of the game that no one else can get, you could set that as the requirement for other skills for that class.

Alternatively, you could try using the Record Target Variable script (also in the database) to set it up as a common event that is to be used.

**
Rep: +0/-0Level 82
Mmk, thanks!  I'll give that a try.  ^_^

**
Rep: +0/-0Level 83
how old is a too old topic anyway? question if not too old =) so, i see you can use equal, more than, less than, between, but what about random? if i wanted to say, needs a (random) rating of 10-15 strength, assuming there is a way to type in the argument for something random, will the program determine that just once at the start of the game? so when i play it, i need 13 strength, but when my brother plays it, his luck is better and only needs 10?

also! is it possible to type an argument like

\ATKR[37-LVLR]

or

\ATKR[37-DEFR]


*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
No, I don't think it's that sophisticated, sorry. Maybe if I ever rewrite it.

**
Rep: +0/-0Level 83
Intellligent post every blue moon.
I'm not sure if this has been answered, would an 'or' code work?
Like to equip 'weapon', you'd need to be level '#' OR have 'item' in your inventory.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Favourite Staff Member2011 Best Veteran2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
No, it won't. If I do rewrite this, I'll be sure to add it in.