楼主: Sion

[RMVA发布] VA鼠标脚本 6/9 更新 v2.32 by Sion

 火 [复制链接]
梦石
0
星屑
50
在线时间
65 小时
注册时间
2008-5-15
回帖
29
发表于 2013-3-12 20:18:43 | 显示全部楼层
感谢楼主的脚本,确实很好用的说。 再次感谢,但是还是有一小点BUG……谢谢!
回复

使用道具 举报

呼啸的团子

梦石
0
星屑
293
在线时间
93 小时
注册时间
2006-11-9
回帖
118
发表于 2013-3-13 09:10:50 | 显示全部楼层
突然有个想法,就是说我屏幕的左上方一直有个图标,只要鼠标移到那个位置上点击就能打开对应的界面。就像一些游戏里把物品,状态等窗口的打开用一个小图标的方式放在左边一排。
嗯,这么想的话可以做一个窗口摆在左边,从上到下分别是要的功能,这个窗口在角色移动的时候也得一直处于激活的状态,这样只要鼠标移过去就能点开里面的选项,但是问题是用方向键操作的时候,怎么区分是操作角色移动还是选择窗口里的选项。。。额,好像蛮乱的,只是个初步的想法哈,呵呵。

点评

按钮的话判断一下鼠标的位置和按下鼠标按键就行了。然后参照scene_menu就能做一个菜单,不会与角色操作冲突的。  发表于 2013-3-13 20:48
风啊!我会面对一切,让我们共赴痛苦之海吧!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
97 小时
注册时间
2011-11-6
回帖
47
发表于 2013-3-14 21:16:55 | 显示全部楼层
首先说下,这真是个不错的脚本!
不过还是希望楼主能加入一个鼠标移动到选项会播放声效的效果——这个应该不难吧?

点评

我觉得那样好吵啊…  发表于 2013-3-14 21:32
回复

使用道具 举报

梦石
0
星屑
266
在线时间
2355 小时
注册时间
2009-3-13
回帖
2257

贵宾

 楼主| 发表于 2013-3-14 21:37:19 | 显示全部楼层
为RPG生 发表于 2013-3-14 21:16
首先说下,这真是个不错的脚本!
不过还是希望楼主能加入一个鼠标移动到选项会播放声效的效果——这个应该 ...
  1. class Window_Selectable
  2.   #--------------------------------------------------------------------------
  3.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
  4.   #--------------------------------------------------------------------------
  5.   def set_cursor
  6.     mouse_row, mouse_col = mouse_window_area
  7.     if    mouse_row == -1
  8.       @move_state += 1 if need_scroll?
  9.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  10.     elsif mouse_row == -2
  11.       @move_state += 1 if need_scroll?
  12.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  13.     elsif mouse_col == -1
  14.       @move_state += 1 if need_scroll?
  15.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand?
  16.     elsif mouse_col == -2
  17.       @move_state += 1 if need_scroll?
  18.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand?
  19.     else
  20.       @move_state = 0
  21.       new_index = (top_row + mouse_row) * col_max + mouse_col
  22.       if new_index < item_max && new_index != @index
  23.         Sound.play_cursor
  24.         select(new_index)
  25.       end
  26.     end
  27.   end
  28. end
复制代码
你可以自己试一试效果,放到鼠标脚本以下就行了;一些特殊的菜单还要另外改
回复

使用道具 举报

梦石
0
星屑
604
在线时间
333 小时
注册时间
2011-11-19
回帖
166
发表于 2013-3-16 17:07:16 | 显示全部楼层
游戏中可不可以执行中途更换鼠标指针的指令呢?
比如游戏过程中切换鼠标指针图,或者鼠标移到特别事件上时自动更换的效果。
哈哈,鼠标功能越来越全了呢!

点评

最近比较忙了,有空的时候再更新吧- -b  发表于 2013-3-19 11:57
支持《彼岸之光》系列!加油!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
91 小时
注册时间
2011-12-21
回帖
9
发表于 2013-3-20 16:34:50 | 显示全部楼层
本帖最后由 ayano2k 于 2013-3-21 15:57 编辑

感谢楼主的脚本,很好用~~
但是这个功能想知道该怎么设置??
  [[  1.3a: 代码小修改;
          加入了鼠标点击启动事件的功能,
          在事件中加入“注释”: 鼠标启动  ,<<<?不懂
          该事件将无法用其它方式启动,只能用鼠标左键点击启动。]]
-------------------------------------------------
-------------------------------------------------
另外这个作者有作出8方向移动,不知道和滑鼠系统有没有机会完美整合
artificialprovidence.web.fc2.com/r3usability.html

--------------------------PM 04
传送完成了,请查收~~

点评

就是 事件编辑里面—流程控制—插入注释 鼠标启动。8向移动的话,你发个可用范例给我:tcsion@163.com  发表于 2013-3-21 08:32
回复

使用道具 举报

梦石
0
星屑
50
在线时间
381 小时
注册时间
2012-8-13
回帖
103
发表于 2013-3-23 11:58:03 | 显示全部楼层
本帖最后由 tyq4590 于 2013-3-24 13:26 编辑

这个脚本很不错,手感各方面都很出色。就是遇到一个问题:在其他脚本用到cursor_fix的时候会报错:undefined method 'cursor_fix=' for true:TrueClass 不知道有没有解决办法?(我测试了一下,只要把全鼠标脚本移除就不报错了,所以确定是跟全鼠标脚本的兼容性问题)

附上脚本(画廊),报错的部分是605行‘@list_window.activate.cursor_fix = true’这一句:

[pre lang="ruby" line="1"]#==============================================================================
# ■ VXAce-RGSS3-18 ギャラリー        by Claimh
#------------------------------------------------------------------------------
# 写真を表示するギャラリーを作ります
# なお、ギャラリーの管理情報は全セーブデータで共通となります。
#------------------------------------------------------------------------------
# ●ギャラリー全体の表示許可
#   DataManager.garally.enable = true
# ●写真の表示許可
#   DataManager.garally[id] = true
# ●写真の追加(LIST以外のスナップショットなどを追加)
#   DataManager.garally.push(id, GFile.new(filename, text))
# ●イベント等から呼び出す
#   SceneManager.call(Scene_ExGarally)
#==============================================================================

class GFile
  attr_reader :name
  attr_reader :text
  def initialize(filename, text="")
    @name = filename; @text = text
  end
end

module ExGarally
  # 写真の設定
  LIST = {
#  ID => GFile.new("ファイル名(Graphics/Pictures)", 表示文字)
   1  => GFile.new("BlueSky", "青い空\n改行"),
   2  => GFile.new("CloudySky1", "曇った空"),
   3  => GFile.new("CloudySky2"),
   4  => GFile.new("DarkSpace1"),
   5  => GFile.new("DarkSpace2"),
   6  => GFile.new("Mountains1"),
   7  => GFile.new("Mountains2"),
   8  => GFile.new("Mountains3"),
   9  => GFile.new("Mountains4"),
   10 => GFile.new("Mountains5"),
   12 => GFile.new("Ocean2"),
   11 => GFile.new("Ocean1"),
   13 => GFile.new("SeaofClouds"),
   14 => GFile.new("StarlitSky"),
#   15 => GFile.new("Sunset"),
  }
  
  # ヘルプウィンドウの行数(1~3)
  HELP_LINES = 2
end


#==============================================================================
# ■ ExGarally
#==============================================================================
module ExGarally
  #--------------------------------------------------------------------------
  # ● ギャラリーの表示有効?
  #--------------------------------------------------------------------------
  def self.enable?
    DataManager.garally.enable
  end
  #--------------------------------------------------------------------------
  # ● ファイル名
  #--------------------------------------------------------------------------
  def self.filename
    "exgallary.rvdata2"
  end
  #--------------------------------------------------------------------------
  # ● セーブの実行
  #--------------------------------------------------------------------------
  def self.save_exdata(obj)
    save_data(obj, filename)
  end
  #--------------------------------------------------------------------------
  # ● ロードの実行
  #--------------------------------------------------------------------------
  def self.load_exdata
    exist? ? load_data(filename) : Game_ExGarallyList.new
  end
  #--------------------------------------------------------------------------
  # ● ファイル削除
  #--------------------------------------------------------------------------
  def self.delete_exdata
    return unless exist?
    File.delete(filename) rescue nil
  end
  #--------------------------------------------------------------------------
  # ● ファイルの有無チェック
  #--------------------------------------------------------------------------
  def self.exist?
    FileTest.exist?(filename)
  end
end


#==============================================================================
# ■ DataManager
#==============================================================================
class << DataManager
  #--------------------------------------------------------------------------
  # ● 各種ゲームオブジェクトの作成
  #--------------------------------------------------------------------------
  alias create_game_objects_exgrly create_game_objects
  def create_game_objects
    create_game_objects_exgrly
    load_garally
  end
  #--------------------------------------------------------------------------
  # ● セーブの実行
  #--------------------------------------------------------------------------
  alias save_game_exgarally save_game
  def save_game(index)
    r = save_game_exgarally(index)
    save_garally if r
    r
  end
  #--------------------------------------------------------------------------
  # ● ロードの実行
  #--------------------------------------------------------------------------
  alias load_game_exgrly load_game
  def load_game(index)
    r = load_game_exgrly(index)
    load_garally if r
    r
  end
  #--------------------------------------------------------------------------
  # ● ギャラリー情報load
  #--------------------------------------------------------------------------
  def load_garally
    @exgarally = ExGarally.load_exdata
  end
  #--------------------------------------------------------------------------
  # ● ギャラリー情報load
  #--------------------------------------------------------------------------
  def save_garally
    ExGarally.save_exdata(@exgarally)
  end
  #--------------------------------------------------------------------------
  # ● ギャラリー情報削除
  #--------------------------------------------------------------------------
  def delete_garally
    ExGarally.delete_exdata
    load_garally
  end
  #--------------------------------------------------------------------------
  # ● ギャラリー情報参照
  #--------------------------------------------------------------------------
  def garally
    @exgarally
  end
end


#==============================================================================
# ■ Game_ExGarally
#==============================================================================
class Game_ExGarally
  attr_accessor :name   # ファイル名
  attr_accessor :text   # 表示文字
  attr_accessor :enable # 表示可否
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(file, enable=false)
    @name   = file.name
    @text   = file.text
    @enable = enable
  end
end

#==============================================================================
# ■ Game_ExGarallyList  : DataManager.garallyで参照可能
#==============================================================================
class Game_ExGarallyList
  LIST = ExGarally::LIST
  attr_accessor :enable
  attr_reader   :size
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    clear
  end
  #--------------------------------------------------------------------------
  # ● クリア
  #--------------------------------------------------------------------------
  def clear
    @size = LIST.size
    @data = {}
    @enable = false
  end
  #--------------------------------------------------------------------------
  # ● 参照
  #--------------------------------------------------------------------------
  def [](id)
    return nil if LIST[id].nil? and @data[id].nil?
    return Game_ExGarally.new(LIST[id]) if @data[id].nil?
    @data[id]
  end
  #--------------------------------------------------------------------------
  # ● 表示許可/禁止
  #--------------------------------------------------------------------------
  def []=(id, val)
    return nil if LIST[id].nil? and @data[id].nil?
    if val
      @data[id] = Game_ExGarally.new(LIST[id]) if @data[id].nil?
      @data[id].enable = true
    elsif !@data[id].nil?
      @data.delete(id)
    end
  end
  #--------------------------------------------------------------------------
  # ● リスト
  #--------------------------------------------------------------------------
  def list
    (@data.keys+LIST.keys).uniq.sort.collect {|id| self.[](id) }
  end
  #--------------------------------------------------------------------------
  # ● 追加ギャラリー
  #--------------------------------------------------------------------------
  def push(id, name, enable=true)
    @data[id] = Game_ExGarally.new(name, enable)
    @size += 1 if LIST[id].nil?
  end
end


#==============================================================================
# ■ Sprite_ExGrlyPicture
#==============================================================================
class Sprite_ExGrlyPicture < Sprite
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(rect=Rect.new(0,0,Graphics.width,Graphics.height))
    super(Viewport.new(rect))
    viewport.z = 100
    create_bitmap
  end
  #--------------------------------------------------------------------------
  # ● オブジェクト解放
  #--------------------------------------------------------------------------
  def dispose
    dispose_bitmap
    super
  end
  #--------------------------------------------------------------------------
  # ● ビットマップ生成
  #--------------------------------------------------------------------------
  def create_bitmap
    self.bitmap = Bitmap.new(vw, vh)
  end
  #--------------------------------------------------------------------------
  # ● ビットマップ下方
  #--------------------------------------------------------------------------
  def dispose_bitmap
    self.bitmap.dispose
  end
  #--------------------------------------------------------------------------
  # ● ピクチャ設定
  #--------------------------------------------------------------------------
  def picture(filename, enabled=true)
    dispose_bitmap
    if enabled
      self.bitmap = Cache.picture(filename)
    else
      create_bitmap
      self.bitmap.fill_rect(0,0,vw,vh,Color.new(0,0,0,160))
#      self.bitmap.draw_text(0,0, vw, vh, filename, 1)
    end
    fit_screen
    resize
  end
  #--------------------------------------------------------------------------
  # ● ズーム倍率再設定
  #--------------------------------------------------------------------------
  def resize(r=Rect.new(0,0,vw,vh))
    self.ox = bitmap.width  / 2
    self.oy = bitmap.height / 2
    self.x = r.width  / 2 + r.x
    self.y = r.height / 2 + r.y
  end
  #--------------------------------------------------------------------------
  # ● 画面にフィットさせる
  #--------------------------------------------------------------------------
  def bwz;  (bitmap.width * zoom_x).truncate; end # ズーム後のbitmap幅
  def bhz;  (bitmap.height* zoom_y).truncate; end # ズーム後のbitmap高さ
  def vw;   viewport.rect.width;   end
  def vh;   viewport.rect.height;  end
  def fit_screen(w=vw, h=vh)
    x_zoom = w * 1.0 / bitmap.width
    y_zoom = h * 1.0 / bitmap.height
    zoom = x_zoom < y_zoom ? x_zoom : y_zoom
    self.zoom_x = self.zoom_y = zoom
  end
end


#==============================================================================
# ■ Sprite_ExGrlyPicture
#==============================================================================
class Sprite_ExGrlyPictFull < Sprite_ExGrlyPicture
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super
    hide.viewport.z = 200
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウの表示
  #--------------------------------------------------------------------------
  def show
    self.visible = true
    self
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウの非表示
  #--------------------------------------------------------------------------
  def hide
    self.visible = false
    self
  end
  #--------------------------------------------------------------------------
  # ● ピクチャ設定
  #--------------------------------------------------------------------------
  def picture(filename, enabled=true)
    dispose_bitmap
    b = Cache.picture(filename)
    r = Rect.new(0, 0, b.width, b.height)
    self.bitmap = Bitmap.new(r.width, r.height)
    self.bitmap.stretch_blt(r, b, r)
    fit_screen
    resize
  end
end

#==============================================================================
# ■ Grly_Thumbnail
#==============================================================================
class Grly_Thumbnail
  attr_reader :item
  attr_reader :rect
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(item, rect)
    @item = item; @rect = rect
  end
end

#==============================================================================
# ■ SpritesetExGrlyPictures
#==============================================================================
class SpritesetExGrlyPictures
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @sprites = []
  end
  #--------------------------------------------------------------------------
  # ● オブジェクト解放
  #--------------------------------------------------------------------------
  def dispose
    dispose_sprites
  end
  #--------------------------------------------------------------------------
  # ● ピクチャスプライト生成
  #--------------------------------------------------------------------------
  def create_sprites(thumnails)
    thumnails.each do |thm|
      s = Sprite_ExGrlyPicture.new(thm.rect)
      s.picture(thm.item.name, thm.item.enable)
      @sprites.push(s)
    end
  end
  #--------------------------------------------------------------------------
  # ● ピクチャスプライト解放
  #--------------------------------------------------------------------------
  def dispose_sprites
    @sprites.each { |s| s.dispose }
  end
  #--------------------------------------------------------------------------
  # ● ピクチャスプライト更新
  #--------------------------------------------------------------------------
  def update_sprites(thumnails)
    dispose_sprites
    create_sprites(thumnails)
  end
  #--------------------------------------------------------------------------
  # ● サムネイル矩形
  #--------------------------------------------------------------------------
  def thm_rect(i)
    @sprites.nil? ? nil : @sprites.thm
  end
end


#==============================================================================
# ■ Window_GrlyPicture
#==============================================================================
class Window_GrlyPicture < Window_Selectable
  attr_accessor :thum_sprites
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @thum_sprites = nil
    make_list
    super(0, help_height, Graphics.width, Graphics.height-help_height)
    activate
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウの高さ
  #--------------------------------------------------------------------------
  def help_height
    fitting_height(ExGarally::HELP_LINES)
  end
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    return 3
  end
  #--------------------------------------------------------------------------
  # ● 横に項目が並ぶときの空白の幅を取得
  #--------------------------------------------------------------------------
  def spacing
    return 16
  end
  #--------------------------------------------------------------------------
  # ● 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    DataManager.garally.size
  end
  #--------------------------------------------------------------------------
  # ● 項目の高さを取得
  #--------------------------------------------------------------------------
  def item_height
    (Graphics.height - help_height - standard_padding * 2) / 2
  end
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    thm  = calc_thm_rect
    rect.x += (rect.width  - (thm.width  + 8)) / 2
    rect.y += (rect.height - (thm.height + 8)) / 2
    rect.width  = thm.width  + 8
    rect.height = thm.height + 8
    rect
  end
  #--------------------------------------------------------------------------
  # ● サムネイル矩形計算
  #--------------------------------------------------------------------------
  def calc_thm_rect
    r = Rect.new
    r.width  = item_width  - 8
    r.height = item_height - 8
    if (Graphics.width  / r.width) > (Graphics.height / r.height)
      r.height = r.width  * Graphics.height / Graphics.width
    else
      r.width  = r.height * Graphics.width  / Graphics.height
    end
    r
  end
  #--------------------------------------------------------------------------
  # ● サムネイルの表示位置を取得
  #--------------------------------------------------------------------------
  def thum_rect(index)
    r = item_rect_for_text(index)
    r.x += self.x + standard_padding
    r.y += self.y + standard_padding
    r
  end
  #--------------------------------------------------------------------------
  # ● 先頭行のindex
  #--------------------------------------------------------------------------
  def top_i
    (top_row * col_max)
  end
  #--------------------------------------------------------------------------
  # ● 先頭行からの@index
  #--------------------------------------------------------------------------
  def top_cur_i
    (@index - (top_row * col_max))
  end
  #--------------------------------------------------------------------------
  # ● サムネイルの表示位置を取得
  #--------------------------------------------------------------------------
  def thumnails
    n = [page_item_max, item_max - top_i].min
    idxs = []
    n.times { |i| idxs.push(i) }
    idxs.collect { |i| Grly_Thumbnail.new(@list[i+top_i], thum_rect(i)) }
  end
  #--------------------------------------------------------------------------
  # ● リスト生成
  #--------------------------------------------------------------------------
  def make_list
    @list = DataManager.garally.list
  end
  #--------------------------------------------------------------------------
  # ● 選択中アイテム
  #--------------------------------------------------------------------------
  def item
    @list[@index]
  end
  #--------------------------------------------------------------------------
  # ● 選択項目の有効状態を取得
  #--------------------------------------------------------------------------
  def current_item_enabled?
    !item.nil? and item.enable
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    text = ((!item.nil? and item.enable) ? item.text : "")
    @help_window.set_text(text)
  end
  #--------------------------------------------------------------------------
  # ● カーソルの更新
  #--------------------------------------------------------------------------
  def update_cursor
    super
    @thum_sprites.update_sprites(thumnails) unless @thum_sprites.nil?
  end
end



#==============================================================================
# ■ Scene_ExGarally
#==============================================================================
class Scene_ExGarally < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    create_background
    @help_window = Window_Help.new(ExGarally::HELP_LINES)
    @thumset = SpritesetExGrlyPictures.new
    @full_pict = Sprite_ExGrlyPictFull.new
    create_list_window
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_background
    @thumset.dispose
    @full_pict.dispose
  end
  #--------------------------------------------------------------------------
  # ● 背景の作成
  #--------------------------------------------------------------------------
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.background_bitmap
    @background_sprite.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # ● 背景の解放
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● ピクチャリストウィンドウ生成
  #--------------------------------------------------------------------------
  def create_list_window
    @list_window = Window_GrlyPicture.new
    @list_window.thum_sprites = @thumset
    @list_window.help_window = @help_window
    set_full_handler
    @list_window.select(0)
  end
  #--------------------------------------------------------------------------
  # ● フルスクリーン化用のハンドラ登録
  #--------------------------------------------------------------------------
  def set_full_handler
    @list_window.set_handler(:ok,     method(:cmd_full))
    @list_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● サムネイルリスト用のハンドラ登録
  #--------------------------------------------------------------------------
  def set_thum_handler
    @list_window.set_handler(:ok,     method(:cmd_thum))
    @list_window.set_handler(:cancel, method(:cmd_thum))
  end
  #--------------------------------------------------------------------------
  # ● フルスクリーン化
  #--------------------------------------------------------------------------
  def cmd_full
    Graphics.freeze
    @full_pict.show.picture(@list_window.item.name)
    perform_transition
    set_thum_handler
    @list_window.activate.cursor_fix = true
  end
  #--------------------------------------------------------------------------
  # ● サムネイル化
  #--------------------------------------------------------------------------
  def cmd_thum
    Graphics.freeze
    @full_pict.hide
    perform_transition
    set_full_handler
    @list_window.activate.cursor_fix = false
  end
end





#module Title
  # 拡張コマンドへ追加
  #EXCMD[3] = ["画廊", Scene_ExGarally, :garally]

  # コマンド画像ファイル(Graphics/System)
  # CMD_GRPHIC[コマンド番号] [画像1, 画像2]
  #CMD_GRPHIC[3] = ["garally",  "garally_s"]
#end

#==============================================================================
# ■ Scene_ExGarally
#==============================================================================
class Scene_ExGarally < Scene_Base
  #--------------------------------------------------------------------------
  # ● 呼び出し元のシーンへ戻る
  #--------------------------------------------------------------------------
  def return_scene
    super
    return unless SceneManager.scene_is?(Scene_Title)
    SceneManager.scene.prepare(Title::Scene::S_TITLE, false,
                               Title::CMD_BOX.index(4))
  end
end


#==============================================================================
# ■ Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ● メイン
  #--------------------------------------------------------------------------
  alias main_reload main
  def main
    DataManager.load_garally # ギャラリーのリロード
    main_reload
  end
end[/pre]

点评

这个是脚本冲突的问题..不看到脚本的话我也不确定能够解决.  发表于 2013-3-23 18:39
回复

使用道具 举报

梦石
0
星屑
266
在线时间
2355 小时
注册时间
2009-3-13
回帖
2257

贵宾

 楼主| 发表于 2013-3-23 18:41:55 | 显示全部楼层
本帖最后由 Sion 于 2013-10-28 18:58 编辑
ayano2k 发表于 2013-3-20 16:34
感谢楼主的脚本,很好用~~
但是这个功能想知道该怎么设置??
  [[  1.3a: 代码小修改;


[pre lang="ruby" line="1"]=begin ========================================================================

  八方移动补丁 置于Sion_Mouse_System脚本下

  2013.10.28 v1.2 鼠标2.0+更新修正
  2013.5.3 v1.1 修正斜向触发事件
  
=end #=========================================================================

class Game_Player
  # ───────────────────────────────────────
  #  † 八方移动
  # ───────────────────────────────────────
  def move_by_input
    return if !movable? || $game_map.interpreter.running?
    case Input.dir8
    when 2,4,6,8; move_straight(Input.dir8)
    when 1
      if diagonal_passable?(x, y, 4, 2); move_diagonal(4, 2)
      elsif passable?(x, y, 4); move_straight(4)
      else; move_straight(2)
      end
    when 3
      if diagonal_passable?(x, y, 6, 2); move_diagonal(6, 2)
      elsif passable?(x, y, 6); move_straight(6)
      else; move_straight(2)
      end
    when 7
      if diagonal_passable?(x, y, 4, 8); move_diagonal(4, 8)
      elsif passable?(x, y, 4); move_straight(4)
      else; move_straight(8)
      end
    when 9
      if diagonal_passable?(x, y, 6, 8); move_diagonal(6, 8)
      elsif passable?(x, y, 6); move_straight(6)
      else; move_straight(6)
      end
    else;   move_by_mouse
    end
  end
  # ───────────────────────────────────────
  #  † 鼠标八方移动
  # ───────────────────────────────────────
  def move_by_mouse
    unless @mouse_move_path.empty? # 移动路线数组不为空则执行移动
      dir = @mouse_move_path.shift
      if passable?(x, y, dir) && !@mouse_move_path.empty?
        if @mouse_move_path[0] == dir
          move_straight(dir)
        else
          if @mouse_move_path.size == 1 &&
              touch_event?(x, y, dir, @mouse_move_path[0])
            move_straight(dir)
          elsif dir == 4 || dir == 6
            move_diagonal(dir, @mouse_move_path.shift)
          else
            move_diagonal(@mouse_move_path.shift, dir)
          end
        end
      elsif @mouse_move_path.empty? # 判断是否是最后一步
        x2 = $game_map.round_x_with_direction(x, dir)
        y2 = $game_map.round_y_with_direction(y, dir)
        move_straight(dir) unless dir.zero?
        unless x == x2 && y == y2 # 如果移动失败,检查是否启动前方事件、上下载具
          check_event_trigger_there([0,1,2])
          get_on_off_vehicle unless $game_map.setup_starting_event
        end
        $mouse_move_sign.transparent = true if $mouse_move_sign.direction == 2
        @mouse_dash = false
      elsif @mouse_move_path[0].zero? # 目标点无法抵达,调整朝向→目标点
        @mouse_move_path.shift
        @direction = dir
        @mouse_dash = false
      else
        draw_move_path
      end
    end
  end
  def touch_event?(x, y, dir, dir_)
    x = $game_map.round_x_with_direction(
      $game_map.round_x_with_direction(x, dir), dir_)
    y = $game_map.round_y_with_direction(
      $game_map.round_y_with_direction(y, dir), dir_)
    if collide_with_events?(x, y)
      return x, y
    else
      return nil, nil
    end
  end
  # ───────────────────────────────────────
  #  † 步行路径
  # ───────────────────────────────────────
  def draw_walk_path
    # 准备绘制路径表格
    sheet = Table.new($game_map.width, $game_map.height)
    chase_path  = []
    new_end_points = [@moveto_x, @moveto_y]
    sheet[@moveto_x, @moveto_y] = 1
    reach_point = false
    step = 2
    loop do #loop1 开始填充表格
      draw_path = false
      check_points = new_end_points
      new_end_points = []
      break if step > KsOfSion::Break_Steps &&
               !Input.press?(KsOfSion::Find_Path_Key)
      loop do #loop3 从终点开始反向填充
        point_x = check_points.shift
        break if point_x == nil
        point_y = check_points.shift
        # 判断路径是否连通
        if point_x == x && point_y == y
          reach_point = true; break; end
        # 以需要抵达该点的步数填充路径表格 #
        left_x  = $game_map.round_x(point_x - 1)
        right_x = $game_map.round_x(point_x + 1)
        up_y    = $game_map.round_y(point_y - 1)
        down_y  = $game_map.round_y(point_y + 1)
        if sheet[left_x, point_y] == 0              &&
           $game_map.passable?(left_x, point_y, 6)  &&
           !collide_with_events?(left_x, point_y)   &&
           $game_map.passable?(point_x, point_y, 4) &&
           !collide_with_vehicles?(left_x, point_y) #judge_end
          sheet[left_x, point_y] = step
          draw_path = true
          new_end_points.push(left_x, point_y)
        end
        if sheet[right_x, point_y] == 0             &&
           $game_map.passable?(right_x, point_y, 4) &&
           !collide_with_events?(right_x, point_y)  &&
           $game_map.passable?(point_x, point_y, 6) &&
           !collide_with_vehicles?(right_x, point_y)#judge_end
          sheet[right_x, point_y] = step
          draw_path = true
          new_end_points.push(right_x, point_y)
        end
        if sheet[point_x, up_y] == 0                &&
           $game_map.passable?(point_x, up_y, 2)    &&
           !collide_with_events?(point_x, up_y)     &&
           $game_map.passable?(point_x, point_y, 8) &&
           !collide_with_vehicles?(point_x, up_y)   #judge_end
          sheet[point_x, up_y] = step
          draw_path = true
          new_end_points.push(point_x, up_y)
        end
        if sheet[point_x, down_y] == 0              &&
           $game_map.passable?(point_x, down_y, 8)  &&
           !collide_with_events?(point_x, down_y)   &&
           $game_map.passable?(point_x, point_y, 2) &&
           !collide_with_vehicles?(point_x, down_y) #judge_end
          sheet[point_x, down_y] = step
          draw_path = true
          new_end_points.push(point_x, down_y)
        end
      end#endOfLoop3
      break if !draw_path || reach_point
      step += 1
    end #endOfLoop1 路径表格填充完毕
    $mouse_move_sign.transparent = false
    # 判断指定地点能否抵达
    if reach_point
      $mouse_move_sign.direction = 2
    else
      return not_reach_point
    end
    # 根据路径表格绘制最短移动路径(正向)
    step -= 1 # 因为需要再填充一次才能判定是否抵达
    point_x, point_y = x, y
    for i in 2..step
    step -= 1
    if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
      if    sheet[point_x, $game_map.round_y(point_y + 1)] == step          &&
            $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
            $game_map.passable?(point_x, point_y, 2)                #judge_end
        chase_path.push(2)
        point_y = $game_map.round_y(point_y + 1)
      elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step          &&
            $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
            $game_map.passable?(point_x, point_y, 8)                #judge_end
        chase_path.push(8)
        point_y = $game_map.round_y(point_y - 1)
      elsif sheet[$game_map.round_x(point_x - 1), point_y] == step          &&
            $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
            $game_map.passable?(point_x, point_y, 4)                #judge_end
        chase_path.push(4)
        point_x = $game_map.round_x(point_x - 1)
      elsif sheet[$game_map.round_x(point_x + 1), point_y] == step          &&
            $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
            $game_map.passable?(point_x, point_y, 6)                #judge_end
        chase_path.push(6)
        point_x = $game_map.round_x(point_x + 1)
      end
    else
      if    sheet[$game_map.round_x(point_x - 1), point_y] == step          &&
            $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
            $game_map.passable?(point_x, point_y, 4)                #judge_end
        chase_path.push(4)
        point_x = $game_map.round_x(point_x - 1)
      elsif sheet[$game_map.round_x(point_x + 1), point_y] == step          &&
            $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
            $game_map.passable?(point_x, point_y, 6)                #judge_end
        chase_path.push(6)
        point_x = $game_map.round_x(point_x + 1)
      elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step          &&
            $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
            $game_map.passable?(point_x, point_y, 2)                #judge_end
        chase_path.push(2)
        point_y = $game_map.round_y(point_y + 1)
      elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step          &&
            $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
            $game_map.passable?(point_x, point_y, 8)                #judge_end
        chase_path.push(8)
        point_y = $game_map.round_y(point_y - 1)
      end
    end
    end#endOfForLoop
    return chase_path
  end#walk
  # ───────────────────────────────────────
  #  † boat路径
  # ───────────────────────────────────────
  def draw_boat_path
    # 准备绘制路径表格
    sheet = Table.new($game_map.width, $game_map.height)
    chase_path  = []
    new_end_points = [@moveto_x, @moveto_y]
    sheet[@moveto_x, @moveto_y] = 1
    reach_point = false
    step = 2
    loop do #loop1 开始填充表格
      draw_path = false
      check_points = new_end_points
      new_end_points = []
      break if step > KsOfSion::Break_Steps &&
               !Input.press?(KsOfSion::Find_Path_Key)
      loop do #loop3 从终点开始反向填充
        point_x = check_points.shift
        break if point_x == nil
        point_y = check_points.shift
        left_x  = $game_map.round_x(point_x - 1)
        right_x = $game_map.round_x(point_x + 1)
        up_y    = $game_map.round_y(point_y - 1)
        down_y  = $game_map.round_y(point_y + 1)
        # 判断路径是否连通
        if left_x == x && point_y == y
          reach_point = true; break
        elsif right_x == x && point_y == y
          reach_point = true; break
        elsif point_x == x && up_y == y
          reach_point = true; break
        elsif point_x == x && down_y == y
          reach_point = true; break
        end
        # 以需要抵达该点的步数填充路径表格 #
        if sheet[left_x, point_y] == 0                &&
           $game_map.boat_passable?(left_x, point_y)  &&
           !collide_with_events?(left_x, point_y)     &&
           !collide_with_vehicles?(left_x, point_y)   #judge_end
          sheet[left_x, point_y] = step
          draw_path = true
          new_end_points.push(left_x, point_y)
        end
        if sheet[right_x, point_y] == 0               &&
           $game_map.boat_passable?(right_x, point_y) &&
           !collide_with_events?(right_x, point_y)    &&
           !collide_with_vehicles?(right_x, point_y)  #judge_end
          sheet[right_x, point_y] = step
          draw_path = true
          new_end_points.push(right_x, point_y)
        end
        if sheet[point_x, up_y] == 0                  &&
           $game_map.boat_passable?(point_x, up_y)    &&
           !collide_with_events?(point_x, up_y)       &&
           !collide_with_vehicles?(point_x, up_y)     #judge_end
          sheet[point_x, up_y] = step
          draw_path = true
          new_end_points.push(point_x, up_y)
        end
        if sheet[point_x, down_y] == 0                &&
           $game_map.boat_passable?(point_x, down_y)  &&
           !collide_with_events?(point_x, down_y)     &&
           !collide_with_vehicles?(point_x, down_y)   #judge_end
          sheet[point_x, down_y] = step
          draw_path = true
          new_end_points.push(point_x, down_y)
        end
      end#endOfLoop3
      break if !draw_path || reach_point
      step += 1
    end #endOfLoop1 路径表格填充完毕
    $mouse_move_sign.transparent = false
    # 判断指定地点能否抵达
    if reach_point
      $mouse_move_sign.direction = 2
    else
      return not_reach_point
    end
    # 根据路径表格绘制最短移动路径(正向)
    point_x, point_y = x, y
    for i in 2..step # forLoop
    step -= 1
    if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
      if    sheet[point_x, $game_map.round_y(point_y + 1)] == step
        chase_path.push(2)
        point_y = $game_map.round_y(point_y + 1)
      elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
        chase_path.push(8)
        point_y = $game_map.round_y(point_y - 1)
      elsif sheet[$game_map.round_x(point_x - 1), point_y] == step
        chase_path.push(4)
        point_x = $game_map.round_x(point_x - 1)
      elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
        chase_path.push(6)
        point_x = $game_map.round_x(point_x + 1)
      end
    else
      if    sheet[$game_map.round_x(point_x - 1), point_y] == step
        chase_path.push(4)
        point_x = $game_map.round_x(point_x - 1)
      elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
        chase_path.push(6)
        point_x = $game_map.round_x(point_x + 1)
      elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step
        chase_path.push(2)
        point_y = $game_map.round_y(point_y + 1)
      elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
        chase_path.push(8)
        point_y = $game_map.round_y(point_y - 1)
      end
    end
    end #endOfForLoop
    # 如果指定点无法抵达或者登陆
    return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
    return chase_path
  end#boat
  # ───────────────────────────────────────
  #  † ship路径
  # ───────────────────────────────────────
  def draw_ship_path
    # 准备绘制路径表格
    sheet = Table.new($game_map.width, $game_map.height)
    chase_path  = []
    new_end_points = [@moveto_x, @moveto_y]
    sheet[@moveto_x, @moveto_y] = 1
    reach_point = false
    step = 2
    loop do #loop1 开始填充表格
      draw_path = false
      check_points = new_end_points
      new_end_points = []
      break if step > KsOfSion::Break_Steps &&
               !Input.press?(KsOfSion::Find_Path_Key)
      loop do #loop3 从终点开始反向填充
        point_x = check_points.shift
        break if point_x == nil
        point_y = check_points.shift
        left_x  = $game_map.round_x(point_x - 1)
        right_x = $game_map.round_x(point_x + 1)
        up_y    = $game_map.round_y(point_y - 1)
        down_y  = $game_map.round_y(point_y + 1)
        # 判断路径是否连通
        if left_x == x && point_y == y
          reach_point = true; break
        elsif right_x == x && point_y == y
          reach_point = true; break
        elsif point_x == x && up_y == y
          reach_point = true; break
        elsif point_x == x && down_y == y
          reach_point = true; break
        end
        # 以需要抵达该点的步数填充路径表格 #
        if sheet[left_x, point_y] == 0                &&
           $game_map.ship_passable?(left_x, point_y)  &&
           !collide_with_events?(left_x, point_y)     &&
           !collide_with_vehicles?(left_x, point_y)   #judge_end
          sheet[left_x, point_y] = step
          draw_path = true
          new_end_points.push(left_x, point_y)
        end
        if sheet[right_x, point_y] == 0               &&
           $game_map.ship_passable?(right_x, point_y) &&
           !collide_with_events?(right_x, point_y)    &&
           !collide_with_vehicles?(right_x, point_y)  #judge_end
          sheet[right_x, point_y] = step
          draw_path = true
          new_end_points.push(right_x, point_y)
        end
        if sheet[point_x, up_y] == 0                  &&
           $game_map.ship_passable?(point_x, up_y)    &&
           !collide_with_events?(point_x, up_y)       &&
           !collide_with_vehicles?(point_x, up_y)     #judge_end
          sheet[point_x, up_y] = step
          draw_path = true
          new_end_points.push(point_x, up_y)
        end
        if sheet[point_x, down_y] == 0                &&
           $game_map.ship_passable?(point_x, down_y)  &&
           !collide_with_events?(point_x, down_y)     &&
           !collide_with_vehicles?(point_x, down_y)   #judge_end
          sheet[point_x, down_y] = step
          draw_path = true
          new_end_points.push(point_x, down_y)
        end
      end#endOfLoop3
      break if !draw_path || reach_point
      step += 1
    end #endOfLoop1 路径表格填充完毕
    $mouse_move_sign.transparent = false
    # 判断指定地点能否抵达
    if reach_point
      $mouse_move_sign.direction = 2
    else
      not_reach_point
      return
    end
    # 根据路径表格绘制最短移动路径(正向)
    point_x, point_y = x, y
    for i in 2..step
    step -= 1
    if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
      if    sheet[point_x, $game_map.round_y(point_y + 1)] == step
        chase_path.push(2)
        point_y = $game_map.round_y(point_y + 1)
      elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
        chase_path.push(8)
        point_y = $game_map.round_y(point_y - 1)
      elsif sheet[$game_map.round_x(point_x - 1), point_y] == step
        chase_path.push(4)
        point_x = $game_map.round_x(point_x - 1)
      elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
        chase_path.push(6)
        point_x = $game_map.round_x(point_x + 1)
      end
    else
      if    sheet[$game_map.round_x(point_x - 1), point_y] == step
        chase_path.push(4)
        point_x = $game_map.round_x(point_x - 1)
      elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
        chase_path.push(6)
        point_x = $game_map.round_x(point_x + 1)
      elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step
        chase_path.push(2)
        point_y = $game_map.round_y(point_y + 1)
      elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
        chase_path.push(8)
        point_y = $game_map.round_y(point_y - 1)
      end
    end
    end #endOfForLoop
    # 如果指定点无法抵达或者登陆
    return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
    return chase_path
  end#ship
end[/pre]

点评

GJ~大感谢阿!!  发表于 2013-3-24 18:37
脚本补在28L了,麻烦抽空帮我看看。多谢了!  发表于 2013-3-24 09:38

评分

参与人数 1星屑 +45 收起 理由
黑舞嗜 + 45 赞美LZ

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
381 小时
注册时间
2012-8-13
回帖
103
发表于 2013-3-25 10:49:22 | 显示全部楼层
Sion 发表于 2013-3-23 22:41
8方移动补丁,不需要原来那个了,自己写了个。

发生冲突的脚本我补在28L了,麻烦抽空帮我看看是什么问题吧。多谢了!

点评

这个“画廊”脚本要怎么使用呢?  发表于 2013-3-25 14:29
回复

使用道具 举报

梦石
0
星屑
50
在线时间
381 小时
注册时间
2012-8-13
回帖
103
发表于 2013-3-25 18:37:10 | 显示全部楼层
tyq4590 发表于 2013-3-25 14:49
发生冲突的脚本我补在28L了,麻烦抽空帮我看看是什么问题吧。多谢了!

1.Graphics\Pictures\里放入和‘module ExGarally’下设定的文件名相同的图片(放一张就可以测试了),比如:
  1  => GFile.new("BlueSky", "123"), 然后在Graphics\Pictures\放一个叫"BlueSky"的图片

2.在事件里添加脚本:DataManager.garally[1] = true 来解锁画廊里的1号图片

3.在事件里添加脚本:SceneManager.call(Scene_ExGarally)来打开画廊(这个时候应该可以看到第一张图片"BlueSky"了,然后用鼠标点该图片会打开大图,就是这个时候会报错跳出)

点评

万分感谢!  发表于 2013-3-28 11:21
附件更新,可以了  发表于 2013-3-26 19:36
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部