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 Requirement System v2.10

0 Members and 1 Guest are viewing this topic.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
Equipment Requirement System v2.10
Version: 2.10
Author: NAMKCOR
Date: October 26, 2007

Version History


  • 1.00 - Completed System
  • 2.00 - Major overhaul of code
  • 2.10 - further efficiency fixing (thanks for the help Blizz)

Planned Future Versions

  • open to suggestions for improvement

Description


sets prerequisites for armor and weapons, based on level and statistics
i.e. they are unequippable until the requirements are met
like in Diablo II

Features

  • set weapon prerequisites
  • easy to configure arrays and case-when to set prerequisites

Screenshots

N/A

Demo

dl at bottom of post (300kb)

Instructions

Simply configure the case-when and arrays and you're good to go

Script


ERSv1.00
Code: [Select]
#=============================================================================
#   Equipment Requirement System v2.10                                                 
#-----------------------------------------------------------------------------
#   Created By: NAMKCOR                                                                                                     
#   Created for the Websites: Chaos Project, RPG Maker Resource Kit
#                                        (www.chaosproject.co.nr; www.rmrk.net)                     
#   If this script is hosted on any other website, then it is stolen,
#   please contact me at the address given below       
#   Requested by: SirMagus (RMRK)
#-----------------------------------------------------------------------------
#   If you find any Bugs/Incompatability issues with this script, please contact
#   me at the following e-mail address: Rockman922@aol.com, and
#   please be descriptive with your e-mail subject, as I delete spam on sight.                                                                                                             
#-----------------------------------------------------------------------------
#   Function:                                                                                                                             
#    sets prerequisites for armor and weapons, based on level and statistics
#    i.e. they are unequippable until the requirements are met
#    like in Diablo II
#                                                                         
#    Compatability:
#     most likely compatible with SDK (untested)
#     no known issues at the moment       
#
#     Instructions to modify:                                                                                                                     
#      Comments and instructions for the individual customizations will be given           
#      right where they are located.  Only real skills needed are reading, typing,             
#      and copy&paste
#
#     Instructions for use:
#       simply fill in the case sets instructed and the script will do the rest
#       
#-----------------------------------------------------------------------------
#     Version History:
#     1.0 - completed system
#     2.0 - Major overhaul of the code, easier to configure, more efficient
#     2.1 - more efficient code (thanks for the help blizz Blizz)
#=============================================================================

module NAMKCOR

  #===========================================================================
  # to configure weapons' requirements you simply need to add a "when"
  # to the case of either weapons or armors, and then fill in the array
  # of requirements in the proper order
  #---------------------------------------------------------------------------
  # template:
  #   when (id)
  #     return [(level), (strength), (dexterity), (agility), (intelligence)]
  #   end
  #===========================================================================
 
  def self.ers_config(item)
    # weapon configuration
    if item.is_a?(RPG::Weapon)
      case item.id
      when 2
        return [2,0,0,0,0]
      when 3
        return [5,90,0,0,0]
      end
    end
   
    # armor configuration
    if item.is_a?(RPG::Armor)
      case item.id
      when 2
        return [2,0,0,0,0]
      when 4
        return [3,0,0,0,0]
      when 5
        return [3,0,0,0,0]
      end
    end
    return [1,0,0,0,0]
  end

end
 
  #==========================================================================
  # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
  #==========================================================================

  class Scene_Equip

  alias update_item_ers_later update_item
  def update_item
    itemstats = NAMKCOR.ers_config(@item_window.item)
    if Input.trigger?(Input::C) &&
      !(@actor.level >= itemstats[0] and
      @actor.str >= itemstats[1] and
      @actor.dex >= itemstats[2] and
      @actor.agi >= itemstats[3] and
      @actor.int >= itemstats[4])
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    update_item_ers_later
  end
end

Optional Scene_Equip
Code: [Select]
#-------------------------------------------------------------------------------
# Scene_Equip: Has : Equip Left/Item, Scene_Equip
#-------------------------------------------------------------------------------
class Window_EquipLeft < Window_Base
  def initialize(actor)
    super(0, 152, 272, 328)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    @actor = actor
    refresh
  end
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 160, 0)
    draw_actor_hp(@actor, 4, 49)
    draw_actor_sp(@actor, 4, 74)
    draw_actor_graphic(@actor, 185, 110)
    draw_actor_parameter(@actor, 4, 128, 0)
    draw_actor_parameter(@actor, 4, 148, 1)
    draw_actor_parameter(@actor, 4, 168, 2)
    draw_actor_parameter(@actor, 4, 188, 3)
    draw_actor_parameter(@actor, 4, 208, 4)
    draw_actor_parameter(@actor, 4, 228, 5)
    draw_actor_parameter(@actor, 4, 248, 6)
    if @new_atk != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 128, 40, 32, " ---", 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(200, 128, 36, 32, @new_atk.to_s, 2)
    end
    if @new_pdef != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 148, 40, 32, " ---", 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(200, 148, 36, 32, @new_pdef.to_s, 2)
    end
    if @new_mdef != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 168, 40, 32, " ---", 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(200, 168, 36, 32, @new_mdef.to_s, 2)
    end
    if @new_str != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 188, 40, 32, " ---", 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(200, 188, 36, 32, @new_str.to_s, 2)
    end
    if @new_dex != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 208, 40, 32, " ---", 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(200, 208, 36, 32, @new_dex.to_s, 2)
    end
    if @new_agi != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 228, 40, 32, " ---", 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(200, 228, 36, 32, @new_agi.to_s, 2)
    end
    if @new_int != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 248, 40, 32, " ---", 1)
      self.contents.font.color = normal_color
      self.contents.draw_text(200, 248, 36, 32, @new_int.to_s, 2)
    end
  end
  def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
    new_agi, new_int)
    if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or
      @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or
      @new_int != new_int
      @new_atk = new_atk
      @new_pdef = new_pdef
      @new_mdef = new_mdef
      @new_str = new_str
      @new_dex = new_dex
      @new_agi = new_agi
      @new_int = new_int
      refresh
    end
  end
end

class Window_EquipItem < Window_Selectable
  def initialize(actor, equip_type)
    super(272, 256, 368, 224)
    @actor = actor
    @equip_type = equip_type
    @column_max = 1
    refresh
    self.active = false
    self.index = -1
  end
  def draw_item(index)
    item = @data[index]
    x = 4
    y = index * 32
    case item
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end

class Window_DisplayRequirements < Window_Base
  def initialize
    super(0, 64, 272, 88)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 212, 32, "Lvl", 0)
    self.contents.draw_text(48, 0, 212, 32, "Str", 0)
    self.contents.draw_text(95, 0, 212, 32, "Dex", 0)
    self.contents.draw_text(150, 0, 212, 32, "Agi", 0)
    self.contents.draw_text(200, 0, 212, 32, "Int", 0)
    self.contents.font.color = system_color = normal_color
  end
  def refresh(bleh)
    x = 50
    for i in 0...5
      self.contents.draw_text(x * i, 32, 212, 32, bleh[i].to_s, 32)
    end
  end
  def clear
    self.contents.clear
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 212, 32, "Lvl", 0)
    self.contents.draw_text(48, 0, 212, 32, "Str", 0)
    self.contents.draw_text(95, 0, 212, 32, "Dex", 0)
    self.contents.draw_text(150, 0, 212, 32, "Agi", 0)
    self.contents.draw_text(200, 0, 212, 32, "Int", 0)
    self.contents.font.color = system_color = normal_color
  end
end

class Scene_Equip
  alias older_main main
  def main
    @wrequirements = Window_DisplayRequirements.new
    older_main
    @wrequirements.dispose
  end
  def refresh
    @wrequirements.clear
    @item_window1.visible = (@right_window.index == 0)
    @item_window2.visible = (@right_window.index == 1)
    @item_window3.visible = (@right_window.index == 2)
    @item_window4.visible = (@right_window.index == 3)
    @item_window5.visible = (@right_window.index == 4)
    item1 = @right_window.item
    case @right_window.index
    when 0
      @item_window = @item_window1
    when 1
      @item_window = @item_window2
    when 2
      @item_window = @item_window3
    when 3
      @item_window = @item_window4
    when 4
      @item_window = @item_window5
    end
    if @right_window.active
      @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
    end
    if @item_window.active
      item2 = @item_window.item
      last_hp = @actor.hp
      last_sp = @actor.sp
      @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
      new_atk = @actor.atk
      new_pdef = @actor.pdef
      new_mdef = @actor.mdef
      new_str = @actor.str
      new_dex = @actor.dex
      new_agi = @actor.agi
      new_int = @actor.int
      @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
      @actor.hp = last_hp
      @actor.sp = last_sp
      @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
                                      new_dex, new_agi, new_int)
    end
  end
  alias update_item_old update_item
  def update_item
    item2 = @item_window.item
    @wrequirements.refresh(NAMKCOR.ers_config(@item_window.item))                                   
    update_item_old
  end
end

Credit


  • NAMKCOR
  • Requested By: SirMagus

Thanks

  • Blizzard for creating Diablo II
  • SirMagus for requesting the script
  • Blizzard(scripter) for help making it more efficient

Support


If you find any Bugs/Incompatability issues with this script, please contact me at   
the following e-mail address: Rockman922@aol.com, and please be descriptive   
with your e-mail subject, as I delete spam on sight.

Known Compatibility Issues

No known compatibility issues

Demo


N/A at the moment

Author's Notes

This script might be used in one of My future projects....::hint hint, wink wink::

Restrictions

Created for the Websites: Chaos Project, RPG Maker Resource Kit
(www.chaosproject.co.nr; www.rmrk.net)                     
If this script is hosted on any other website, then it is stolen, please contact me at either of the locations given

If you use this script in your game, please link me to the topic
I love to see what my work is used for

do NOT use this script in a commercial game unless you get my permission first
« Last Edit: October 27, 2007, 01:17:29 AM by NAMKCOR »

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

***
Rep:
Level 87
Things we fear the most have already happened 2 us
OMG,,NAMKCOR!!! U r da man
"If u'r about to die,,then think of how good ur life has treated u up to this point.  On the
other hand,,if life hasn't treated u good up to this point,,then take joy in the fact that
it's not going to bother u for much longer."

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
* NAMKCOR bows

thanks, I try

--side note, unlike Diablo II, you can't fool this system with items that increase your stats (I tried making that an option, it didn't work) I might go back sometime to make that possible, but I don't think I will at this point

edit: ty for the move
« Last Edit: October 12, 2007, 11:02:07 PM by NAMKCOR »

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Looks good NAM. nice work!

***
Rep:
Level 87
I am Mortar, you lose.
Sweet! I needed this.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
ATTENTION
ANYONE WHO IS USING VERSION 1.00

I made the configuration sooo much easier to implement and organize
please upgrade to 2.10 k?
(you'll need to also re-add the optional Scene_Equip if you do)
« Last Edit: October 26, 2007, 04:27:26 PM by NAMKCOR »

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Good stuff NAM. It's looking nice.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
hehe, I don't think it could be more optimized
it's 41 lines with 5 pre-configs and no comments XD

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
One thing though: In the comments of the script you say requested by gameo, and then in the topic by SirMagus. Are they the same person? And yeah, the script is about as optimized as I could imagine. I'm a little cautious of the module, but I have no real reason to be other then preference. It's a very nice script. I think it might actually be better then using a data class in this case anyway.

********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
d'oh, forgot to change the comments
I copy paste comments so I can just fill in stuff XD

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon