11-25-2016, 06:19 PM
(11-25-2016, 06:09 AM)DerVVulfman Wrote: Well, it's still a bit sloppy by my standard, but here's a patch for the revised version of Scene Item Laura V1.2 - Revised version.
Sloppy by my standard as I left his inner mechanics untouched. I should have broken the menus into smaller modules so other scripters could more easily write new code and patches.
Code:#==============================================================================
# Extra ITEM for MOG_Scene_Item Revised
# an edit of MOG_Scene_Item V1.3 by Moghunter
# http://www.atelier-rgss.com
#==============================================================================
# Patch by DerVVulfman
#
# NOTE: Requires the end user to rework their "Item_com" graphics to allow
# for a 4th category, the 'Special' item type. The format is:
# Item_com01.png ... To have 4 items, the 1st window "Item" highlighted
# Item_com02.png ... To have 4 items, the 2nd window "Weapon" highlighted
# Item_com03.png ... To have 4 items, the 3rd window "Armor" highlighted
# Item_com04.png ... To have 4 items, the 4th window "Special" highlighted
#
# Special Items are items not visible in the normal Item bag, but are loca-
# ted in the 4th category in the item window. ONLY within the 4th window
# will these items be found.
#
# To define special items, place the IDs of these items within the
# SpecialSelect array inside the MOG module.
#
# Setting the name of the new 4th slot graphic is also within the
# MOG module
#
#==============================================================================
module MOG
# BASIC MENU CONFIGURATION
# Item Menu Graphics Used
ITEM_TYPE_4 = "Item_com02" # Selection graphic (Secondary Item)
# ITEM Values
# The list of Items
SpecialSelect = [1,2,3] # List if items by Item ID
end
#==============================================================================
# ** Window_Type
#------------------------------------------------------------------------------
# A hidden window used to switch between the 4 item groups in the menu.
#==============================================================================
class Window_Type < Type_Sel
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 0, 0)
@item_max = 4
self.index = 0
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias scene_laura_extraslot_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(special=false)
# Add a new value into the item window
@special = special
# The original call
scene_laura_extraslot_init
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
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
# If special data, push only special IDs
if @special == true
@data.push($data_items[i]) if MOG::SpecialSelect.include?(i)
# Otherwise, only push IDs that aren't special
else
@data.push($data_items[i]) unless MOG::SpecialSelect.include?(i)
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
unless MOG::ITEM_FX == 2
@back = Plane.new
@back.bitmap = RPG::Cache.picture(MOG::ITEM_BACKGROUND)
@back.z = 100
else
@spriteset = Spriteset_Map.new
end
@item_lay = Sprite.new
@item_lay.bitmap = RPG::Cache.picture(MOG::ITEM_LAYOUT)
@item_lay.z = 100
@item_com = Sprite.new
@item_com.bitmap = RPG::Cache.picture(MOG::ITEM_TYPE_1)
@item_com.z = 100
@type = Window_Type.new
@type.opacity = 0
@type.visible = false
@help_window = Window_Help.new
@help_window.y = 405
@item_window = Window_Item.new
@item_window.help_window = @help_window
@item_window.visible = true
@item_window.active = true
@weapon_window = Window_Weapon.new
@weapon_window.help_window = @help_window
@weapon_window.visible = false
@weapon_window.active = true
@armor_window = Window_Armor.new
@armor_window.help_window = @help_window
@armor_window.visible = false
@armor_window.active = true
@item2_window = Window_Item.new(true)
@item2_window.help_window = @help_window
@item2_window.visible = false
@item2_window.active = true
@target_window = Window_Target_Item.new
@target_window.x = -300
@target_window.active = false
@help_window.opacity = 0
@help_window.x = -200
@help_window.contents_opacity = 0
@item_window.opacity = 0
@item2_window.opacity = 0
@weapon_window.opacity = 0
@armor_window.opacity = 0
@target_window.opacity = 0
@weapon_window.x = 640
@armor_window.x = 640
@item2_window.x = 640
@item_window.x = 640
@weapon_window.contents_opacity = 0
@armor_window.contents_opacity = 0
@item2_window.contents_opacity = 0
@item_window.contents_opacity = 0
unless MOG::ITEM_FX == 2
Graphics.transition(MOG::ITEM_TRAN_TIME, "Graphics/Transitions/" +
MOG::ITEM_TRAN_TYPE)
else
Graphics.transition
end
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
for i in 0..30
@weapon_window.x += 20
@armor_window.x += 20
@item2_window.x += 20
@item_window.x += 20
@weapon_window.contents_opacity -= 15
@armor_window.contents_opacity -= 15
@item2_window.contents_opacity -= 15
@item_window.contents_opacity -= 15
@item_com.opacity -= 15
@item_lay.opacity -= 15
@help_window.contents_opacity -= 15
@item_lay.zoom_x += 0.2
@item_com.zoom_y += 0.2
@target_window.x -= 15
@back.ox += 1 if MOG::ITEM_FX == 0
Graphics.update
end
Graphics.freeze
@help_window.dispose
@item_window.dispose
@item2_window.dispose
@weapon_window.dispose
@armor_window.dispose
@target_window.dispose
@item_lay.dispose
@back.dispose if MOG::ITEM_FX == 0
@back.dispose if MOG::ITEM_FX == 1
@spriteset.dispose if MOG::ITEM_FX == 2
@item_com.dispose
@type.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if @target_window.active == true
@target_window.visible = true
if @target_window.x < 0
@target_window.x += 20
elsif @target_window.x >= 0
@target_window.x = 0
end
else
if @target_window.x > -300
@target_window.x -= 20
elsif @target_window.x >= -300
@target_window.x = -300
@target_window.visible = false
end
end
if @help_window.x < 0
@help_window.x += 10
@help_window.contents_opacity += 15
elsif @help_window.x >= 0
@help_window.x = 0
@help_window.contents_opacity = 255
end
if @item_window.x > 250
@weapon_window.x -= 20
@armor_window.x -= 20
@item2_window.x -= 20
@item_window.x -= 20
@weapon_window.contents_opacity += 15
@armor_window.contents_opacity += 15
@item2_window.contents_opacity += 15
@item_window.contents_opacity += 15
elsif @item_window.x <= 250
@weapon_window.x = 250
@armor_window.x = 250
@item2_window.x = 250
@item_window.x = 250
@weapon_window.contents_opacity = 250
@armor_window.contents_opacity = 250
@item2_window.contents_opacity = 250
@item_window.contents_opacity = 250
end
if @target_window.active == false
if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::LEFT) or
Input.press?(Input::RIGHT) or Input.press?(Input::LEFT)
@weapon_window.x = 640
@armor_window.x = 640
@item2_window.x = 640
@item_window.x = 640
@weapon_window.contents_opacity = 0
@armor_window.contents_opacity = 0
@item2_window.contents_opacity = 0
@item_window.contents_opacity = 0
end
if Input.trigger?(Input.dir4) or Input.trigger?(Input.dir4) or
Input.trigger?(Input::L) or Input.trigger?(Input::R)
@help_window.x = -200
@help_window.contents_opacity = 0
end
end
@back.ox += 1 if MOG::ITEM_FX == 0
@help_window.update
@item_window.update
@item2_window.update
@weapon_window.update
@armor_window.update
@target_window.update
@type.update
case @type.index
when 0
@item_com.bitmap = RPG::Cache.picture(MOG::ITEM_TYPE_1)
if @target_window.active == true
update_target
@item_window.active = false
@type.active = false
return
else
@item_window.active = true
@type.active = true
end
@item2_window.active = false
@weapon_window.active = false
@armor_window.active = false
@item_window.visible = true
@item2_window.visible = false
@weapon_window.visible = false
@armor_window.visible = false
when 1
@item_com.bitmap = RPG::Cache.picture(MOG::ITEM_TYPE_2)
@item_window.active = false
@item2_window.active = false
@weapon_window.active = true
@armor_window.active = false
@item_window.visible = false
@item2_window.visible = false
@weapon_window.visible = true
@armor_window.visible = false
when 2
@item_com.bitmap = RPG::Cache.picture(MOG::ITEM_TYPE_3)
@item_window.active = false
@item2_window.active = false
@weapon_window.active = false
@armor_window.active = true
@item_window.visible = false
@item2_window.visible = false
@weapon_window.visible = false
@armor_window.visible = true
when 3
@item_com.bitmap = RPG::Cache.picture(MOG::ITEM_TYPE_4)
if @target_window.active == true
update_target
@item2_window.active = false
@type.active = false
return
else
@item2_window.active = true
@type.active = true
end
@item_window.active = false
@weapon_window.active = false
@armor_window.active = false
@item2_window.visible = true
@item_window.visible = false
@weapon_window.visible = false
@armor_window.visible = false
end
return update_item if @item_window.active
return update_weapon if @weapon_window.active
return update_armor if @armor_window.active
return update_item2 if @item2_window.active
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item2
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.x = (@item_window.index + 1) % 1 * 304
@target_window.active = true
@target_window.x = -350
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
end
Oh... it is 'purist' in that it assumes the windows will slide into the default position as the original script. For your change, look to lines 249 to 266 which YOU can edit. Ya had it going fine yourself. I'm just leaving it 'pure' so to speak.
Thank you.
In order to make the slection row go a little bit to the right, you need to go to line 249 - 266 and change it with this:
Code:
if @item_window.x > 269
@weapon_window.x -= 20
@armor_window.x -= 20
@item2_window.x -= 20
@item_window.x -= 20
@weapon_window.contents_opacity += 15
@armor_window.contents_opacity += 15
@item2_window.contents_opacity += 15
@item_window.contents_opacity += 15
elsif @item_window.x <= 269
@weapon_window.x = 269
@armor_window.x = 269
@item2_window.x = 269
@item_window.x = 269
@weapon_window.contents_opacity = 250
@armor_window.contents_opacity = 250
@item2_window.contents_opacity = 250
@item_window.contents_opacity = 250
Then, you're done.
Btw. just found out that your revised versions changes the item slection menu in battle.
Tried putting it above and under the battle system but, it still changes it.