Mog Menu script: help me stop the crazy picture movement during transitions - Zachariad - 05-28-2017
Hello helpful people! I'm so happy to have found a community that is still active with RMXP!
So, I've been using Mog Menu with a project, and all is going well, with one exception: when I exit out of my shop or item menus the script does some crazy stretching and moving with my menu pictures in addition to the standard transition I have assigned. I've experimented as much as I know how to try and eliminate the effect, but I've had no luck.
Here are the relevant scripts.
Scene Item:
Code: #_______________________________________________________________________________
# MOG Scene Item Laura V1.2
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
module MOG
#Transition Time.
MNIT = 20
#Transition Type(Name).
MNITT = "Aztec"
end
$mogscript = {} if $mogscript == nil
$mogscript["menu_laura"] = true
###############
# Window_Base #
###############
class Window_Base < Window
def nada
face = RPG::Cache.picture("")
end
def drw_face(actor,x,y)
face = RPG::Cache.picture(actor.name + "_fc") rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_maphp3(actor, x, y)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("HP_Bar")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("HP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)
end
def draw_mapsp3(actor, x, y)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("SP_Bar")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("SP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.sp.to_s, 2)
end
def draw_mexp_it(actor, x, y)
lv_tx = RPG::Cache.picture("LV_tx")
cw = lv_tx.width
ch = lv_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60 , y - ch + 32, lv_tx, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 101, y + 5, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 100, y + 4, 24, 32, actor.level.to_s, 1)
end
def draw_actor_state_it(actor, x, y, width = 80)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : color.new(80, 220, 60, 255)
self.contents.draw_text(x, y, width, 32, text,1)
end
end
######################
# Window_Target_Item #
######################
class Window_Target_Item < Window_Selectable
def initialize
super(0, 130, 280, 300) #third was 280
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "OCR A Extended"
self.z += 10
@item_max = $game_party.actors.size
refresh
end
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 0 #was 4
y = i * 65
actor = $game_party.actors[i]
drw_face(actor,x - 5,y + 55) # was only x
if $mogscript["TP_System"] == true
draw_actor_tp(actor, x + 160, y + 27 ,4)
else
draw_mexp_it(actor, x + 102, y + 25 )
end
draw_actor_state_it(actor, x + 156, y - 2 ) #was x + 165
draw_maphp3(actor, x + 12, y + 0) # 12s were 20s
draw_mapsp3(actor, x + 12, y + 32)
end
end
def update_cursor_rect
if @index <= -2
self.cursor_rect.set(-8, (@index + 12) * 65, self.width - 32, 60) #-10 was 0
elsif @index == -1
self.cursor_rect.set(-8, 2, self.width - 32, @item_max * 64 )
else
self.cursor_rect.set(-8, @index * 65 + 2, self.width - 32, 60)
end
end
end
############
# Type_Sel #
############
class Type_Sel < Window_Base
attr_reader :index
attr_reader :help_window
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
def index=(index)
@index = index
end
def row_max
return (@item_max + @column_max - 1) / @column_max
end
def top_row
return self.oy / 32
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end
def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::RIGHT)
if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
@index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
if Input.repeat?(Input::LEFT)
if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
@index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
end
end
###############
# Window_Type #
###############
class Window_Type < Type_Sel
def initialize
super(0, 0, 0, 0)
@item_max = 3
self.index = 0
end
end
##################
# Window_Item_Ex #
##################
class Window_Item_Ex < Window_Selectable
def initialize
super(250, 50, 400, 350)#first was 250 third was 295
@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
@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
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = menu_color
else
self.contents.font.color = disabled_color
end
x = 46 + index % 1 * (288 + 32) #first num was 4
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))
self.contents.font.name = "OCR A Extended"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == menu_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(46, 0, 24, 24), opacity) #first was 0
self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#################
# Window_Weapon #
#################
class Window_Weapon < Window_Selectable
def initialize
super(250, 50, 400, 350)
@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_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
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
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = color.new(80, 220, 60, 255)
else
self.contents.font.color = disabled_color
end
x = 46 + index % 1 * (288 + 32)
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))
self.contents.font.name = "OCR A Extended"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == menu_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(46, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
################
# Window_Armor #
################
class Window_Armor < Window_Selectable
def initialize
super(250, 50, 400, 350)
@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_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
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
def draw_item(index)
item = @data[index]
case item
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = color.new(80, 220, 60, 255)
else
self.contents.font.color = disabled_color
end
x = 46 + index % 1 * (288 + 32)
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))
self.contents.font.name = "OCR A Extended"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == menu_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(46, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
##############
# Scene_Item #
##############
class Scene_Item
def main
@back = Plane.new
@back.bitmap = RPG::Cache.picture("MN_BK_FILE")
@back.z = 100
@item_lay = Sprite.new
@item_lay.bitmap = RPG::Cache.picture("Item_lay")
@item_lay.z = 100
@item_com = Sprite.new
@item_com.bitmap = RPG::Cache.picture("Item_com01")
@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_Ex.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
@target_window = Window_Target_Item.new
@target_window.x = -300 ###was -300
@target_window.active = false
@help_window.opacity = 0 ###was 0
@help_window.x = -200 ###was -200
@help_window.contents_opacity = 0
@item_window.opacity = 0 ###was 0
@weapon_window.opacity = 0 ###was 0
@armor_window.opacity = 0 ###was 0
@target_window.opacity = 0 ###was 0
@weapon_window.x = 640
@armor_window.x = 640
@item_window.x = 640
@weapon_window.contents_opacity = 0 ###was 0
@armor_window.contents_opacity = 0 ###was 0
@item_window.contents_opacity = 0 ###was 0
Graphics.transition(MOG::MNIT, "Graphics/Transitions/" + MOG::MNITT)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
for i in 0..30
@weapon_window.x = 20 ###was += 20
@armor_window.x = 20 ###was += 20
@item_window.x = 20 ###was += 20
@weapon_window.contents_opacity -= 0 ###was 15
@armor_window.contents_opacity -= 0 ###was 15
@item_window.contents_opacity -= 0 ###was 15
@item_lay.zoom_x += 0.2
@item_lay.opacity -= 15
@item_com.zoom_y += 0.2
@item_com.opacity -= 0 ###was 15
@target_window.x = 15 ###was -= 15
@help_window.contents_opacity -= 0 ###was 15
@back.opacity -= 255 #new line
@back.oy -= 1
Graphics.update
end
Graphics.freeze
@help_window.dispose
@item_window.dispose
@weapon_window.dispose
@armor_window.dispose
@target_window.dispose
@item_lay.dispose
@back.dispose
@item_com.dispose
@type.dispose
end
def update
if @target_window.active == true
@target_window.visible = true
if @target_window.x < 20 ###was 0
@target_window.x = 20 ###was += 20
elsif @target_window.x >= 20 ###was 0
@target_window.x = 20
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 ###was += 10
@help_window.contents_opacity += 0 ###was 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 ###was -= 20
@armor_window.x = 20 ###was -= 20
@item_window.x = 20 ###was -= 20
@weapon_window.contents_opacity += 0 ###was 15
@armor_window.contents_opacity += 0
@item_window.contents_opacity += 0
elsif @item_window.x <= 250
@weapon_window.x = 250
@armor_window.x = 250
@item_window.x = 250
@weapon_window.contents_opacity = 250
@armor_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
@item_window.x = 640
@weapon_window.contents_opacity = 0
@armor_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 = -0 ###was -200
@help_window.contents_opacity = 0
end
end
@back.oy -= 1
@help_window.update
@item_window.update
@weapon_window.update
@armor_window.update
@target_window.update
@type.update
case @type.index
when 0
@item_com.bitmap = RPG::Cache.picture("Item_com01")
if @target_window.active == true
update_target
@item_window.active = false
@type.active = false
return
else
@item_window.active = true
@type.active = true
end
@weapon_window.active = false
@armor_window.active = false
@item_window.visible = true
@weapon_window.visible = false
@armor_window.visible = false
when 1
@item_com.bitmap = RPG::Cache.picture("Item_com02")
@item_window.active = false
@weapon_window.active = true
@armor_window.active = false
@item_window.visible = false
@weapon_window.visible = true
@armor_window.visible = false
when 2
@item_com.bitmap = RPG::Cache.picture("Item_com03")
@item_window.active = false
@weapon_window.active = false
@armor_window.active = true
@item_window.visible = false
@weapon_window.visible = false
@armor_window.visible = true
end
if @item_window.active
update_item
return
end
if @weapon_window.active
update_weapon
return
end
if @armor_window.active
update_armor
return
end
end
def update_weapon
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
return
end
end
def update_armor
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
return
end
end
def update_item
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 = -0 ###was -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
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.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 $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
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
Scene Shop:
Code: #_______________________________________________________________________________
# MOG Scene Shop Felicia V1.4
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
module MOG
#Transition Time.
MNSHPT= 30
#Transition Type (Name)
MNSHPTT= "Aztec"
end
$mogscript = {} if $mogscript == nil
$mogscript["menu_shop"] = true
###############
# Window_Base #
###############
class Window_Base < Window
def draw_item_name_ex(item, x, y)
if item == nil
return
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, 150, 32, item.name)
end
def nada
face = RPG::Cache.picture("")
end
def drw_face(actor,x,y)
face = RPG::Cache.picture(actor.name + "_fc") rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect) #was no -3 to begin
end
end
################
# Win_Shop_Sel #
################
class Win_Shop_Sel < Window_Base
attr_reader :index
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
def index=(index)
@index = index
update_cursor_rect
end
def row_max
return (@item_max + @column_max - 1) / @column_max
end
def top_row
return self.oy / 32
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end
def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * 80
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x, y, 32, 32)
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::RIGHT)
if @column_max >= 2 and @index < @item_max - 1
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end
if Input.repeat?(Input::LEFT)
if @column_max >= 2 and @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
end
update_cursor_rect
end
end
######################
# Window_ShopCommand #
######################
class Window_ShopCommand < Win_Shop_Sel
def initialize
super(58, 68, 230, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["", "", ""]
self.index = 0
end
end
##################
# Window_ShopBuy #
##################
class Window_ShopBuy < Window_Selectable
def initialize(shop_goods)
super(-10, 180, 310, 225)
@shop_goods = shop_goods
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if item != nil
@data.push(item)
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
def draw_item(index)
self.contents.font.name = "OCR A Extended"
self.contents.font.bold = false
self.contents.font.size = 16
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
x = 4
y = index * 32
if item.price <= $game_party.gold and number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 150, 32, item.name, 0)
self.contents.font.color = Color.new(50,250,150,255)
self.contents.draw_text(x + 120, y, 88, 32, "", 1)
if item.price <= $game_party.gold
if number < 99
self.contents.font.color = Color.new(200,200,50,255)
else
self.contents.font.color = disabled_color
end
else
self.contents.font.color = Color.new(250,100,50,255)
end
self.contents.draw_text(x + 180, y, 88, 32, item.price.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
###################
# Window_ShopSell #
###################
class Window_ShopSell < Window_Selectable
def initialize
super(-10, 180, 305, 225)
@column_max = 1
refresh
self.index = 0
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
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
@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
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
if item.price > 0
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.font.name = "OCR A Extended"
self.contents.font.size = 16 ################################
x = 4 + index % 1 * (288 + 32)
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)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 150, 32, item.name, 0)
self.contents.draw_text(x + 230, y, 16, 32, ":", 1)
self.contents.draw_text(x + 240, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#####################
# Window_ShopNumber #
#####################
class Window_ShopNumber < Window_Base
def initialize
super(-10, 180, 310, 225)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
@max = 1
@price = 0
@number = 1
end
def set(item, max, price)
@item = item
@max = max
@price = price
@number = 1
refresh
end
def number
return @number
end
def refresh
self.contents.clear
self.contents.font.name = "OCR A Extended"
self.contents.font.bold = true
self.contents.font.size = 16 ################################
draw_item_name_ex(@item, 4, 66)
self.contents.font.color = Color.new(80,220,60,255)
self.contents.draw_text(185, 66, 32, 32, "x")
self.contents.font.color = normal_color
self.contents.draw_text(208, 66, 24, 32, @number.to_s, 2)
self.cursor_rect.set(304, 66, 32, 32)
total_price = @price * @number
cx = contents.text_size("Coin").width
self.contents.font.color = Color.new(80,220,60,255)
self.contents.draw_text(4, 160, 228-2, 32, total_price.to_s, 2)
self.contents.font.color = Color.new(80,220,60,255)
self.contents.draw_text(86, 160, 88, 32, "Coin", 1)
end
def update
super
if self.active
if Input.repeat?(Input::RIGHT) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number += 1
refresh
end
if Input.repeat?(Input::LEFT) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number -= 1
refresh
end
if Input.repeat?(Input::UP) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number = [@number + 10, @max].min
refresh
end
if Input.repeat?(Input::DOWN) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number = [@number - 10, 1].max
refresh
end
end
end
end
#####################
# Window_ShopStatus #
#####################
class Window_ShopStatus < Window_Base
def initialize
super(290, 80, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
refresh
end
def refresh
self.contents.clear
self.contents.font.name = "OCR A Extended"
self.contents.font.size = 16
if @item == nil
return
end
if $mogscript["Item_Limit"] == true
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
item_max = MOG::ITEM_LIMIT[@item.id]
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
item_max = MOG::WEAPON_LIMIT[@item.id]
when RPG::Armor
number = $game_party.armor_number(@item.id)
item_max = MOG::ARMOR_LIMIT[@item.id]
end
self.contents.font.color = system_color
self.contents.draw_text(206, 0, 200, 32, "Stock")
self.contents.font.color = system_color
if item_max != nil
self.contents.draw_text(300, 0, 80, 32, number.to_s + " / " + item_max.to_s, 2)
else
max_limit = MOG::DEFAULT_LIMIT
self.contents.draw_text(300, 0, 80, 32, number.to_s + " / " + max_limit.to_s, 2)
end
else
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
self.contents.font.color = system_color
self.contents.draw_text(231, 0, 200, 32, "In Stock")
self.contents.font.color = system_color
self.contents.draw_text(192, 0, 32, 32, number.to_s, 2)
end
if @item.is_a?(RPG::Item)
return
end
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(145, y - 30, 100, 32, "", 2) #was "Equipped"
drw_face(actor,0 ,80 + 64 * i)
if @item.is_a?(RPG::Weapon)
item1 = $data_weapons[actor.weapon_id]
elsif @item.kind == 0
item1 = $data_armors[actor.armor1_id]
elsif @item.kind == 1
item1 = $data_armors[actor.armor2_id]
elsif @item.kind == 2
item1 = $data_armors[actor.armor3_id]
else
item1 = $data_armors[actor.armor4_id]
end
if actor.equippable?(@item)
if @item.is_a?(RPG::Weapon)
atk1 = item1 != nil ? item1.atk : 0
atk2 = @item != nil ? @item.atk : 0
pdef1 = item1 != nil ? item1.pdef : 0
mdef1 = item1 != nil ? item1.mdef : 0
pdef2 = @item != nil ? @item.pdef : 0
mdef2 = @item != nil ? @item.mdef : 0
self.contents.draw_text(-10, 59 + 64 * i, 112, 32,"Attack", 2)
self.contents.draw_text(85, 59 + 64 * i, 112, 32,"Defense", 2)
self.contents.draw_text(182, 59 + 64 * i, 112, 32,"MagDef", 2)
change = atk2 - atk1
change2 = pdef2 - pdef1
change3 = mdef2 - mdef1
if atk2 > atk1
self.contents.font.color = Color.new(50,250,150,255)
elsif atk2 == atk1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(250,100,50,255)
end
self.contents.draw_text(21, 59 + 64 * i, 112, 32,sprintf("%d", change), 2)
if pdef2 > pdef1
self.contents.font.color = Color.new(50,250,150,255)
elsif pdef2 == pdef1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(250,100,50,255)
end
self.contents.draw_text(119, 59 + 64 * i, 112, 32,sprintf("%d", change2), 2)
if mdef2 > mdef1
self.contents.font.color = Color.new(50,250,150,255)
elsif mdef2 == mdef1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(250,100,50,255)
end
self.contents.draw_text(214, 59 + 64 * i, 112, 32,sprintf("%d", change3), 2)
end
if @item.is_a?(RPG::Armor)
pdef1 = item1 != nil ? item1.pdef : 0
mdef1 = item1 != nil ? item1.mdef : 0
eva1 = item1 != nil ? item1.eva : 0
pdef2 = @item != nil ? @item.pdef : 0
mdef2 = @item != nil ? @item.mdef : 0
eva2 = @item != nil ? @item.eva : 0
change = pdef2 - pdef1
change2 = mdef2 - mdef1
change3 = eva2 - eva1
self.contents.draw_text(0, 59 + 64 * i, 112, 32,"Defense", 2)
self.contents.draw_text(96, 59 + 64 * i, 112, 32,"MagDef", 2)
self.contents.draw_text(181, 59 + 64 * i, 112, 32,"Dodge", 2)
if pdef2 > pdef1
self.contents.font.color = Color.new(50,250,150,255)
elsif pdef2 == pdef1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(250,100,50,255)
end
self.contents.draw_text(33, 59 + 64 * i, 112, 32,sprintf("%d", change), 2)
if mdef2 > mdef1
self.contents.font.color = Color.new(50,250,150,255)
elsif mdef2 == mdef1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(250,100,50,255)
end
self.contents.draw_text(130, 59 + 64 * i, 112, 32,sprintf("%d", change2), 2)
if eva2 > eva1
self.contents.font.color = Color.new(50,250,150,255)
elsif eva2 == eva1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(250,100,50,255)
end
self.contents.draw_text(214, 59 + 64 * i, 112, 32,sprintf("%d", change3), 2)
end
end
if item1 != nil
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = 64 + 64 * i
bitmap = RPG::Cache.icon(item1.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x + 50, y - 25, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 75, y - 30, 212, 32, item1.name)
end
end
end
def item=(item)
if @item != item
@item = item
refresh
end
end
end
##############
# Scene_Shop #
##############
class Scene_Shop
def main
@mshop_back = Plane.new
@mshop_back.bitmap = RPG::Cache.picture("MN_BK_BLUE")
@mshop_back.z = 10
@mshop_lay = Sprite.new
@mshop_lay.bitmap = RPG::Cache.picture("Shop_Lay")
@mshop_lay.z = 15
@mshop_com = Sprite.new
@mshop_com.bitmap = RPG::Cache.picture("Shop_Com01")
@mshop_com.z = 20
@help_window = Window_Help.new
@help_window.contents.font.name = "OCR A Extended"
@help_window.contents.font.size = 20 ################################
@help_window.y = 413
@command_window = Window_ShopCommand.new
@command_window.visible = false
@gold_window = Window_Gold.new
@gold_window.x = 460
@gold_window.y = +1
@dummy_window = Window_Base.new(0, 128, 640, 352)
@buy_window = Window_ShopBuy.new($game_temp.shop_goods)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@sell_window = Window_ShopSell.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
@number_window = Window_ShopNumber.new
@number_window.active = false
@number_window.visible = false
@status_window = Window_ShopStatus.new
@status_window.visible = false
@help_window.opacity = 0
@status_window.opacity = 0
@sell_window.opacity = 0
@buy_window.opacity = 0
@gold_window.opacity = 0
@command_window.opacity = 0
@number_window.opacity = 0
@dummy_window.opacity = 0
Graphics.transition(MOG::MNSHPT, "Graphics/Transitions/" + MOG::MNSHPTT)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
for i in 0..30
@mshop_back.oy -= 1
@mshop_back.opacity -= 255
@help_window.x -= 15
@gold_window.x += 15
@mshop_lay.zoom_x += 0.1
@mshop_lay.opacity -= 10
@command_window.x -= 15
@mshop_com.x -= 15
@buy_window.x -= 20
@sell_window.x -= 20
Graphics.update
end
Graphics.freeze
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
@mshop_back.dispose
@mshop_lay.dispose
@mshop_com.dispose
end
def update
@mshop_back.oy -= 1
if @help_window.x < 0
@help_window.x += 10
@help_window.contents_opacity += 10
elsif @help_window.x >= 0
@help_window.x = 0
@help_window.contents_opacity = 255
end
if @sell_window.active == true
@sell_window.visible = true
if @sell_window.x < -10
@sell_window.x += 15
@sell_window.contents_opacity += 10
elsif @sell_window.x >= -10
@sell_window.x = -10
@sell_window.contents_opacity = 255
end
else
if @sell_window.x > -0 ####### was -300
@sell_window.x -= 0 ####### was 15
@sell_window.contents_opacity -= 10
elsif @sell_window.x <= -0 ####### was -300
@sell_window.x = -0 ####### was -300
@sell_window.contents_opacity = 0
@sell_window.visible = false
end
end
if @buy_window.active == true
@buy_window.visible = true
if @buy_window.x < -10
@buy_window.x += 15
@buy_window.contents_opacity += 10
elsif @buy_window.x >= -10
@buy_window.x = -10
@buy_window.contents_opacity = 255
end
else
if @buy_window.x > -0 ####### was -300
@buy_window.x -= 0 ####### was 15
@buy_window.contents_opacity -= 10
elsif @buy_window.x <= -0 ####### was -300
@buy_window.x = -0 ####### was -300
@buy_window.contents_opacity = 0
@buy_window.visible = false
end
end
if @number_window.active == true
@number_window.visible = true
if @number_window.x < -10
@number_window.x += 15
@number_window.contents_opacity += 10
elsif @number_window.x >= -10
@number_window.x = -10
@number_window.contents_opacity = 255
end
else
if @number_window.x > -0 ####### was -300
@number_window.x -= 0 ####### was 15
@number_window.contents_opacity -= 10
elsif @number_window.x <= -0 ####### was -300
@number_window.x = -0 ####### was -300
@number_window.contents_opacity = 0
@number_window.visible = false
end
end
if @number_window.active == false
if Input.trigger?(Input.dir4) or Input.trigger?(Input::C) or
Input.trigger?(Input::L) or Input.trigger?(Input::R)
@help_window.x = -0 ##### was -200
@help_window.contents_opacity = 0
end
end
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
case @command_window.index
when 0
@mshop_com.bitmap = RPG::Cache.picture("Shop_Com01")
when 1
@mshop_com.bitmap = RPG::Cache.picture("Shop_Com02")
when 2
@mshop_com.bitmap = RPG::Cache.picture("Shop_Com03")
end
if @command_window.active
update_command
return
end
if @buy_window.active
update_buy
return
end
if @sell_window.active
update_sell
return
end
if @number_window.active
update_number
return
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@dummy_window.visible = false
@buy_window.active = true
@buy_window.refresh
@status_window.visible = true
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@dummy_window.visible = false
@sell_window.active = true
@sell_window.refresh
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
return
end
end
def update_buy
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
if @item == nil or @item.price > $game_party.gold
$game_system.se_play($data_system.buzzer_se)
return
end
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
if number == 99
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
end
end
def update_sell
@status_window.item = @sell_window.item
@status_window.visible = true
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@dummy_window.visible = true
@sell_window.active = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @sell_window.item
@status_window.item = @item
if @item == nil or @item.price == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
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
max = number
@sell_window.active = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@status_window.visible = true
end
end
def update_number
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@number_window.active = false
case @command_window.index
when 0
@buy_window.active = true
when 1
@sell_window.active = true
@status_window.visible = false
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.shop_se)
@number_window.active = false
case @command_window.index
when 0
$game_party.lose_gold(@number_window.number * @item.price)
case @item
when RPG::Item
$game_party.gain_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.gain_weapon(@item.id, @number_window.number)
when RPG::Armor
$game_party.gain_armor(@item.id, @number_window.number)
end
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@buy_window.active = true
when 1
$game_party.gain_gold(@number_window.number * (@item.price / 2))
case @item
when RPG::Item
$game_party.lose_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, @number_window.number)
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
end
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
@sell_window.active = true
@status_window.visible = false
end
return
end
end
end
I've taken some screenshots demonstrating the crazy transition to give you an idea:
Item screen normally
Item screen mid-transition
Shop screen normally
Shop screen mid-transition
RE: Mog Menu script: help me stop the crazy picture movement during transitions - DerVVulfman - 05-28-2017
First.... Moggy's original scripts are so damn messy. Ya should look at my 'revised menus' that I posted. The posts only involve the 'menu' scripts, but each includes a copy of his original scripts as well as my own rewrites. Yep, that includes Laura.
HOWEVER, I did not convert any 'Felicia Shop' Dammit, where did that come from? Gonna have to look at the original and get its graphics for some testin'. Be advised, this may entail a re-envision of his script. Is that a bad thing?
EDIT: Just posted a revised version of Felicia in our Scripts Listings. It has MUCH more available to be altered in my configuration section, including an ability to turn on/off the image sweep feature.
RE: Mog Menu script: help me stop the crazy picture movement during transitions - Zachariad - 05-29-2017
(05-28-2017, 04:39 PM)DerVVulfman Wrote: First.... Moggy's original scripts are so damn messy. Ya should look at my 'revised menus' that I posted. The posts only involve the 'menu' scripts, but each includes a copy of his original scripts as well as my own rewrites. Yep, that includes Laura.
HOWEVER, I did not convert any 'Felicia Shop' Dammit, where did that come from? Gonna have to look at the original and get its graphics for some testin'. Be advised, this may entail a re-envision of his script. Is that a bad thing?
EDIT: Just posted a revised version of Felicia in our Scripts Listings. It has MUCH more available to be altered in my configuration section, including an ability to turn on/off the image sweep feature.
Thanks so much for the heads up, DerVVulfman! I'll be certain to check your scripts out.
Although, to avoid a complete redo on my end, is it possible to turn the image sweep off in Mog's scripts? If you think Mog's scripts are messy, you should see them after I'm done hunting and pecking with no Ruby skills whatsoever ;)
RE: Mog Menu script: help me stop the crazy picture movement during transitions - DerVVulfman - 05-29-2017
We learn by doing.
BUT, it's pretty much the block of code that goes for i in 0..30 /// @help_window.x -15 /// Graphics.update /// end Just after the loop do ... end block of code but before Graphics.freeze.
While I hate to suggest it, just delete all within the FOR...END block I mentioned and that should work. Me? I did some tinkering so the config lets you turn the slide effect off.
But if you look at what I did, you'd see I put in a lot of options so one shouldn't need to hunt n peck so much. Filenames, font colors, etc. All 'should' be editable in the config now.
RE: Mog Menu script: help me stop the crazy picture movement during transitions - Zachariad - 05-31-2017
(05-29-2017, 01:37 AM)DerVVulfman Wrote: We learn by doing.
BUT, it's pretty much the block of code that goes for i in 0..30 /// @help_window.x -15 /// Graphics.update /// end Just after the loop do ... end block of code but before Graphics.freeze.
While I hate to suggest it, just delete all within the FOR...END block I mentioned and that should work. Me? I did some tinkering so the config lets you turn the slide effect off.
But if you look at what I did, you'd see I put in a lot of options so one shouldn't need to hunt n peck so much. Filenames, font colors, etc. All 'should' be editable in the config now.
You, sir, are an absolute boss.
Thanks a mil for your help and for your significant contributions to Moghunter's original script. You know, I haven't touched this project since around 2008, so the last time I cracked this puppy open Mog Menu was pretty much the latest hotness ;)
This query is solved, so feel free to lock the thread
|