OK I tried to keep it as simple as possible. :)
Try this (not done) version:
module Deity
module MapMouseHUD
# Just add as many Items as you wish(or place you have ^^)
# to add an Item just write more of those lines:
# Iconindex, ["Scenename","Sceneparameter"],choose_actor,"Discrition"],
ITEMS = [
[2,["Scene_Item",""],false,"Item"],
[13,["Scene_File","true, false, false"],false,"Save"],
[7,["Scene_Equip","0"],true,"Equip"],
[35,["Scene_Status","0"],true,"Status"],
[17,["Scene_End",""],false,"End"],
] #<= Do not delete!
X = 0 # X-Coordinate
Y = 360 # Y-Coordinate
SLOT_COLORS = [
Color.new(250,250,250,250), #Edge
Color.new(100,100,100,200) # Fillcolor
] #<= Do not delete!
end
end
include Deity::MapMouseHUD
class Scene_Map
alias start_mapmousehud start unless $@
def start
start_mapmousehud
@mmhud = Window_MapMouseHUD.new(X,Y,ITEMS)
end
alias update_mapmousehud update unless $@
def update
update_mapmousehud
@mmhud.update
end
alias terminate_mapmousehud terminate unless $@
def terminate
terminate_mapmousehud
@mmhud.dispose
end
end
class Window_MapMouseHUD < Window_Base
def initialize(x,y,items = [])
super(x,y,32+items.length+items.length*24,56)
@items = []
@help = Window_Base.new(x,y-56,100,56)
@help.visible = false
draw_items(items)
end
def draw_items(items)
for i in 0...items.length
draw_icon(items[i][0],i + i*24, 0)
@items.push(MapMouseHUD_Item.new(self.x + 16 + i + i*24,self.y+16,items[i][1],items[i][2],items[i][3]))
end
end
def draw_icon(icon_index, x, y, enabled = true)
self.contents.fill_rect(x,y,24,24,SLOT_COLORS[0])
self.contents.fill_rect(x+1,y+1,22,22,SLOT_COLORS[1])
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end
def update
if Mouse.click?(3)
for i in @items
p(i.x.to_s + " " + i.y.to_s)
end
end
if Mouse.click?(1)
for i in @items
if i.hit?
i.call_item_scene
end
end
else
for i in @items
if i.hit?
if !@help.visible
@help.visible = true
end
@help.contents.clear
@help.contents.draw_text(0,0,68,24,i.desc,1)
break
else
if @help.visible
@help.visible = false
@help.contents.clear
end
end
end
end
end
def dispose
@items = []
@help.dispose
self.contents.dispose
super
end
end
class MapMouseHUD_Item
attr_reader :x
attr_reader :y
attr_reader :desc
def initialize(x,y,scene,choose_actor,description)
@x = x
@y = y
@scene = scene
@choose = choose_actor
@desc = description
end
def hit?
if Mouse.pos != nil
return Mouse.pos[0] >= @x && Mouse.pos[0] <= @x+24 && Mouse.pos[1] >= @y && Mouse.pos[1] <= @y+24
else
return false
end
end
def call_item_scene
$scene = eval("#{@scene[0]}.new(#{@scene[1]})")
end
end
Deity
Already answered thank you again for the offer. ^^
If you have some ideas let me know so long I will finish the script.
Your name will be on top of all the others in my credits because you just created this script on my request.
It makes me glad to read this. ^^
______
EDIT:
______
I made a litle update just try it out:
module Deity
module MapMouseHUD
# Menu Settings #
# Just add as many Items as you wish(or the place you have ^^)
# to add an Item just write more of those lines:
# Iconindex, ["Scenename","Sceneparameter"],choose_actor,"Discrition"],
ITEMS = [
[2,["Scene_Item",""],false,"Item"],
[13,["Scene_File","true, false, false"],false,"Save"],
[7,["Scene_Equip","0"],true,"Equip"],
[35,["Scene_Status","0"],true,"Status"],
[17,["Scene_End",""],false,"End"],
] #<= Do not delete!
X = 0 # X-Coordinate
Y = 360 # Y-Coordinate
# To change the colors you have to change the 4 numbers
# the numbers have to be between 0 and 255.
# they change the whole color like this:
# (red,green,blue,opacity)
SLOT_COLORS = [
Color.new(250,250,250,250), #Edge
Color.new(100,100,100,200) # Fillcolor
] #<= Do not delete!
# Discription Settings #
DISCRIPTION_WIDTH = 120
SLIDE_TO_ICON = false # If the discription window have to slide to
# the marked icon.
DISCRITION_Y = 14 # Correct the discrition window position (can be negative)
# with this constant you can move the window up and down
DISCRIPTION_OPACITY = 100 # Opacity of the discription window
# Other Settings #
RETURN_TO_MAP = true # Should you go to the map after use items etc.?
# (only default scenes)
end
end
include Deity::MapMouseHUD
class Scene_Map
alias start_mapmousehud start unless $@
def start
start_mapmousehud
@mmhud = Window_MapMouseHUD.new(X,Y,ITEMS)
end
alias update_mapmousehud update unless $@
def update
update_mapmousehud
@mmhud.update
end
alias terminate_mapmousehud terminate unless $@
def terminate
terminate_mapmousehud
@mmhud.dispose
end
end
class Window_MapMouseHUD < Window_Base
def initialize(x,y,items = [])
super(x,y,32+items.length+items.length*24,56)
@items = []
if self.y - 56 < 0
@help = Window_Base.new(x,y+112+DISCRITION_Y,DISCRIPTION_WIDTH,56)
else
@help = Window_Base.new(x,y-56+DISCRITION_Y,DISCRIPTION_WIDTH,56)
end
@help.visible = false
@help.opacity = DISCRIPTION_OPACITY
draw_items(items)
end
def draw_items(items)
for i in 0...items.length
draw_icon(items[i][0],i + i*24, 0)
@items.push(MapMouseHUD_Item.new(self.x + 16 + i + i*24,self.y+16,items[i][1],items[i][2],items[i][3]))
end
end
def draw_icon(icon_index, x, y, enabled = true)
self.contents.fill_rect(x,y,24,24,SLOT_COLORS[0])
self.contents.fill_rect(x+1,y+1,22,22,SLOT_COLORS[1])
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end
def update
if Mouse.click?(1)
for i in @items
if i.hit?
i.call_item_scene
end
end
else
for i in @items
if i.hit?
if !@help.visible
@help.visible = true
end
@help.x = i.x if SLIDE_TO_ICON
@help.contents.clear
@help.contents.draw_text(0,0,DISCRIPTION_WIDTH-32,24,i.desc,1)
break
else
if @help.visible
@help.visible = false
@help.contents.clear
end
end
end
end
end
def dispose
@items = []
@help.dispose
self.contents.dispose
super
end
end
class MapMouseHUD_Item
attr_reader :x
attr_reader :y
attr_reader :desc
def initialize(x,y,scene,choose_actor,description)
@x = x
@y = y
@scene = scene
@choose = choose_actor
@desc = description
end
def hit?
if Mouse.pos != nil
return Mouse.pos[0] >= @x && Mouse.pos[0] <= @x+24 && Mouse.pos[1] >= @y && Mouse.pos[1] <= @y+24
else
return false
end
end
def call_item_scene
$scene = eval("#{@scene[0]}.new(#{@scene[1]})")
end
end
if RETURN_TO_MAP
class Scene_File
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Map.new
end
end
end
class Scene_Equip
def return_scene
$scene = Scene_Map.new
end
end
class Scene_Status
def return_scene
$scene = Scene_Map.new
end
end
class Scene_Item
def return_scene
$scene = Scene_Map.new
end
end
class Scene_Skill
def return_scene
$scene = Scene_Map.new
end
end
class Scene_End
def return_scene
$scene = Scene_Map.new
end
end
end
Deity
1. Can't understand. This line is correct until you've added some Menuitems which change the lines but line 126 is okay. ^^
Wirte the line out of your Script and discribe what you done.
2. It would be possible but I have to overwrite Woratanas Mouse Script. ^^
3. [177,["Scene_Quest",""],false,"Quests"] works perfectly. I think you forgot the "comma" behind every item. Maybe you show me the given error.
edit:while playing around with the script,I noticed that if i change the order of the menu items,no errors show up.I used three menu items to display on map-menu,save and end.when they are in this order-menu,save,end;the game returned errors at those lines where they were defined.then I changed the order to end,save and menu and no error has popped up so far Smiley
This would fit to my suggestion. ^^
4. Ehm like I said at this version only with Q and W. You switch in the Scene between the characters. I have no ideas how do it better. :P
Deity
=============
EDIT
=============
Ok I've written a new update.
It looks this kind:
(https://rmrk.net/proxy.php?request=http%3A%2F%2F250kb.de%2Fu%2F100502%2Fp%2FpO98kr5aZPG5.png&hash=13ff2723e99ef50747fecee4181541dc711e79b4)
Try it out.
1. The new Script.
module Deity
module MapMouseHUD
# Menu Settings #
# Just add as many Items as you wish(or the place you have ^^)
# to add an Item just write more of those lines:
# Iconindex, ["Scenename","Sceneparameter"],choose_actor,"Discrition"],
ITEMS = [
[144,["Scene_Item",""],false,"Item"],
[176,["Scene_File","true, false, false"],false,"Save"],
[32,["Scene_Equip","0"],true,"Equip"],
[137,["Scene_Status","0"],true,"Status"],
[213,["Scene_End",""],false,"End"],
] #<= Do not delete!
X = 0 # X-Coordinate
Y = 360 # Y-Coordinate
# To change the colors you have to change the 4 numbers
# the numbers have to be between 0 and 255.
# they change the whole color like this:
# (red,green,blue,opacity)
SLOT_COLORS = [
Color.new(250,250,250,250), #Edge
Color.new(100,100,100,200) # Fillcolor
] #<= Do not delete!
# Discription Settings #
DISCRIPTION_WIDTH = 120
SLIDE_TO_ICON = true # If the discription window have to slide to
# the marked icon.
DISCRITION_Y = 14 # Correct the discrition window position (can be negative)
# with this constant you can move the window up and down
DISCRIPTION_OPACITY = 100 # Opacity of the discription window
# Actor Window Settings #
ACTOR_AUTO = true # Auto fit to the menu.
ACTOR_WIDTH = 300 # Width of the window if ACTOR_AUTO = false.
ACTOR_X = 0
ACTOR_Y = 0
# Cursor Settings#
CURSOR_COLOR = Color.new(255,100,100,255) # Color of the Cursor.
# Other Settings #
RETURN_TO_MAP = true # Should you go to the map after use items etc.?
# (only default scenes)
CONTROLL_SWITCH_ID = 1 # Visible control of menu
end
end
include Deity::MapMouseHUD
module Mouse
def Mouse.pos
x, y = Mouse.screen_to_client(*Mouse.global_pos)
width, height = Mouse.client_size
begin
if (x >= 0 and y >= 0 and x < width and y < height)
return x, y
else
return -100,-100
end
rescue
return -100,-100
end
end
end
class Scene_Map
alias start_mapmousehud start unless $@
def start
start_mapmousehud
@mmhud = Window_MapMouseHUD.new(X,Y,ITEMS)
end
alias update_mapmousehud update unless $@
def update
update_mapmousehud
@mmhud.update if !$game_map.interpreter.running? && !$game_message.visible && $game_switches[CONTROLL_SWITCH_ID]
if $game_switches[CONTROLL_SWITCH_ID] && !$game_message.visible
@mmhud.change_visibility(true)
else
@mmhud.change_visibility(false)
end
end
alias terminate_mapmousehud terminate unless $@
def terminate
terminate_mapmousehud
@mmhud.dispose
end
end
class Window_MapMouseHUD < Window_Base
def initialize(x,y,items = [])
super(x,y,32+items.length+items.length*24,56)
@items = []
@actors = []
@scene = nil
if self.y - 56 < 0
@help = Window_Base.new(x,y+112+DISCRITION_Y,DISCRIPTION_WIDTH,56)
else
@help = Window_Base.new(x,y-56+DISCRITION_Y,DISCRIPTION_WIDTH,56)
end
@cursor = [Sprite.new,Sprite.new]
@cursor[0].visible = false
@cursor[1].visible = false
@c_id = nil
@help.visible = false
@help.opacity = DISCRIPTION_OPACITY
x = ACTOR_X
y = ACTOR_Y
width = ACTOR_WIDTH
if ACTOR_AUTO
x = self.x + self.width
y = self.y
width = 544 - self.width - self.x
end
@actor = Window_Base.new(x,y,width,56)
@help.z = @actor.z + 1
self.visible = $game_switches[CONTROLL_SWITCH_ID]
@actor.visible = $game_switches[CONTROLL_SWITCH_ID]
draw_items(items)
draw_party
create_cursor
end
def create_cursor
@cursor[0].bitmap = Bitmap.new(24,24)
@cursor[0].bitmap.fill_rect(0,0,@cursor[0].bitmap.width,@cursor[0].bitmap.height,CURSOR_COLOR)
@cursor[0].bitmap.clear_rect(2,2,@cursor[0].bitmap.width-4,@cursor[0].bitmap.height-4)
@cursor[1].bitmap = Bitmap.new((@actor.width-32) / $game_party.members.size,24)
@cursor[1].bitmap.fill_rect(0,0,@cursor[1].bitmap.width,@cursor[1].bitmap.height,CURSOR_COLOR)
@cursor[1].bitmap.clear_rect(2,2,@cursor[1].bitmap.width-4,@cursor[1].bitmap.height-4)
@cursor[0].z = 101
@cursor[1].z = 101
@cursor[0].x = -1000
@cursor[1].x = -1000
end
def draw_items(items)
@items = []
self.contents.clear
for i in 0...items.length
draw_icon(items[i][0],i + i*24, 0)
@items.push(MapMouseHUD_Item.new(self.x + 16 + i + i*24,self.y+16,items[i][1],items[i][2],items[i][3]))
end
end
def draw_party
@actors = []
@actor.contents.clear
a = 0
platz = (@actor.width-32) / $game_party.members.size
for i in $game_party.members
x = a*(platz)
draw_member(x,a,platz)
@actors.push(MapMouseHUD_Character.new(@actor.x + 16 + x,@actor.y + 16,a,platz))
a += 1
end
end
def draw_member(x,id,platz)
actor = $game_party.members[id]
width = platz - 20
@actor.draw_actor_hp_gauge(actor,x+20,-8,width)
@actor.draw_actor_mp_gauge(actor,x+20,0,width)
bitmap = Cache.character(actor.character_name)
sign = actor.character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = actor.character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
head = Bitmap.new(cw,ch)
head.blt(0,0, bitmap, src_rect)
@actor.contents.blt(x,0,head,Rect.new(0,0,cw,ch))
end
def draw_icon(icon_index, x, y, enabled = true)
self.contents.fill_rect(x,y,24,24,SLOT_COLORS[0])
self.contents.fill_rect(x+1,y+1,22,22,SLOT_COLORS[1])
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end
def hit?
if Mouse.pos != nil
return Mouse.pos[0] >= self.x && Mouse.pos[0] <= self.x+self.width && Mouse.pos[1] >= self.y && Mouse.pos[1] <= self.y+self.height
else
return false
end
end
def actor_hit?
if Mouse.pos != nil
return Mouse.pos[0] >= @actor.x && Mouse.pos[0] <= @actor.x+@actor.width && Mouse.pos[1] >= @actor.y && Mouse.pos[1] <= @actor.y+@actor.height
else
return false
end
end
def change_visibility(switch)
@actor.visible = switch
self.visible = switch
end
def update_items
id = 0
for i in @items
if i.hit?
if !i.choose
i.call_item_scene
@scene = nil
@c_id = nil
else
@c_id = id
@scene = i.scene[0]
end
end
id += 1
end
end
def update_actors
for i in @actors
if i.hit?
i.call_item_scene(@scene)
@scene = nil
@c_id = nil
end
end
end
def update_cursor(item = nil)
if item != nil
if item.methods.include?("desc")
@cursor[0].x = item.x
@cursor[0].y = item.y
else
@cursor[1].x = item.x
@cursor[1].y = item.y
end
elsif @c_id != nil
@cursor[0].x = @items[@c_id].x
end
update_cursor_visibility
end
def update_cursor_visibility
if hit? || @c_id != nil
@cursor[0].visible = true
else
@cursor[0].visible = false
end
@cursor[1].visible = actor_hit?
end
def update
return if Mouse.pos.nil?
update_cursor
if Mouse.click?(1)
if @scene == nil || @c_id != nil
update_items
end
if @c_id != nil
update_actors
elsif !actor_hit?
@scene = nil
@c_id = nil
end
else
for i in @items + @actors
if i.hit?
update_cursor(i)
if !@help.visible
@help.visible = true
end
@help.x = i.x if SLIDE_TO_ICON
@help.contents.clear
if i.methods.include?("desc")
text = i.desc
else
text = i.name
end
@help.contents.draw_text(0,0,DISCRIPTION_WIDTH-32,24,text,1)
break
else
if @help.visible
@help.visible = false
@help.contents.clear
end
end
end
end
end
def dispose
@items = []
@actors = []
@scene = nil
@c_id = nil
@help.dispose
@actor.dispose
for i in @cursor
i.dispose
end
self.contents.dispose
super
end
end
class MapMouseHUD_Item
attr_reader :x
attr_reader :y
attr_reader :desc
attr_reader :scene
attr_reader :choose
def initialize(x,y,scene,choose_actor,description)
@x = x
@y = y
@scene = scene
@choose = choose_actor
@desc = description
end
def hit?
if Mouse.pos != nil
return Mouse.pos[0] >= @x && Mouse.pos[0] <= @x+24 && Mouse.pos[1] >= @y && Mouse.pos[1] <= @y+24
else
return false
end
end
def call_item_scene
$scene = eval("#{@scene[0]}.new(#{@scene[1]})")
end
end
class MapMouseHUD_Character
attr_reader :x
attr_reader :y
attr_reader :name
def initialize(x,y,mem_id,width)
@x = x
@y = y
@width = width
@id = mem_id
@name = $game_party.members[@id].name
end
def hit?
if Mouse.pos != nil
return Mouse.pos[0] >= @x && Mouse.pos[0] <= @x+@width && Mouse.pos[1] >= @y && Mouse.pos[1] <= @y+24
else
return false
end
end
def call_item_scene(scene)
$scene = eval("#{scene}.new(#{@id})")
end
end
if RETURN_TO_MAP
class Scene_File
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Map.new
end
end
end
class Scene_Equip
def return_scene
$scene = Scene_Map.new
end
end
class Scene_Status
def return_scene
$scene = Scene_Map.new
end
end
class Scene_Item
def return_scene
$scene = Scene_Map.new
end
end
class Scene_Skill
def return_scene
$scene = Scene_Map.new
end
end
class Scene_End
def return_scene
$scene = Scene_Map.new
end
end
end
2. Edited "Simple Mouse System" from Woratana (Replace it with your's if you want that the player can't move under the menu)
#==============================================================================
# [VX] SMS - Simple Mouse System
#------------------------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Released on: 14/04/2008 (D-M-Y)
# ? Version: 1.5
#
# ? Credit: DerVVulfman, Near Fantastica, and Freak Boy [Mouse Input Module]
# lambchop, shun, Cybersam, Astro_mech, and Mr.Mo [Super Simple Mouse System]
# - Modern Algebra, Zeriab, Patrick Lester [Path Finding]
# - Near Fantastica, Fuso [Path Finding]
#
# - I will not be able to script this without those people and scripts above
#-----------------------------------------------------------------------------
#====[REQUIRE]=====
# - DerVVulfman's Mouse Input Module
# - Modern Algebra's Path Finding [version 2.0]
#
#====[FEATURE]=====
# - Support to use mouse in many scenes / windows
# - Mouse Pointer
# - Click on map to move player with Path Finding
# - Click on event to go talk/interact with that event
# - Click on event to walk to that event and interact
# - You can choose scene(s) that don't want to use mouse
# - You can turn mouse ON/OFF automatically by call script:
# $scene.no_mouse = (true/false) # True to turn off mouse
#====[MOUSE TAGS]=====
# Put one (or more) of these tags in the event command 'Comment..'
# [mauto] : This event will run automatically after click on it
# [mnone] : This event will not be determine as event when click on it
# (a.k.a. Player will not interact with it)
# [mtop] : Player will always stop at tile above this event when click on it
# [mleft] : Same as [mtop], but left side
# [mright] : Same as [mtop], but right side
# [mdown] : Same as [mtop], but below
#------------------------------------------------------------------------------
module Mouse
#==============================================================================
# MOUSE SETUP PART
#----------------------------------------------------------------------------
Scroll_Delay = 30 # (in Frames)
# Mouse Delay when scroll up or down the list
Path_Finding_Iteration = 0 # (Integer, 0 for no limit)
# How deep you want path finding to process until find the way
# less number will be able to find only easy path, less lag
# high number will be able to find complicated path, possible to increase lag
Scene_No_Mouse = []
# Scene(s) that you don't want to use mouse
# e.g. Scene_No_Mouse = [Scene_File, Scene_Map, Scene_Title]
Auto_Find_Destination = true
# It will automatically find the cloeset destination on map
# when click on unpassable tile.
#==============================================================================
end
#==============================================================================
# ** Mouse Input Module
#==============================================================================
class << Mouse
show_cursor = Win32API.new('user32', 'ShowCursor', 'l', 'l')
show_cursor.call(0)
$mousec = Sprite.new
$mousec.z = 10001
$mousec.x = $mousec.y = 1000
$mouse_icon = $base_cursor = 'foxkeh_cursor'
$mousec.bitmap = Cache.system($base_cursor)
$mouse_duration = -1
$mouse_changed = false
alias wor_mouse_upd_mouse update unless $@
def Mouse.update
wor_mouse_upd_mouse
if $scene.no_mouse
$mousec.visible = false if $mousec.visible
return
else; $mousec.visible = true if !$mousec.visible
end
if $mouse_old_icon.nil? or $mouse_old_icon != $mouse_icon
$mouse_old_icon = $mouse_icon
$mousec.bitmap = Cache.system($mouse_old_icon)
end
if @pos.nil?
$mousec.x = 1000 if $mousec.x != 1000
$mousec.y = 1000 if $mousec.y != 1000
else
$mousec.x = @pos[0] if $mousec.x != @pos[0]
$mousec.y = @pos[1] if $mousec.y != @pos[1]
end
end
def Mouse.map_pos
return nil if @pos == nil
x = ($game_map.display_x / 256) + (@pos[0] / 32)
y = ($game_map.display_y / 256) + (@pos[1] / 32)
return [x, y]
end
end
#==============================================================================
# ** Input
#==============================================================================
class << Input
alias wor_input_upd_mouse update unless $@
alias wor_input_trig_mouse trigger? unless $@
alias wor_input_rep_mouse repeat? unless $@
def Input.update
wor_input_upd_mouse
Mouse.update
end
def Input.trigger?(input)
return wor_input_trig_mouse(input) if Mouse.pos.nil?
if input == Input::B and !$scene.no_mouse
return (wor_input_trig_mouse(input) or Mouse.click?(2))
elsif input == Input::C and !$scene.no_mouse
if $scene.is_a?(Scene_Map) and !$game_message.visible
return wor_input_trig_mouse(input)
else
return (wor_input_trig_mouse(input) or Mouse.click?(1))
end
else
return wor_input_trig_mouse(input)
end
end
def Input.repeat?(input)
if input == Input::B and !$scene.no_mouse
return (wor_input_rep_mouse(input) or Mouse.click?(2))
else
return wor_input_rep_mouse(input)
end
end
end
#==============================================================================
# ** Graphics
#==============================================================================
class << Graphics
alias wor_graph_fadeout_mouse fadeout unless $@
def Graphics.fadeout(frames = 1)
$mousec.visible = false if !$mousec.nil?
wor_graph_fadeout_mouse(frames)
end
end
#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
alias wor_winsel_ini_mouse initialize
alias wor_winsel_upd_mouse update
def initialize(*args)
wor_winsel_ini_mouse(*args)
@scroll_wait = 0
@cursor_wait = 0
end
def update
wor_winsel_upd_mouse
update_mouse if self.active and self.visible
end
def update_mouse
@cursor_wait -= 1 if @cursor_wait > 0
(0..@item_max - 1).each do |i|
irect = item_rect(i)
irx = self.x + 16 + irect.x - self.ox
iry = self.y + 16 + irect.y - self.oy
move_cursor(i) if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
def move_cursor(index)
return if @index == index
@scroll_wait -= 1 if @scroll_wait > 0
row1 = @index / @column_max
row2 = index / @column_max
bottom = self.top_row + (self.page_row_max - 1)
if row1 == self.top_row and row2 < self.top_row
return if @scroll_wait > 0
@index = [@index - @column_max, 0].max
@scroll_wait = Mouse::Scroll_Delay
elsif row1 == bottom and row2 > bottom
return if @scroll_wait > 0
@index = [@index + @column_max, @item_max - 1].min
@scroll_wait = Mouse::Scroll_Delay
else
@index = index
end
return if @cursor_wait > 0
Sound.play_cursor
@cursor_wait += 2
end
end
#==============================================================================
# ** Window_MenuStatus
#==============================================================================
class Window_MenuStatus < Window_Selectable
def item_rect(index)
return Rect.new(0, index * 96, contents.width, 96)
end
end
#==============================================================================
# ** Window_NameInput
#==============================================================================
class Window_NameInput < Window_Base
alias wor_winnam_upd_mouse update
def update
wor_winnam_upd_mouse
if self.active and self.visible
(0..TABLE[@mode].size - 1).each do |i|
irect = item_rect(i)
irx = self.x + 16 + irect.x - self.ox
iry = self.y + 16 + irect.y - self.oy
@index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
end
#==============================================================================
# ** Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
def update_mouse
(0..@item_max - 1).each do |i|
irect = item_rect(i)
irx = self.viewport.ox + 16 + irect.x - self.ox
iry = 288 + 16 + irect.y - self.oy
self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
#==============================================================================
# ** Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_Command
def update_mouse
(0..@item_max - 1).each do |i|
irect = item_rect(i)
irx = self.viewport.ox + 288 + 16 + irect.x
iry = 288 + 16 + irect.y
self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
#==============================================================================
# ** Window_Message
#==============================================================================
class Window_Message < Window_Selectable
def update_mouse
(0..@item_max - 1).each do |i|
irect = item_rect(i)
irx = self.x + 16 + irect.x - self.ox
iry = self.y + 16 + irect.y - self.oy + ($game_message.choice_start * WLH)
self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
#==============================================================================
# ** Scene_Base
#==============================================================================
class Scene_Base
alias wor_scebase_posstr_mouse post_start
alias wor_scebase_preter_mouse pre_terminate
attr_accessor :no_mouse
def post_start
if !$mousec.nil?
$mousec.visible = true
@no_mouse = false
# If this scene is in Scene_No_Mouse
Mouse::Scene_No_Mouse.each do |sce|
if $scene.is_a?(sce)
$mousec.visible = false
@no_mouse = true
end
end
end
wor_scebase_posstr_mouse
end
def pre_terminate
$mousec.visible = false if !$mousec.nil?
wor_scebase_preter_mouse
end
end
#==============================================================================
# ** Scene_File
#==============================================================================
class Scene_File < Scene_Base
alias wor_scefil_upd_mouse update
def update
(0..@item_max - 1).each do |i|
ix = @savefile_windows[i].x
iy = @savefile_windows[i].y
iw = @savefile_windows[i].width
ih = @savefile_windows[i].height
if Mouse.area?(ix, iy, iw, ih)
@savefile_windows[@index].selected = false
@savefile_windows[i].selected = true
@index = i
end
end
wor_scefil_upd_mouse
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
alias wor_scemap_upd_mouse update
def update
wor_scemap_upd_mouse
if !@no_mouse
# IF left click
if Mouse.click?(1) and !$game_message.visible and
!$game_map.interpreter.running? and !@mmhud.hit? and !@mmhud.actor_hit?
mouse_xy = Mouse.map_pos
return if mouse_xy.nil?
old_direction = $game_player.direction
$game_player.turn_toward_pos(mouse_xy[0], mouse_xy[1])
# IF click near player, and there's trigger to event, run event
return if ($game_player.front?(mouse_xy[0],mouse_xy[1]) and
$game_player.check_action_event)
$game_player.clear_path
$game_player.mouse_force_path(mouse_xy[0], mouse_xy[1])
# IF middle click
elsif Mouse.click?(3) and !$game_message.visible and
!$game_map.interpreter.running?
mouse_xy = Mouse.map_pos
return if mouse_xy.nil?
$game_player.clear_path
$game_player.turn_toward_pos(mouse_xy[0], mouse_xy[1])
end
end
end
end
#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
def mouse_force_path(x, y, auto_check = ($game_map.events_xy(x, y).size > 0))
ori_x, ori_y = x, y
path_xy = $game_map.find_dest_xy(x, y, @x, @y)
return if path_xy.nil?
x, y = path_xy[0] ,path_xy[1]
# Force_move from MA's path finding
if map_passable?(x,y)
path = $game_map.find_path (self.x, self.y, x, y, false,
Mouse::Path_Finding_Iteration, self)
path.reverse!
# Turn toward destination
newmove = RPG::MoveCommand.new
newmove.code = 45 # Script..
newmove.parameters = ["turn_toward_pos(#{ori_x},#{ori_y})"]
path.push newmove
# Add script to check if there's event trigger
if auto_check
newmove = RPG::MoveCommand.new
newmove.code = 45
newmove.parameters = ['check_action_event']
path.push newmove
end
# Add an end command
path.push (RPG::MoveCommand.new (0))
move_route = RPG::MoveRoute.new
move_route.list = path
move_route.repeat = false
force_move_route (move_route)
end
end
def clear_path
@move_route_index = 0
@move_route = RPG::MoveRoute.new
@move_route.repeat = false
end
def turn_toward_pos(x,y)
sx = distance_x_from_pos(x)
sy = distance_y_from_pos(y)
if sx.abs > sy.abs # Horizontal distance is longer
sx > 0 ? turn_left : turn_right
elsif sx.abs < sy.abs # Vertical distance is longer
sy > 0 ? turn_up : turn_down
end
end
def distance_x_from_pos(x)
sx = @x - x
if $game_map.loop_horizontal?
if sx.abs > $game_map.width / 2
sx -= $game_map.width
end
end
return sx
end
def distance_y_from_pos(y)
sy = @y - y
if $game_map.loop_vertical?
if sy.abs > $game_map.height / 2
sy -= $game_map.height
end
end
return sy
end
def front?(x,y)
case @direction
when 2; return true if (x == @x-1 and y == @y)
when 4; return true if (x == @x and y == @y-1)
when 6; return true if (x == @x and y == @y+1)
when 8; return true if (x == @x+1 and y == @y)
end
return false
end
end
#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
# Find Destination for Path Finding
def find_dest_xy(x, y, self_x, self_y)
has_event = false
event_ary = events_xy(x, y)
# Remove Event that has 'mnone'
(event_ary).each do |i|
event_ary.delete(i) if i.comment?('[mnone]')
end
# Return original x, y if there are more than 1 events,
# or the only event has priority type 'Below Character'
if (event_ary.size == 1 and event_ary[0].priority_type != 1) or
event_ary.size > 1
return [x, y]
elsif event_ary.size == 1
# IF there's event, check for reserved direction
has_event = true
if event_ary[0].comment?('[mtop]')
return [x, y-1]
elsif event_ary[0].comment?('[mleft]')
return [x-1, y]
elsif event_ary[0].comment?('[mright]')
return [x+1, y]
elsif event_ary[0].comment?('[mdown]')
return [x, y+1]
elsif event_ary[0].comment?('[mauto]')
event_ary[0].start
return nil
end
end
# Check for passable direction or it's Same X/Y or doesn't allow auto-find
if (event_ary.size != 1 and $game_player.map_passable?(x, y)) or (self_x == x and self_y == y) or
(!Mouse::Auto_Find_Destination and !has_event)
return [x, y]
end
# Find nearest path
nx = (self_x - x)
ny = (self_y - y)
npath_real = []
if (nx.abs < ny.abs and nx != 0) or (ny == 0) # X is closer than Y
npath_real << (nx > 0 ? 'right' : 'left')
else # EQUAL, or Y is closer than X
npath_real << (ny > 0 ? 'up' : 'down')
end
npath_real_tran = move_translate(npath_real, x, y) # Translate word to value
# If the fastest way is possible, return it
if $game_player.map_passable?(npath_real_tran[0][0], npath_real_tran[0][1])
return [npath_real_tran[0][0], npath_real_tran[0][1]]
end
npath = []
# Add other possible ways
npath << 'up' if !npath_real.include?('up')
npath << 'left' if !npath_real.include?('left')
npath << 'down' if !npath_real.include?('down')
npath << 'right' if !npath_real.include?('right')
npath = move_translate(npath, x, y) # Translate other possible ways
(0..npath.size-1).each do |np| # Calculate distance from each point
npath[np] =
[npath[np], (self_x - npath[np][0]).abs + (self_y - npath[np][1]).abs]
end
npath = npath.sort_by {|i| i[1]} # Sort by Distance
# Check to move~
npath.each do |n|
return [n[0][0], n[0][1]] if $game_player.map_passable?(n[0][0], n[0][1])
end
# IF there's no way to go
return nil
end
def move_translate(ary, x, y)
(0..ary.size - 1).each do |n|
if ary[n] == 'up'
ary[n] = [x, y-1]
elsif ary[n] == 'left'
ary[n] = [x-1, y]
elsif ary[n] == 'right'
ary[n] = [x+1, y]
elsif ary[n] == 'down'
ary[n] = [x, y+1]
end
end
return ary
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
def comment?(comment, return_index = false )
if !@list.nil?
for i in 0...@list.size - 1
next if @list[i].code != 108
(0..@list[i].parameters.size - 1).each do |j|
if @list[i].parameters[j].include?(comment)
return [true, [i,j]] if return_index
return true
end
end
end
end
return [false, nil] if return_index
return false
end
end
Let me know if it's ok so.
Deity