设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 47|回复: 0
打印 上一主题 下一主题

[有事请教] 强化镜头脚本与VXAce_SP1官方补丁产生冲突,导致动画错位

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1216
在线时间
197 小时
注册时间
2019-9-17
帖子
24
跳转到指定楼层
1
发表于 昨天 11:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
60星屑
求助各位大佬,在移动镜头(包括移动时移动镜头)时和移动镜头后一段时间播放动画,会导致动画错位。


强化镜头脚本:
RUBY 代码复制
  1. =begin
  2. ╔════╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═════╗
  3. ║ ╔══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╗ ║
  4. ╠─╣                            强化镜头功能                             ╠─╣
  5. ╠─╣                           by RPG Maker Source.                           ╠─╣
  6. ╠─╣                          [url]www.rpgmakersource.com[/url]                          ╠─╣
  7. ║ ╚══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╝ ║
  8. ╠════╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═════╣
  9. ║ ┌────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴─────┐ ║
  10. ╠─┤ Version 1.0.1                   13/12/14                        DD/MM/YY ├─╣
  11. ║ └────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┘ ║
  12. ╠══════╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══════╣
  13. ║                                                                              ║
  14. ║               This work is protected by the following license:               ║
  15. ║     ╔══════════════════════════════════════════════════════════════════╗     ║
  16. ║     │                                                                  │     ║
  17. ║     │ Copyright ? 2014 Maker Systems.                                  │     ║
  18. ║     │                                                                  │     ║
  19. ║     │ This software is provided 'as-is', without any kind of           │     ║
  20. ║     │ warranty. Under no circumstances will the author be held         │     ║
  21. ║     │ liable for any damages arising from the use of this software.    │     ║
  22. ║     │                                                                  │     ║
  23. ║     │ Permission is granted to anyone to use this software on their    │     ║
  24. ║     │ free or commercial games made with a legal copy of RPG Maker     │     ║
  25. ║     │ VX Ace, as long as Maker Systems - RPG Maker Source is           │     ║
  26. ║     │ credited within the game.                                        │     ║
  27. ║     │                                                                  │     ║
  28. ║     │ Selling this code or any portions of it 'as-is' or as part of    │     ║
  29. ║     │ another code, is not allowed.                                    │     ║
  30. ║     │                                                                  │     ║
  31. ║     │ The original header, which includes this copyright notice,       │     ║
  32. ║     │ must not be edited or removed from any verbatim copy of the      │     ║
  33. ║     │ sotware nor from any edited version.                             │     ║
  34. ║     │                                                                  │     ║
  35. ║     ╚══════════════════════════════════════════════════════════════════╝     ║
  36. ║                                                                              ║
  37. ║                                                                              ║
  38. ╠══════════════════════════════════════════════════════════════════════════════╣
  39. ║ 1. VERSION HISTORY.                                                        ▼ ║
  40. ╠══════════════════════════════════════════════════════════════════════════════╣
  41. ║                                                                              ║
  42. ║ ? Version 1.0.0, 08/12/14 - (DD/MM/YY).                                      ║
  43. ║                                                                              ║
  44. ║ ? Version 1.0.1, 13/12/14 - (DD/MM/YY).                                      ║
  45. ║                                                                              ║
  46. ╠══════════════════════════════════════════════════════════════════════════════╣
  47. ╠══════════════════════════════════════════════════════════════════════════════╣
  48. ║ 2. USER MANUAL.                                                            ▼ ║
  49. ╠══════════════════════════════════════════════════════════════════════════════╣
  50. ║                                                                              ║
  51. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  52. ║ │ ■ 说明.                                                          │ ║
  53. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  54. ║                                                                              ║
  55. ║  功能如下:
  56.     1、镜头平滑移动
  57.     2、镜头跟随事件
  58.     3、镜头固定                                  ║
  59. ║                                                                              ║
  60. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  61. ║ │ ■ Configuration.                                                         │ ║
  62. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  63. ║                                                                              ║
  64. ║  "How do I change the strength of the deceleration effect?"                  ║
  65. ║  Right click anywhere in the script editor and select "Find" (or CTRL + F)   ║
  66. ║  search for "Deceleration_Value" (without quotation marks).                  ║
  67. ║                                                                              ║
  68. ║  You will see something like "Deceleration_Value = 22"                       ║
  69. ║                                                                              ║
  70. ║  Set the number after the equality sign to any numer you like, bigger or     ║
  71. ║  equal than 1. The bigger the number, the stronger the deceleration effect   ║
  72. ║  and thus the slower the camera movement when following the player. Small    ║
  73. ║  numbers result in a faster deceleration, default value is 22.               ║
  74. ║                                                                              ║
  75. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  76. ║ │ ■ 具体功能.                                                 │ ║
  77. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  78. ║                                                                              ║
  79. ║  可用脚本:                                 ║
  80. ║                                                                              ║
  81. ║  ┌───────────────────────────────┐                                           ║
  82. ║  │ ms_pro_cam_wait_for_scrolling │                                           ║
  83. ║  ├───────────────────────────────┴────────────────────────────────────────┐  ║
  84. ║  │ 开启:等待直至镜头移动结束
  85.        意思是镜头移动结束后,才会执行下一个事件指令
  86.        对默认的地图滚动、本脚本中镜头移动的呼出脚本两者都有效.                                                    │  ║
  87. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  88. ║  ┌────────────────────────────────────┐                                      ║
  89. ║  │ ms_pro_cam_center_at(x, y, 时间) │                                      ║
  90. ║  ├────────────────────────────────────┴───────────────────────────────────┐  ║
  91. ║  │ 镜头中心移动到(x,y)坐标处,时间的单位是帧
  92. ║  │                                                                        │  ║
  93. ║  │ 注意: 同样适用于循环地图. 通常情况下,如果你从地图左上角移动镜头到左下角,
  94.        镜头会经过画面中心处.    │  ║
  95. ║  │ 但如果你的地图是循环地图,镜头会寻找最短的移动路径,不经过画面中心              │  ║
  96. ║  │                                                                        │  ║
  97. ║  │ 例子: 镜头中心移动到(44,44)处,用时6秒     │  ║
  98. ║  │                                                                        │  ║
  99. ║  │ ms_pro_cam_center_at(44, 44, 360)                                      │  ║
  100. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  101. ║  ┌───────────────────────────────────────┐                                   ║
  102. ║  │ ms_pro_cam_center_at_char(id, 时间) │                                   ║
  103. ║  ├───────────────────────────────────────┴────────────────────────────────┐  ║
  104. ║  │ 移动到目标处             │  ║
  105. ║  │                                                                        │  ║
  106. ║  │ (*) id = -1 时代表玩家, 0 代表当前事件, 1 或以上代表事件id.                               │  ║
  107. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  108. ║  ┌──────────────────────────────────────────┐                                ║
  109. ║  │ ms_pro_cam_focus_on(id, 可取消?, 按键) │                                ║
  110. ║  ├──────────────────────────────────────────┴─────────────────────────────┐  ║
  111. ║  │ 镜头跟随目标                                    │  ║
  112. ║  │                                                                        │  ║
  113. ║  │ 例子,镜头跟随22号事件: ms_pro_cam_focus_on(22)                                    │  ║
  114. ║  │                                                                        │  ║
  115. ║  │ 镜头跟随玩家:                 │  ║
  116. ║  │ ms_pro_cam_focus_on(-1)                                                │  ║
  117. ║  │                                                                        │  ║
  118. ║  │ (*) "可取消" 替换为 true 或 false,代表能否通过一个按键取消镜头跟随,并
  119.           自动将镜头目标跟随回玩家│  ║
  120. ║  │                                                                        │  ║
  121. ║  │ (*) "按键"是取消跟随镜头的按键,仅在"可取消?"设定为true时有效,默认为 :CTRL                                                      │  ║
  122. ║  │                                                                        │  ║
  123. ║  │ 默认可用按键:                         │  ║
  124. ║  │                                                                        │  ║
  125. ║  │ :DOWN :LEFT :RIGHT :UP (方向键)                                    │  ║
  126. ║  │ :A :B :C :X :Y :Z :L :R      │  ║
  127. ║  │ :SHIFT :CTRL :ALT                                                      │  ║
  128. ║  │ :F5 :F6 :F7 :F8 :F9                                                    │  ║
  129. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  130. ║  ┌─────────────────────────────────────┐                                     ║
  131. ║  │ ms_pro_cam_character_on_screen?(id) │                                     ║
  132. ║  ├─────────────────────────────────────┴──────────────────────────────────┐  ║
  133. ║  │ 检查事件是否在画面中.                              │  ║
  134. ║  │                                                                        │  ║
  135. ║  │ 可以用于分支条件中,例如检查代表小偷的事件是否在画面中,如果不在玩家
  136.        抓贼失败这样
  137.       
  138.        当然,id和之前一样,也可以代表玩家.                 │  ║
  139. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  140. ║  ┌──────────────────────┐                                                    ║
  141. ║  │ ms_pro_cam_reset_str │                                                    ║
  142. ║  ├──────────────────────┴─────────────────────────────────────────────────┐  ║
  143. ║  │ 设定镜头移动的速度为默认值 │  ║
  144. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  145. ║  ┌───────────────────────┐                                                   ║
  146. ║  │ ms_pro_cam_str(数值) │                                                   ║
  147. ║  ├───────────────────────┴────────────────────────────────────────────────┐  ║
  148. ║  │ 设定镜头移动加速度                                                             │  ║
  149. ║  │                                                                        │  ║
  150. ║  │ 数值越小,移动速度越快 (1 为默认速度)                                 │  ║
  151. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  152. ║  ┌──────────────────────────────────────┐                                    ║
  153. ║  │ ms_pro_cam_ignore_player(true/false) │                                    ║
  154. ║  ├──────────────────────────────────────┴─────────────────────────────────┐  ║
  155. ║  │ 镜头是否固定在地图上,不跟随玩家移动       │  ║
  156. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  157. ║  ┌────────────────────────┐                                                  ║
  158. ║  │ ms_pro_cam_lock_camera │                                                  ║
  159. ║  ├────────────────────────┴───────────────────────────────────────────────┐  ║
  160. ║  │ 锁定镜头                                                         │  ║
  161. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  162. ║  ┌──────────────────────────┐                                                ║
  163. ║  │ ms_pro_cam_unlock_camera │                                                ║
  164. ║  ├──────────────────────────┴─────────────────────────────────────────────┐  ║
  165. ║  │ 解锁镜头                 │  ║
  166. ║  └────────────────────────────────────────────────────────────────────────┘  ║
  167. ║                                                                              ║
  168. ╠══════════════════════════════════════════════════════════════════════════════╣
  169. ╠══════════════════════════════════════════════════════════════════════════════╣
  170. ║ 3. NOTES.                                                                  ▼ ║
  171. ╠══════════════════════════════════════════════════════════════════════════════╣
  172. ║                                                                              ║
  173. ║  Have fun and enjoy!                                                         ║
  174. ║                                                                              ║
  175. ╠══════════════════════════════════════════════════════════════════════════════╣
  176. ╠══════════════════════════════════════════════════════════════════════════════╣
  177. ║ 4. CONTACT.                                                                ▼ ║
  178. ╠══════════════════════════════════════════════════════════════════════════════╣
  179. ║                                                                              ║
  180. ║  Keep in touch with us and be the first to know about new releases:          ║
  181. ║                                                                              ║
  182. ║  [url]www.rpgmakersource.com[/url]                                                      ║
  183. ║  [url]www.facebook.com/RPGMakerSource[/url]                                             ║
  184. ║  [url]www.twitter.com/RPGMakerSource[/url]                                              ║
  185. ║  [url]www.youtube.com/user/RPGMakerSource[/url]                                         ║
  186. ║                                                                              ║
  187. ║  Get involved! Have an idea for a system? Let us know.                       ║
  188. ║                                                                              ║
  189. ║  Spread the word and help us reach more people so we can continue creating   ║
  190. ║  awesome resources for you!                                                  ║
  191. ║                                                                              ║
  192. ╚══════════════════════════════════════════════════════════════════════════════╝)
  193. =end
  194.  
  195. #==============================================================================
  196. # ** Maker Systems
  197. #------------------------------------------------------------------------------
  198. #  Module for our Systems.
  199. #==============================================================================
  200.  
  201. module MakerSystems
  202.  
  203.   #============================================================================
  204.   # ** Enhanced Camera
  205.   #----------------------------------------------------------------------------
  206.   #  Contains configurable values for the camera systems.
  207.   #============================================================================
  208.  
  209.   module EnhancedCamera
  210.  
  211.     #------------------------------------------------------------------------
  212.     # * 默认镜头滚动加速度.                                [OPT]
  213.     #------------------------------------------------------------------------
  214.     Deceleration_Value = 8
  215.  
  216.   end
  217.  
  218. end
  219.  
  220. #==============================================================================
  221. # ** Game_Interpreter
  222. #------------------------------------------------------------------------------
  223. #  Added methods to use in Script Call Event Command.
  224. #==============================================================================
  225.  
  226. class Game_Interpreter
  227.  
  228.   #--------------------------------------------------------------------------
  229.   # * Reset Deceleration Strength.                                      [NEW]
  230.   #--------------------------------------------------------------------------
  231.   def ms_pro_cam_reset_str
  232.     # Set camera deceleration strength back to default.
  233.     $game_map.ms_ecam_str =
  234.     MakerSystems::EnhancedCamera::Deceleration_Value.to_f
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # * Deceleration Strength.                                            [NEW]
  238.   #--------------------------------------------------------------------------
  239.   def ms_pro_cam_str(value)
  240.     # Set camera deceleration strength.
  241.     $game_map.ms_ecam_str = value.to_f
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * Ignore Player Toggle.                                             [NEW]
  245.   #--------------------------------------------------------------------------
  246.   def ms_pro_cam_ignore_player(value)
  247.     # Set ignore player flag.
  248.     $game_map.ms_ecam_ignore_player = value
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # * Lock Camera.                                                      [NEW]
  252.   #--------------------------------------------------------------------------
  253.   def ms_pro_cam_lock_camera
  254.     # Turns on camera lock flag.
  255.     $game_map.ms_ecam_locked = true
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # * Unlock Camera.                                                    [NEW]
  259.   #--------------------------------------------------------------------------
  260.   def ms_pro_cam_unlock_camera
  261.     # Turns off camera lock flag.
  262.     $game_map.ms_ecam_locked = false
  263.   end
  264.   #--------------------------------------------------------------------------
  265.   # * Character on Screen?                                              [NEW]
  266.   #--------------------------------------------------------------------------
  267.   def ms_pro_cam_character_on_screen?(id)
  268.     # Get character based on provided number (id).
  269.     character = get_character(id)
  270.     # Inside screen boundaries?
  271.     character.screen_x > 0 && character.screen_x < Graphics.width &&
  272.     character.screen_y > 0 && character.screen_y < Graphics.height
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # * Focus on Character.                                               [NEW]
  276.   #--------------------------------------------------------------------------
  277.   def ms_pro_cam_focus_on(id, can_cancel = false, key = :CTRL)
  278.     # Get character based on provided number (id).
  279.     character = get_character(id)
  280.     # Special handling if Player is the target.
  281.     if character.is_a?(Game_Player)
  282.       # Clears special character focus variable.
  283.       $game_map.ms_ecam_target        = nil
  284.       # Turns off ignore player flag.
  285.       $game_map.ms_ecam_ignore_player = false
  286.       # Moves camera back to player.
  287.       $game_map.ms_ecam_center(character.real_x, character.real_y)
  288.     else
  289.       # Sets camera target to its new target character.
  290.       $game_map.ms_ecam_target      = character
  291.       # Sets cancel focus flag.
  292.       $game_map.ms_ecam_cancel     = can_cancel
  293.       # Sets cancel focus key.
  294.       $game_map.ms_ecam_cancel_key = key
  295.     end
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # * Wait for Scrolling.                                               [NEW]
  299.   #--------------------------------------------------------------------------
  300.   def ms_pro_cam_wait_for_scrolling
  301.     # Yield until scrolling is completed.
  302.     Fiber.yield while $game_map.scrolling? || $game_map.ms_ecam_iterations
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # * Center Camera at Position.                                        [NEW]
  306.   #--------------------------------------------------------------------------
  307.   def ms_pro_cam_center_at(x, y, frames)
  308.     # Set camera location target.
  309.     $game_map.ms_ecam_go_to(x, y, frames)
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # * Center Camera at Character.                                       [NEW]
  313.   #--------------------------------------------------------------------------
  314.   def ms_pro_cam_center_at_char(id, frames)
  315.     # Get character based on provided number (id).
  316.     character = get_character(id)
  317.     # Set camera location target.
  318.     $game_map.ms_ecam_go_to(character.x, character.y, frames)
  319.   end
  320.  
  321. end
  322.  
  323. #==============================================================================
  324. # ** Game_Map
  325. #------------------------------------------------------------------------------
  326. #  Edited update_scroll and initialize.
  327. #==============================================================================
  328.  
  329. class Game_Map
  330.  
  331.   #--------------------------------------------------------------------------
  332.   # * Public Instance Variables.                                        [NEW]
  333.   #--------------------------------------------------------------------------
  334.   attr_accessor :ms_ecam_target, :ms_ecam_iterations, :ms_ecam_str,
  335.                 :ms_ecam_ignore_player, :ms_ecam_locked, :ms_ecam_cancel,
  336.                 :ms_ecam_cancel_key
  337.   #--------------------------------------------------------------------------
  338.   # * Alias Initialize.                                                 [NEW]
  339.   #--------------------------------------------------------------------------
  340.   alias_method(:ms_ecam_original_initialize, :initialize)
  341.   #--------------------------------------------------------------------------
  342.   # * Initialize.                                                       [MOD]
  343.   #--------------------------------------------------------------------------
  344.   def initialize
  345.     # Original method.
  346.     ms_ecam_original_initialize
  347.     # Initializes deceleration strength.
  348.     @ms_ecam_str = MakerSystems::EnhancedCamera::Deceleration_Value.to_f
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # * Center Position.                                                  [NEW]
  352.   #--------------------------------------------------------------------------
  353.   def ms_ecam_center(target_real_x, target_real_y, hard = false)
  354.     # Target position, centered.
  355.     @ms_ecam_real_x = target_real_x - screen_tile_x / 2
  356.     @ms_ecam_real_y = target_real_y - screen_tile_y / 2
  357.     # Position correction for no horizontally looped maps.
  358.     unless loop_horizontal?
  359.       # Limit for the X axis.
  360.       limit_x  = width  - screen_tile_x
  361.       limit_x  = 0 if limit_x < 0
  362.       # Keeps target position inside correct boundaries.
  363.       @ms_ecam_real_x = 0       if @ms_ecam_real_x < 0
  364.       @ms_ecam_real_x = limit_x if @ms_ecam_real_x > limit_x
  365.     end
  366.     # Position correction for no vertically looped maps.
  367.     unless loop_vertical?
  368.       # Limit for the Y axis.
  369.       limit_y  = height - screen_tile_y
  370.       limit_y  = 0 if limit_y < 0
  371.       # Keeps target position inside correct boundaries.
  372.       @ms_ecam_real_y = 0       if @ms_ecam_real_y < 0
  373.       @ms_ecam_real_y = limit_y if @ms_ecam_real_y > limit_y
  374.     end
  375.     # Ensures correct target values in case of looping any axis.
  376.     @ms_ecam_real_x %= width
  377.     @ms_ecam_real_y %= height
  378.     # No smooth movement?
  379.     if hard
  380.       # Sets display position now, without any smooth deceleration effect.
  381.       @display_x = @ms_ecam_real_x
  382.       @display_y = @ms_ecam_real_y
  383.     end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # * Prepares Camera Target.                                           [NEW]
  387.   #--------------------------------------------------------------------------
  388.   def ms_ecam_go_to(target_x, target_y, period = 60.0)
  389.     # Prevents execution of any kind of camera movement if locked flag is on.
  390.     return if @ms_ecam_locked
  391.     # Sets correct target positions.
  392.     ms_ecam_center(target_x, target_y)
  393.     # Gets correct X distance.
  394.     @ms_ecam_x_amplitude = ms_ecam_correct_amplitude(@display_x,
  395.                                    @ms_ecam_real_x, width, loop_horizontal?)
  396.     # Gets correct Y distance.
  397.     @ms_ecam_y_amplitude = ms_ecam_correct_amplitude(@display_y,
  398.                                     @ms_ecam_real_y, height, loop_vertical?)
  399.     # Initializes iteration counter.
  400.     @ms_ecam_iterations = 0.0
  401.     # Saves the original, starting position.
  402.     @ms_ecam_x_original = @display_x
  403.     @ms_ecam_y_original = @display_y
  404.     # Sets period (time).
  405.     @ms_ecam_period = period.to_f
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # * Correct Amplitude.                                                [NEW]
  409.   #--------------------------------------------------------------------------
  410.   def ms_ecam_correct_amplitude(current, target, limit, condition)
  411.     # Checks if looping in the desired axis.
  412.     if condition
  413.       # Returns shortest distance, crossing map borders if needed.
  414.       if ((target - current) % limit) < ((current - target) % limit)
  415.         (target - current) % limit
  416.       else
  417.         -((current - target) % limit)
  418.       end
  419.     else
  420.       # Returns normal distance.
  421.       target - current
  422.     end
  423.   end
  424.   #--------------------------------------------------------------------------
  425.   # * Alias Update Scroll.                                              [NEW]
  426.   #--------------------------------------------------------------------------
  427.   alias_method(:ms_ecam_original_update_scroll, :update_scroll)
  428.   #--------------------------------------------------------------------------
  429.   # * Update Scroll.                                                    [MOD]
  430.   #--------------------------------------------------------------------------
  431.   def update_scroll
  432.     # Prevents execution of any kind of camera movement if locked flag is on.
  433.     return if @ms_ecam_locked
  434.     # If non player target for camera.
  435.     if @ms_ecam_target
  436.       # If can be cancelled by player input and the key is triggered.
  437.       if @ms_ecam_cancel && Input.trigger?(@ms_ecam_cancel_key)
  438.         # Clears target flag.
  439.         @ms_ecam_target = nil
  440.         # Moves camera back to player.
  441.         ms_ecam_center($game_player.real_x, $game_player.real_y)
  442.       else
  443.         # Centers camera on target.
  444.         ms_ecam_center(@ms_ecam_target.real_x, @ms_ecam_target.real_y, false)
  445.       end
  446.     end
  447.     # Iterations pending?
  448.     if @ms_ecam_iterations
  449.       # Calculates period.
  450.       period = (@ms_ecam_iterations / @ms_ecam_period) * 1.57
  451.       # Sets new display positions.
  452.       @display_x = @ms_ecam_x_original + @ms_ecam_x_amplitude * Math.sin(period)
  453.       @display_y = @ms_ecam_y_original + @ms_ecam_y_amplitude * Math.sin(period)
  454.       # Ensures correct display values.
  455.       @display_x %= $game_map.width
  456.       @display_y %= $game_map.height
  457.       # If target positions were reached.
  458.       if period == 1.57
  459.         # Sets target position flag off.
  460.         @ms_ecam_iterations = nil
  461.         # Updates target positions.
  462.         @ms_ecam_real_x = @display_x
  463.         @ms_ecam_real_y = @display_y
  464.       else
  465.         # Updates iteration count.
  466.         @ms_ecam_iterations += 1.0
  467.       end
  468.     else
  469.       # Camera being moved by event commands?
  470.       if scrolling?
  471.         # Target position is actual display position.
  472.         @ms_ecam_real_x = @display_x
  473.         @ms_ecam_real_y = @display_y
  474.       else
  475.         # Moves camera. Correct step value with deceleration effect. X Axis.
  476.         @display_x += ms_ecam_correct_amplitude(@display_x,
  477.         @ms_ecam_real_x, width, loop_horizontal?) / @ms_ecam_str
  478.         # Moves camera. Correct step value with deceleration effect. Y Axis.
  479.         @display_y += ms_ecam_correct_amplitude(@display_y,
  480.         @ms_ecam_real_y, height, loop_vertical?)  / @ms_ecam_str
  481.         # Keeps map display values inside correct boundaries.
  482.         @display_x %= width
  483.         @display_y %= height
  484.       end
  485.     end
  486.     # Original method.
  487.     ms_ecam_original_update_scroll
  488.   end
  489.  
  490. end
  491.  
  492. #==============================================================================
  493. # ** Game_Player
  494. #------------------------------------------------------------------------------
  495. #  Replaced update_scroll and center.
  496. #==============================================================================
  497.  
  498. class Game_Player < Game_Character
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # * Update Scroll.                                                    [REP]
  502.   #--------------------------------------------------------------------------
  503.   def update_scroll(last_real_x, last_real_y)
  504.     # Check if it is good to go.
  505.     unless $game_map.ms_ecam_target        || $game_map.ms_ecam_iterations ||
  506.            $game_map.ms_ecam_ignore_player || !moving?
  507.       # Updates the camera centering.
  508.       $game_map.ms_ecam_center(@real_x, @real_y)
  509.     end
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # * Center.                                                           [REP]
  513.   #--------------------------------------------------------------------------
  514.   def center(x, y)
  515.     # Don't center if the camera is anchored to its position.
  516.     return if $game_map.ms_ecam_locked
  517.     # Center camera display position at once.
  518.     $game_map.ms_ecam_center(x.to_f, y.to_f, true)
  519.   end
  520.  
  521. end

VXAce_SP1:
RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce_SP1
  3. #------------------------------------------------------------------------------
  4. #  プリセットスクリプトの不具合を修正します。ユーザー定義のスクリプト素材は、
  5. # 原則としてこのセクションより下に配置してください。
  6. #==============================================================================
  7.  
  8. #------------------------------------------------------------------------------
  9. # 【修正内容】
  10. #------------------------------------------------------------------------------
  11. # ●イベントコマンド[ステートの変更]にて、同じステートの付加と解除を同時に実
  12. #   行した際、二回目以降の付加が失敗する不具合を修正しました。
  13. # ●イベントコマンド[アニメーションの表示]にて、表示中のアニメーションがマッ
  14. #   プのスクロールに同期しない不具合を修正しました。
  15. # ●自動戦闘の行動が正常に選択されない不具合を修正しました。
  16. # ●装備できなくなった装備品が外れたことにより、さらに別の装備品が装備できなく
  17. #   なったとき、その装備品が増殖してしまう不具合を修正しました。
  18. # ●イベントコマンド[ピクチャの消去]を実行した後に余分な負荷がかかる不具合を
  19. #   修正しました。
  20. # ●移動ルートのオプション[移動できない場合は飛ばす]にチェックを入れた状態で
  21. #   トリガー[プレイヤーから接触]のイベントに接触すると、イベントが実行中であ
  22. #   っても起動予約がされてしまう不具合を修正しました。
  23. # ●魔法反射されたスキルに対してステート有効度が反映されない不具合を修正しまし
  24. #  た。
  25. # ●フォントのデフォルト設定にて太字または斜体を有効にしていても、ステータス画
  26. #   面を切り替えたとき等に無効な状態に戻ってしまう不具合を修正しました。
  27. #------------------------------------------------------------------------------
  28. class Game_Battler
  29.   attr_accessor :magic_reflection
  30.   #--------------------------------------------------------------------------
  31.   # ● 敵対関係の判定
  32.   #--------------------------------------------------------------------------
  33.   alias vxace_sp1_opposite? opposite?
  34.   def opposite?(battler)
  35.     vxace_sp1_opposite?(battler) || battler.magic_reflection
  36.   end
  37. end
  38. #------------------------------------------------------------------------------
  39. class Game_Actor
  40.   #--------------------------------------------------------------------------
  41.   # ● 装備できない装備品を外す
  42.   #     item_gain : 外した装備品をパーティに戻す
  43.   #--------------------------------------------------------------------------
  44.   alias vxace_sp1_release_unequippable_items release_unequippable_items
  45.   def release_unequippable_items(item_gain = true)
  46.     loop do
  47.       last_equips = equips.dup
  48.       vxace_sp1_release_unequippable_items(item_gain)
  49.       return if equips == last_equips
  50.     end
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 自動戦闘時の戦闘行動を作成
  54.   #--------------------------------------------------------------------------
  55.   def make_auto_battle_actions
  56.     @actions.size.times do |i|
  57.       @actions[i] = make_action_list.max_by {|action| action.value }
  58.     end
  59.   end
  60. end
  61. #------------------------------------------------------------------------------
  62. class Game_Player
  63.   #--------------------------------------------------------------------------
  64.   # ● マップイベントの起動
  65.   #     triggers : トリガーの配列
  66.   #     normal   : プライオリティ[通常キャラと同じ]かそれ以外か
  67.   #--------------------------------------------------------------------------
  68.   alias vxace_sp1_start_map_event start_map_event
  69.   def start_map_event(x, y, triggers, normal)
  70.     return if $game_map.interpreter.running?
  71.     vxace_sp1_start_map_event(x, y, triggers, normal)
  72.   end
  73. end
  74. #------------------------------------------------------------------------------
  75. class Game_Picture
  76.   #--------------------------------------------------------------------------
  77.   # ● ピクチャの消去
  78.   #--------------------------------------------------------------------------
  79.   alias vxace_sp1_erase erase
  80.   def erase
  81.     vxace_sp1_erase
  82.     @origin = 0
  83.   end
  84. end
  85. #------------------------------------------------------------------------------
  86. class Game_Interpreter
  87.   #--------------------------------------------------------------------------
  88.   # ● ステートの変更
  89.   #--------------------------------------------------------------------------
  90.   alias vxace_sp1_command_313 command_313
  91.   def command_313
  92.     vxace_sp1_command_313
  93.     $game_party.clear_results
  94.   end
  95. end
  96. #------------------------------------------------------------------------------
  97. class Sprite_Character
  98.   #--------------------------------------------------------------------------
  99.   # ● 位置の更新
  100.   #--------------------------------------------------------------------------
  101.   alias vxace_sp1_update_position update_position
  102.   def update_position
  103.     move_animation(@character.screen_x - x, @character.screen_y - y)
  104.     vxace_sp1_update_position
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● アニメーションの移動
  108.   #--------------------------------------------------------------------------
  109.   def move_animation(dx, dy)
  110.     if @animation && @animation.position != 3
  111.       @ani_ox += dx
  112.       @ani_oy += dy
  113.       @ani_sprites.each do |sprite|
  114.         sprite.x += dx
  115.         sprite.y += dy
  116.       end
  117.     end
  118.   end
  119. end
  120. #------------------------------------------------------------------------------
  121. class Sprite_Picture
  122.   #--------------------------------------------------------------------------
  123.   # ● 転送元ビットマップの更新
  124.   #--------------------------------------------------------------------------
  125.   alias vxace_sp1_update_bitmap update_bitmap
  126.   def update_bitmap
  127.     if @picture.name.empty?
  128.       self.bitmap = nil
  129.     else
  130.       vxace_sp1_update_bitmap
  131.     end
  132.   end
  133. end
  134. #------------------------------------------------------------------------------
  135. class Window_Base
  136.   #--------------------------------------------------------------------------
  137.   # ● フォント設定のリセット
  138.   #--------------------------------------------------------------------------
  139.   alias vxace_sp1_reset_font_settings reset_font_settings
  140.   def reset_font_settings
  141.     vxace_sp1_reset_font_settings
  142.     contents.font.bold = Font.default_bold
  143.     contents.font.italic = Font.default_italic
  144.   end
  145. end
  146. #------------------------------------------------------------------------------
  147. class Scene_Battle
  148.   #--------------------------------------------------------------------------
  149.   # ● 魔法反射の発動
  150.   #--------------------------------------------------------------------------
  151.   alias vxace_sp1_invoke_magic_reflection invoke_magic_reflection
  152.   def invoke_magic_reflection(target, item)
  153.     @subject.magic_reflection = true
  154.     vxace_sp1_invoke_magic_reflection(target, item)
  155.     @subject.magic_reflection = false
  156.   end
  157. end

问题录屏.rar

606.19 KB, 下载次数: 0

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-9-10 12:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表