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)
InstructionsSimply configure the case-when and arrays and you're good to go
Script
ERSv1.00
#=============================================================================
# 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
#-------------------------------------------------------------------------------
# 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