+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Cursed Weapons and Armor (/thread-2751.html)
Cursed Weapons and Armor - RPG Advocate - 03-03-2008
Cursed Weapons and Armor
by RPG Advocate
saved from Phylomortis.Com
Introduction
This script allows you to create weapons and armor that can't be unequipped normally. The only way these items can be unequipped is through the "Change Equipped Items" event command. Once equipped, cursed weapons and armor will show up in purple (by default).
To add a cursed weapon, add the weapon's database ID to the "cursed_weapons" array in Game_System. To add a cursed armor, add the armor's database ID to the "cursed_armors" array in Game_System.
Note: If copied as directed, this script will mess up my two-handed weapon script. The two-handed weapon script can be used with this script, but you'll need to know how to merge them on your own.
Note by DerVVulfman: Be aware that the weapon optimization script was modified so it can still exclude cursed weapons and armors if using the revised version I edited before posting in this forum.
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :cursed_weapons # array of cursed weapons
attr_accessor :cursed_armors # array of cursed armors
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias cwaa_init initialize
def initialize
cwaa_init
@cursed_weapons = []
@cursed_armors = []
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Get Cursed Color
#--------------------------------------------------------------------------
def cursed_color
return Color.new(255, 107, 255)
end
end
#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item Name
# item : item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.font.color = normal_color
if item.is_a?(RPG::Weapon) && $game_system.cursed_weapons.include?(item.id)
self.contents.font.color = cursed_color
end
if item.is_a?(RPG::Armor) && $game_system.cursed_armors.include?(item.id)
self.contents.font.color = cursed_color
end
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(2)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
w = @actor.weapon_id
a1 = @actor.armor1_id
a2 = @actor.armor2_id
a3 = @actor.armor3_id
a4 = @actor.armor4_id
# If equipment is fixed
if @actor.equip_fix?(@right_window.index)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Check Cursed Status. Play buzzer and return if true
if @right_window.index == 0 && $game_system.cursed_weapons.include?(w)
$game_system.se_play($data_system.buzzer_se)
return
elsif @right_window.index == 1 && $game_system.cursed_armors.include?(a1)
$game_system.se_play($data_system.buzzer_se)
return
elsif @right_window.index == 2 && $game_system.cursed_armors.include?(a2)
$game_system.se_play($data_system.buzzer_se)
return
elsif @right_window.index == 3 && $game_system.cursed_armors.include?(a3)
$game_system.se_play($data_system.buzzer_se)
return
elsif @right_window.index == 4 && $game_system.cursed_armors.include?(a4)
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate item window
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
end