l0rdph0enix
Member
Hey Me again, I have two scripts that I need help with. What I want them to do is when the open the turn a switch off, and when they close they turn the switch back on.
The first one is the CIS by Samo, the Thief
The first one is the CIS by Samo, the Thief
Code:
#============================================================================
#============================================================================
#============================================================================
# CIS (Custom Item System) V1.0
# by Samo, the thief
#
#INSTRUCTIONS:
#- Place this script above Main.
#- Go to Scene_Menu (or your CMS (CUSTOM MENU SYSTEM)) and find any line that
#says this:
#$scene = Scene_Item.new
#and replace them with
##----------CIS--------------
#$scene = Scene_Samo_Item.new
#-#---------CIS---------------
#FEATURES:
#<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Colors Added.
#- Animations of Windows added.
#- More Nice and Organized Inventory
##- Better targeting characters
#- Information of Items when selecting one
#- Map Background added
# - You can make Unique items, so they draw in brown (like in D2)
# - Giving a better look at a boring window.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
# CUSTOMIZING:
# -----------
# - Go and find the lines with
# $UNIQUE_ITEMS = [X, X, X ,X]
# $UNIQUE_WEAPONS = [X, X]
# $UNIQUE_ARMORS = [X, X, X, X, X, X, X]
# and put there all the numbers you want. Have in mind that these are the ids
# of Items, Weapons, and armors that will have the mod [UNIQUE].
# Please, give me the credit if you use it. Enjoy it!
# Samo, the thief.
# ============================================================================
# ============================================================================
# ============================================================================
class Scene_Samo_Item
def initialize
$UNIQUE_ITEMS = []
$UNIQUE_WEAPONS = [1]
$UNIQUE_ARMORS = [1, 6, 13]
end
# ------------------------------------
def main
@help_window = Window_Help.new
@help_window.y = 480
@help_window.opacity = 215
@item_window = Window_Samo_Item.new
@item_window.x = -320
@item_window.y = 64
@item_window.opacity = 200
@item_window.help_window = @help_window
@target_window = Window_Samo_Target.new
@target_window.x = 640
@target_window.y = 0
@target_window.opacity = 175
@inventory_window = Window_Inventory.new
@inventory_window.y = -64
@inventory_window.opacity = 215
@item = @item_window.item
@spriteset = Spriteset_Map.new
@window_information = Window_Information_CIS.new(@item)
@window_information.opacity = 200
@window_information.x = 640
@window_information.visible = true
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@spriteset.dispose
@item_window.dispose
@target_window.dispose
@window_information.dispose
@inventory_window.dispose
end
# ------------------------------------
def update
if @help_window.y != 416
@help_window.y -= 4
end
if @inventory_window.y != 0
@inventory_window.y += 4
end
if @item_window.x != 0
@item_window.x += 20
end
if @window_information.x != 320
@window_information.x -= 20
end
if @target_window.x != 320
@target_window.x -= 20
end
@help_window.update
@item_window.update
@target_window.update
@window_information.update
if @item_window.active
update_item
return
end
if @target_window.active
update_target
return
end
end
# ------------------------------------
def update_item
@item = @item_window.item
if Input.repeat?(Input::DOWN)
@window_information.refresh (@item)
end
if Input.repeat?(Input::UP)
@window_information.refresh (@item)
end
if Input.repeat?(Input::L)
@window_information.refresh (@item)
end
if Input.repeat?(Input::R)
@window_information.refresh (@item)
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@item_window.active = false
@target_window.visible = true
@target_window.active = true
@target_window.x = 640
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
$scene = Scene_Map.new
return
end
end
return
end
end
# ------------------------------------
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
unless $game_party.item_can_use?(@item.id)
@item_window.refresh
end
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
if $game_party.item_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
if used
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
@target_window.refresh
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# â– Window_Item
#------------------------------------------------------------------------------
class Window_Samo_Item < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 300)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
case item
when RPG::Item
number = $game_party.item_number(item.id)
color = Color.new(60,175,0,255)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
color = Color.new(0,175,255,255)
when RPG::Armor
number = $game_party.armor_number(item.id)
color =Color.new(0,95,107,255)
end
case item
when RPG::Item
if $UNIQUE_ITEMS.include?(item.id)
color = Color.new(164,143,121,255)
end
when RPG::Weapon
if $UNIQUE_WEAPONS.include?(item.id)
color = Color.new(164,143,121,255)
end
when RPG::Armor
if $UNIQUE_ARMORS.include?(item.id)
color = Color.new(164,143,121,255)
end
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = color
@opacity = 255
else
self.contents.font.color = color
@opacity = 128
end
x = 4 + index % 2
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x + 28, y, 212, 32, item.name, @opacity)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# Â