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

Project1

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

[已经解决] 如何让脚步声多步一响

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1046
在线时间
357 小时
注册时间
2014-4-25
帖子
42
跳转到指定楼层
1
发表于 2022-11-15 19:44:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
50星屑
这里使用了按像素移动的ORANGE 移动系统脚本+tomoaky的足音脚本,可能是因为像素移动脚本将原本一步一格拆成了多步一格,导致原本一步一响的脚步声频率变得很高,摸索半天不会解决……前来求助各位前辈

以下是上述的两个脚本

RUBY 代码复制
  1. #------------------------------------------------------------
  2. #------------------------------------------------------------
  3. #-----------------  ORANGE 移动系统  -----------------
  4. #------------------------------------------------------------
  5. #------------------------------------------------------------
  6. #
  7. # Script created by Hudell ([url]www.hudell.com[/url])
  8. # Version: 3.6.1
  9. # You're free to use this script on any project
  10. #
  11. # Change Log:
  12. #
  13. # v3.6: 2016-03-26
  14. # => Fixed movement on looped maps
  15. #
  16. # v3.5: 2015-10-27
  17. # => Fixed a problem where the player sprite wouldn't change back to "walking" before entering a battle.
  18. #
  19. # v3.4: 2015-09-13
  20. # => Added Auto_Avoid_Ignore_Delay_When_Dashing setting
  21. #
  22. # v3.3: 2015-09-08
  23. # => Added Auto_Avoid_Diagonally_Delay and Auto_Avoid_Offset_Delay settings
  24. #
  25. # v3.2: 2015-08-21
  26. # => Improvements on diagonal movement
  27. #
  28. # v3.1: 2015-08-08
  29. # => Added "Dashing_Sprites_Reset_On_Teleport" setting
  30. #
  31. # v3.0: 2015-07-28
  32. # => Added Hitboxes for Events
  33. #
  34. # v2.9: 2015-07-26
  35. # => Fixed a problem where touch events wouldn't trigger when dashing if Tile_Sections was set to 8
  36. #
  37. # v2.8: 2015-07-25
  38. # => Changed support for dashing sprites
  39. #
  40. # v2.7: 2015-07-07
  41. # => Fixed a problem where fixed routes could move the player into blocked tiles
  42. #
  43. # v2.6: 2015-07-05
  44. # => Added functionality to use a different sprite for dashing actors
  45. #
  46. # v2.5: 2015-06-29
  47. # => Support for different step sizes
  48. # => Support for a different hitbox for each actor
  49. #
  50. # v2.4: 2015-06-11
  51. # => Added a new option to ignore empty events when choosing which event to trigger
  52. # => If somehow the player is on the same tile as an unpassable event, they will now be able to leave that tile
  53. # => Fixed a small problem where events would turn to the wrong direction when activated
  54. #
  55. # v2.3: 2015-06-04
  56. # => Added settings to configure passable and unpassable tiles using regions
  57. #
  58. # v2.2: 2015-05-24
  59. # => Fixed a problem where events could sometimes walk over the player
  60. #
  61. # v2.1: 2015-05-20
  62. # => Added a new setting: Block_Repeated_Event_Triggering
  63. #
  64. # v2.0: 2015-05-17
  65. # => Completely remade the tileset collision check
  66. # => Implemented hitboxes for the player and follower
  67. #
  68. # v1.9: Improved followers movement
  69. #
  70. # v1.8: Added option to enable / disable the whole script using a switch, fixed a problem where followers wouldn't walk
  71. #
  72. # v1.7: Changed the way that the player will walk when using forced Move Routes
  73. #
  74. # v1.6: Fixed a problem where the game could crash if the jump feature was disabled
  75. #
  76. # v1.5: Added a new setting to disable diagonal movement
  77. #
  78. # v1.4: Fixed a problem with the Auto_Fall feature when used together with pixel movement
  79. #
  80. # v1.3: Fixed a problem where sometimes the player would be able to enter an impassable tile
  81. #
  82. # v1.2: Added several new configs: Auto_Avoid_Diagonally, Auto_Avoid_Walking_Around, Auto_Avoid_Diagonally_Only_When_Dashing,
  83. # Auto_Avoid_Events_Diagonally, Auto_Avoid_Events_Walking_Around, Auto_Avoid_Try_Jumping_First, Auto_Avoid_Events_Max_Offset
  84. #
  85. # v1.1: Added Auto_Avoid_Retain_Direction and Auto_Avoid_Only_When_Dashing configurations
  86. #
  87.  
  88. module OrangeMovement
  89.   #------------------------------------------------------------
  90.   #------------------------------------------------------------
  91.   #---------------------  兼容性  ----------------------
  92.   #------------------------------------------------------------
  93.   #------------------------------------------------------------
  94.   #
  95.   # 在这里查看兼容补丁:
  96.   # [url]https://github.com/Hudell/scripts/tree/master/standalone/movement/compatibility[/url]
  97.   #
  98.   #
  99.   #------------------------------------------------------------
  100.   #------------------------------------------------------------
  101.   #---------------------  设定  ----------------------
  102.   #------------------------------------------------------------
  103.   #------------------------------------------------------------
  104.  
  105.   #图块拆分 - 将一个图块分成多少份. 必须设定为以下值之一:
  106.   # 1 - 无改变
  107.   # 2 - 每一步会移动 16px
  108.   # 4 - 每一步会移动 8px  - 建议使用
  109.   # 8 - 每一步会移动 4px  - 同样建议使用
  110.   # 其他在1 和 32 之间的值可能生效也可能不生效.
  111.  
  112.   Tile_Sections = 4
  113.  
  114.   #"移动路线"是否按像素移动
  115.   #如果设定为false,"移动路线"中的设定不会按像素移动,而是和原来一样按图块移动
  116.   Fixed_Move_Route_Use_Pixel_Movement = false
  117.  
  118.   #是否自动与网格对齐,以下有两种生效的情况:
  119.   #当像素移动被禁用时(可能是完全禁用或在"移动路线"中禁用),且当这个设定为true时
  120.   #脚本会是玩家始终与网格对齐.
  121.   Align_To_Grid = true
  122.  
  123.   #是否允许对角线移动(八方向移动)
  124.   Enable_Diagonal_Movement = true
  125.  
  126.   #自动绕开: 设定为true时,玩家可以自动绕开小型障碍物.
  127.   Auto_Avoid = true
  128.  
  129.   #是否在对角线行走时自动绕开小型障碍物.
  130.   Auto_Avoid_Diagonally = true
  131.   #是否在转头时自动绕开小型障碍物.
  132.   Auto_Avoid_Walking_Around = true
  133.  
  134.   #在对角线行走时,自动绕开前等待的时间
  135.   Auto_Avoid_Diagonally_Delay = 0
  136.   #在普通移位时,自动绕开前的等待时间
  137.   Auto_Avoid_Offset_Delay = 0
  138.  
  139.   #是否在冲刺时跳过所有自动绕开前的等待时间
  140.   Auto_Avoid_Ignore_Delay_When_Dashing = true
  141.  
  142.   #玩家可以朝不同的方向走多少图块,以自动绕靠挡路的图块
  143.   #设定数值不能小于一步的像素大小
  144.   #设定为false以将此禁用
  145.   Auto_Avoid_Max_Offset = 0.75
  146.  
  147.   #设定为true时,由于auto_avoid的移位效果,玩家在行走于另一个方向时不能转向(?)
  148.   #the player won't turn when walking on another direction for the
  149.   #auto_avoid by offset effect
  150.   Auto_Avoid_Retain_Direction = true
  151.  
  152.   #是否仅在冲刺时启用对角线自动绕开
  153.   Auto_Avoid_Diagonally_Only_When_Dashing = false
  154.  
  155.   ##是否仅在冲刺时时启用普通移位自动绕开
  156.   Auto_Avoid_Offset_Only_When_Dashing = false
  157.  
  158.   #自动绕开时,玩家是否可以绕开事件?
  159.   Auto_Avoid_Events_Diagonally = true
  160.   Auto_Avoid_Events_Diagonally_Only_When_Dashing = true
  161.   Auto_Avoid_Events_Walking_Around = true
  162.   Auto_Avoid_Events_Walking_Around_Only_When_Dashing = true
  163.   Auto_Avoid_Events_Max_Offset = 0.35
  164.  
  165.   #是否在对角线移动时,遇到小型障碍物前,先试着跳跃过去
  166.   Auto_Avoid_Try_Jumping_First = false
  167.  
  168.   #自动跳跃: 启用时(设定为true或整数数值),玩家可以自动跳过小型障碍物
  169.   # 禁用时(设定为0), 为了避免冲突,本功能不会在rpg maker中加载
  170.   # 如果设定为true, 此功能会始终生效
  171.   # 如果设定为整数数值,代表开关ID,此开关开启时,会启用自动跳跃的功能
  172.   Auto_Jump = 0
  173.  
  174.   #是否仅在冲刺时启用自动跳跃的功能
  175.   Auto_Jump_Only_When_Dashing = true
  176.  
  177.   #是否在队员数大于1时禁用自动跳跃的功能
  178.   Auto_Jump_Only_When_Alone = true
  179.  
  180.   #在玩家跳跃时播放的音效
  181.   #你可以使用数组来设定多个跳跃音效
  182.   #设定为false来禁用此功能
  183.  
  184.   Auto_Jump_Sound_Effect = false
  185.   #或 Auto_Jump_Sound_Effect = 'Jump1'
  186.   #或 Auto_Jump_Sound_Effect = ['Jump1', 'Jump2']
  187.  
  188.   #跳跃音效的音量大小
  189.   Auto_Jump_Sound_Effect_Volume = 80
  190.  
  191.   #跳跃音效的音调高低
  192.   #你可以设定为音调的范围
  193.   Auto_Jump_Sound_Effect_Pitch = 80..100
  194.  
  195.   #可被跳跃过的区域ID
  196.   #设定为true则玩家可以跳过任何图块
  197.   #设定为false则玩家不可以跳过任何图块
  198.   Auto_Jump_Region_Id = false
  199.  
  200.   #自动跳跃时始终可以通行的区域
  201.   #设定为整数数值,代表区域ID:玩家始终可以跳过所有列出的区域的图块
  202.   #设定为false来禁用此功能
  203.   #设定为true使玩家始终可以跳过任何图块
  204.   Auto_Jump_Region_Always_Passable = false
  205.  
  206.   #自动跳跃时始终不可以通行的区域
  207.   #设定为整数数值,代表区域ID:玩家始终不可以跳过所有列出的区域的图块
  208.   #设定为false来禁用此功能
  209.   #设定为true使玩家始终不可以跳过任何图块
  210.   Auto_Jump_Region_Never_Passable = false
  211.  
  212.   #跳跃间的延迟时间
  213.   Auto_Jump_Delay = 12
  214.  
  215.   # 玩家可以跳跃过事件吗?
  216.   # 设定为true,则玩家始终可以跳跃过所有事件
  217.   # 设定为false,则玩家始终不可以跳跃过所有事件
  218.   # --尚未实现--> 设定为字符,事件名为该字符的事件始终可以被玩家跳跃过(脚本会从
  219.   #事件名中检索相同的字符)
  220.   Auto_Jump_Over_Events = true
  221.  
  222.   #是否启用跳跃后落地
  223.   #设定哪些区域玩家可以落地
  224.   Auto_Jump_Fall_Enabled = true
  225.   Auto_Jump_Fall_Down_Region = 2
  226.   Auto_Jump_Fall_Left_Region = 4
  227.   Auto_Jump_Fall_Right_Region = 6
  228.   Auto_Jump_Fall_Up_Region = 8
  229.  
  230.   #设定为false时, 本脚本的功能会被禁用
  231.   #设定为整数数值时,代表开关ID,开关开启时本脚本的功能会被启用
  232.   Enabled = true
  233.  
  234.   #设定为true时,会在"玩家接触"、"事件解除"时使用新的接触系统,而不是旧的那一个
  235.   #(可能会与一些新功能的脚本起冲突)
  236.   Enable_Hitbox = true
  237.  
  238.   #玩家的默认接触系统, 仅在数据库中,相应角色的备注栏里无任何设定内容时生效
  239.   #玩家身上带有一个无形的"接触格",事件碰到接触格时视为"事件解除";接触格碰到事
  240.   #件时视为"玩家接触"
  241.  
  242.   #Player_Hitbox_X_Offset - 调整接触格的X坐标(单位是像素)
  243.   #也可使用角色备注: hitbox_x=0
  244.   Player_Hitbox_X_Offset = 0
  245.   #Player_Hitbox_Y_Offset - 调整接触格的Y坐标(单位是像素)
  246.   #也可使用角色备注: hitbox_y=0
  247.   Player_Hitbox_Y_Offset = 0
  248.   #Player_Hitbox_Width - 调整接触格的宽度(单位是像素)
  249.   #也可使用角色备注: hitbox_w=0
  250.   Player_Hitbox_Width = 32
  251.   #Player_Hitbox_Height - 调整接触格的高度(单位是像素)
  252.   #也可使用角色备注: hitbox_h=0
  253.   Player_Hitbox_Height = 32
  254.  
  255.   #设定为整数数值时,代表区域ID,全部列出的区域始终可以/不可以被玩家通过
  256.   Map_Always_Passable_Region = false
  257.   Map_Never_Passable_Region = false
  258.  
  259.   # 是否触发所有接触到的事件. 举个例子:
  260.   # 当玩家"踩到"两个不同的,且触发条件都是"玩家接触"的事件上时,在设定为true时
  261.   # 两个事件会被同时触发
  262.   # 设定为false时, 仅会触发任意一个事件
  263.   Trigger_All_Events = false
  264.  
  265.   #当此项设定为true (且 Trigger_All_Events 设定为 false), 玩家移动到其他地图时
  266.   #该地图的事件只会在玩家不与其接触,然后再次接触,才会被触发
  267.   Ignore_Teleported_Tile = false
  268.  
  269.   # 设定为true时,不会触发空白事件
  270.   Ignore_Empty_Events = true
  271.  
  272.   # 设定为true时, 只有在玩家离开图块且再次接触事件时,事件才会被触发。
  273.   # 如果只是在相同图块中移动,事件不会被再次触发
  274.   # 设定为false时, 玩家在同一图块中每走一步事件都会被触发一遍
  275.   Block_Repeated_Event_Triggering = true
  276.  
  277.   # 设定为true时, 启用自定义事件接触格
  278.   Use_Event_Hitboxes = true
  279.  
  280.   # 设定为true时, 脚本会根据下面的介绍,冲刺时自动改变队长的行走图
  281.   Use_Dashing_Sprites = true
  282.  
  283.   # 设定为true时, 脚本会在玩家切换地图后,将冲刺行走图变回普通的"走路"行走图
  284.   Dashing_Sprites_Reset_On_Teleport = true
  285.  
  286.   # 设定冲刺行走图的角色备注:
  287.   #
  288.   #       dashing_sprite_name = 文件名
  289.   #       dashing_sprite_index = 0
  290.   #       walking_sprite_name = 文件名
  291.   #       walking_sprite_index = 0
  292.   #
  293.   # 可以使用脚本来改变冲刺行走图:
  294.   #
  295.   #       $game_player.actor.dashing_sprite_name = '文件名'
  296.   #       $game_player.actor.dashing_sprite_index = 0
  297.   #       $game_player.actor.walking_sprite_name = '文件名'
  298.   #       $game_player.actor.walking_sprite_index = 0
  299.   #
  300.   #------------------------------------------------------------
  301.   #------------------------------------------------------------
  302.   #---------------  以下部分请勿编辑  ---------------
  303.   #------------------------------------------------------------
  304.   #------------------------------------------------------------
  305.  
  306.   Step_Size = 1.0 / Tile_Sections
  307.  
  308.   def direction_goes_left?(direction)
  309.     return [1, 4, 7].include?(direction)
  310.   end
  311.   def direction_goes_right?(direction)
  312.     return [3, 6, 9].include?(direction)
  313.   end
  314.   def direction_goes_up?(direction)
  315.     return [*7..9].include?(direction)
  316.   end
  317.   def direction_goes_down?(direction)
  318.     return [*1..3].include?(direction)
  319.   end
  320.  
  321.   def enabled?
  322.     return true if Enabled == true
  323.     return false if Enabled == false
  324.     return $game_switches[Enabled] if Enabled.is_a?(Fixnum)
  325.     return false
  326.   end
  327.  
  328.   def input_direction_enabled?(d)
  329.     true
  330.   end
  331. end
  332.  
  333. module Direction
  334.   def self.up; 8; end
  335.   def self.down; 2; end
  336.   def self.left; 4; end
  337.   def self.right; 6; end
  338.   def self.up_left; 7; end
  339.   def self.up_right; 9; end
  340.   def self.down_left; 1; end
  341.   def self.down_right; 3; end
  342. end
  343.  
  344. class Game_Actor < Game_Battler
  345.   include OrangeMovement
  346.  
  347.   def hitbox_x
  348.     begin
  349.       @hitbox_x = actor.note.scan(/hitbox\_x_*=_*(\-?[0-9]+)/)[0][0].to_i if @hitbox_x.nil?
  350.     rescue
  351.       @hitbox_x = Player_Hitbox_X_Offset
  352.     end
  353.  
  354.     @hitbox_x
  355.   end
  356.  
  357.   def hitbox_y
  358.     begin
  359.       @hitbox_y = actor.note.scan(/hitbox\_y_*=_*(\-?[0-9]+)/)[0][0].to_i if @hitbox_y.nil?
  360.     rescue
  361.       @hitbox_y = Player_Hitbox_Y_Offset
  362.     end
  363.  
  364.     @hitbox_y
  365.   end
  366.  
  367.   def hitbox_w
  368.     begin
  369.       @hitbox_w = actor.note.scan(/hitbox\_w_*=_*(\-?[0-9]+)/)[0][0].to_i if @hitbox_w.nil?
  370.     rescue
  371.       @hitbox_w = Player_Hitbox_Width
  372.     end
  373.  
  374.     @hitbox_w
  375.   end
  376.  
  377.   def hitbox_h
  378.     begin
  379.       @hitbox_h = actor.note.scan(/hitbox\_h_*=_*(\-?[0-9]+)/)[0][0].to_i if @hitbox_h.nil?
  380.     rescue
  381.       @hitbox_h = Player_Hitbox_Height
  382.     end
  383.  
  384.     @hitbox_h
  385.   end
  386.  
  387.   def hitbox_x_size
  388.     hitbox_x / 32.0
  389.   end
  390.  
  391.   def hitbox_y_size
  392.     hitbox_y / 32.0
  393.   end
  394.  
  395.   def hitbox_h_size
  396.     hitbox_w / 32.0
  397.   end
  398.  
  399.   def hitbox_v_size
  400.     hitbox_h / 32.0
  401.   end
  402.  
  403.   def dashing_sprite_name
  404.     begin
  405.       @dashing_sprite_name = actor.note.scan(/dashing\_sprite\_name_*=_*(.*)$/)[0][0].strip if @dashing_sprite_name.nil?
  406.     rescue
  407.     end
  408.  
  409.     @dashing_sprite_name
  410.   end
  411.  
  412.   def dashing_sprite_index
  413.     begin
  414.       @dashing_sprite_index = actor.note.scan(/dashing\_sprite\_index_*=_*(.*)$/)[0][0].to_i if @dashing_sprite_index.nil?
  415.     rescue
  416.     end
  417.  
  418.     @dashing_sprite_index
  419.   end
  420.  
  421.   def dashing_sprite_name=(value)
  422.     @dashing_sprite_name = value
  423.   end
  424.  
  425.   def dashing_sprite_index=(value)
  426.     @dashing_sprite_index = value
  427.   end
  428.  
  429.   def walking_sprite_name
  430.     begin
  431.       @walking_sprite_name = actor.note.scan(/walking\_sprite\_name_*=_*(.*)$/)[0][0].strip if @walking_sprite_name.nil?
  432.     rescue
  433.     end
  434.  
  435.     @walking_sprite_name
  436.   end
  437.  
  438.   def walking_sprite_index
  439.     begin
  440.       @walking_sprite_index = actor.note.scan(/walking\_sprite\_index_*=_*(.*)$/)[0][0].to_i if @walking_sprite_index.nil?
  441.     rescue
  442.     end
  443.  
  444.     @walking_sprite_index
  445.   end
  446.  
  447.   def walking_sprite_name=(value)
  448.     @walking_sprite_name = value
  449.   end
  450.  
  451.   def walking_sprite_index=(value)
  452.     @walking_sprite_index = value
  453.   end
  454. end
  455.  
  456.  
  457. unless OrangeMovement::Enabled == false
  458.   class Game_Map
  459.     include OrangeMovement
  460.  
  461.     def x_with_direction(x, d)
  462.       if direction_goes_left?(d)
  463.         return x - 1
  464.       elsif direction_goes_right?(d)
  465.         return x + 1
  466.       else
  467.         return x
  468.       end
  469.     end
  470.  
  471.     def y_with_direction(y, d)
  472.       if direction_goes_down?(d)
  473.         return y + 1
  474.       elsif direction_goes_up?(d)
  475.         return y - 1
  476.       else
  477.         return y
  478.       end
  479.     end
  480.  
  481.     def round_x_with_direction(x, d)
  482.       round_x(x_with_direction(x, d))
  483.     end
  484.  
  485.     def round_y_with_direction(y, d)
  486.       round_y(y_with_direction(y, d))
  487.     end
  488.  
  489.     def player_x_with_direction(x, d, step_size = Step_Size)
  490.       if enabled?
  491.         if direction_goes_left?(d)
  492.           return x - step_size
  493.         elsif direction_goes_right?(d)
  494.           return x + step_size
  495.         else
  496.           return x
  497.         end
  498.       else
  499.         return x_with_direction(x, d)
  500.       end
  501.     end
  502.  
  503.     def player_y_with_direction(y, d, step_size = Step_Size)
  504.       if enabled?
  505.         if direction_goes_down?(d)
  506.           return y + step_size
  507.         elsif direction_goes_up?(d)
  508.           return y - step_size
  509.         else
  510.           return y
  511.         end
  512.       else
  513.         return y_with_direction(y, d)
  514.       end
  515.     end
  516.  
  517.     def round_player_x_with_direction(x, d, step_size = Step_Size)
  518.       round_x(player_x_with_direction(x, d, step_size))
  519.     end
  520.  
  521.     def round_player_y_with_direction(y, d, step_size = Step_Size)
  522.       round_y(player_y_with_direction(y, d, step_size))
  523.     end
  524.  
  525.     def loop_passable?(x, y, d)
  526.       while (x < 0)
  527.         x += width
  528.       end
  529.       while (y < 0)
  530.         y += height
  531.       end
  532.  
  533.       return passable?(x % width, y % height, d)
  534.     end
  535.  
  536.     alias :hudell_orange_movement_check_passage :check_passage
  537.     def check_passage(x, y, bit)
  538.       if OrangeMovement::Map_Never_Passable_Region != false || OrangeMovement::Map_Always_Passable_Region != false
  539.         region = $game_map.region_id(x, y)
  540.  
  541.         if OrangeMovement::Map_Always_Passable_Region != false
  542.           return true if region == OrangeMovement::Map_Always_Passable_Region
  543.         end
  544.         if OrangeMovement::Map_Never_Passable_Region != false
  545.           return false if region == OrangeMovement::Map_Never_Passable_Region
  546.         end
  547.       end
  548.  
  549.       return hudell_orange_movement_check_passage(x, y, bit)
  550.     end
  551.   end
  552.  
  553.   module Orange_ActorCharacter
  554.     def hitbox_x_size
  555.       if actor.nil?
  556.         0
  557.       else
  558.         actor.hitbox_x_size
  559.       end
  560.     end
  561.  
  562.     def hitbox_y_size
  563.       if actor.nil?
  564.         0
  565.       else
  566.         actor.hitbox_y_size
  567.       end
  568.     end
  569.  
  570.     def hitbox_v_size
  571.       if actor.nil?
  572.         1
  573.       else
  574.         actor.hitbox_v_size
  575.       end
  576.     end
  577.  
  578.     def hitbox_h_size
  579.       if actor.nil?
  580.         1
  581.       else
  582.         actor.hitbox_h_size
  583.       end
  584.     end
  585.   end
  586.  
  587.   module Orange_Character
  588.     include OrangeMovement
  589.     def tile_x
  590.       diff = @x - @x.floor
  591.       if diff < 0.5
  592.         return @x.floor
  593.       else
  594.         return @x.ceil
  595.       end
  596.     end
  597.  
  598.     def tile_y
  599.       diff = @y - @y.floor
  600.       if diff < 0.5
  601.         return @y.floor
  602.       else
  603.         return @y.ceil
  604.       end
  605.     end
  606.  
  607.     def float_x
  608.       @x
  609.     end
  610.  
  611.     def float_y
  612.       @y
  613.     end
  614.  
  615.     def hitbox_y
  616.       @y + hitbox_y_size
  617.     end
  618.  
  619.     def hitbox_x
  620.       @x + hitbox_x_size
  621.     end
  622.  
  623.     def hitbox_bottom
  624.       hitbox_y + hitbox_h_size
  625.     end
  626.  
  627.     def position_data
  628.       the_x = @x + hitbox_x_size
  629.       the_y = @y + hitbox_y_size
  630.       width = hitbox_h_size.to_f - 0.01
  631.       height = hitbox_v_size.to_f - 0.01
  632.  
  633.       return the_x, the_y, the_x + width, the_y + height
  634.     end
  635.  
  636.     def is_touching_tile?(tile_x, tile_y)
  637.       the_x, the_y, width, height = position_data
  638.  
  639.       return false unless tile_x >= the_x.floor && tile_x <= width.floor
  640.       return false unless tile_y >= the_y.floor && tile_y <= height.floor
  641.       return true
  642.     end
  643.  
  644.     def hitbox_x_size
  645.       0
  646.     end
  647.  
  648.     def hitbox_y_size
  649.       0
  650.     end
  651.  
  652.     def hitbox_v_size
  653.       1
  654.     end
  655.  
  656.     def hitbox_h_size
  657.       1
  658.     end
  659.  
  660.     def left_x
  661.       hitbox_x
  662.     end
  663.  
  664.     def right_x
  665.       hitbox_x + hitbox_h_size
  666.     end
  667.  
  668.     def top_y
  669.       hitbox_y
  670.     end
  671.  
  672.     def bottom_y
  673.       hitbox_y + hitbox_v_size
  674.     end
  675.  
  676.     def front_x
  677.       if direction_goes_left?(direction)
  678.         return @x.floor - 1
  679.       elsif direction_goes_right?(direction)
  680.         return @x.ceil + 1
  681.       else
  682.         x_diff = @x - @x.floor
  683.         if x_diff < 0.5
  684.           return @x.floor
  685.         else
  686.           return @x.ceil
  687.         end
  688.       end
  689.     end
  690.  
  691.     def front_y
  692.       if direction_goes_up?(direction)
  693.         return @y.floor - 1
  694.       elsif direction_goes_down?(direction)
  695.         return @y.ceil + 1
  696.       else
  697.         y_diff = @y - @y.floor
  698.         if y_diff < 0.5
  699.           return @y.floor
  700.         else
  701.           return @y.ceil
  702.         end
  703.       end
  704.     end
  705.  
  706.     def x
  707.       tile_x
  708.     end
  709.  
  710.     def y
  711.       tile_y
  712.     end
  713.  
  714.     def pos?(x, y)
  715.       if @x.floor == x || @x.ceil == x
  716.         return true if @y.floor == y || @y.ceil == y
  717.       end
  718.  
  719.       false
  720.     end
  721.  
  722.     def my_step_size
  723.       Step_Size
  724.     end
  725.  
  726.     def custom_through?
  727.       false
  728.     end
  729.  
  730.     def tileset_passable?(x, y, d)
  731.       x2 = $game_map.round_player_x_with_direction(x, d, my_step_size)
  732.       y2 = $game_map.round_player_y_with_direction(y, d, my_step_size)
  733.       return false unless $game_map.valid?(x2, y2)
  734.  
  735.       return true if @through || debug_through? || custom_through?
  736.       return false unless map_passable?(x, y, d)
  737.       return false unless map_passable?(x2, y2, reverse_dir(d))
  738.  
  739.       return true
  740.     end
  741.  
  742.     def passable?(x, y, d)
  743.       return false unless tileset_passable?(x, y, d)
  744.       return true if @through || debug_through? || custom_through?
  745.  
  746.       x2 = $game_map.round_player_x_with_direction(x, d, my_step_size)
  747.       y2 = $game_map.round_player_y_with_direction(y, d, my_step_size)
  748.  
  749.       return false if collide_with_characters?(x2, y2)
  750.       return true
  751.     end
  752.  
  753.     def run_for_all_positions(x, y, &block)
  754.       if Enable_Hitbox
  755.         first_x = (x + hitbox_x_size).floor
  756.         last_x = (x + hitbox_x_size + hitbox_h_size - 0.01).floor
  757.         first_y = (y + hitbox_y_size).floor
  758.         last_y = (y + hitbox_y_size + hitbox_v_size - 0.01).floor
  759.  
  760.         for new_x in first_x..last_x
  761.           for new_y in first_y..last_y
  762.             result = block.call(new_x, new_y)
  763.  
  764.             return true if result == true
  765.           end
  766.         end
  767.  
  768.         return false
  769.       else
  770.         return true if block.call(x.floor, y.floor) == true
  771.  
  772.         if x != x.floor
  773.           return true if block.call(x.ceil, y.floor) == true
  774.  
  775.           if y != y.floor
  776.             return true if block.call(x.ceil, y.ceil) == true
  777.           end
  778.         end
  779.  
  780.         if y != y.floor
  781.           return true if block.call(x.floor, y.ceil) == true
  782.         end
  783.  
  784.         return false
  785.       end
  786.     end
  787.  
  788.     def collide_with_events?(x, y)
  789.       run_for_all_positions(x, y) do |block_x, block_y|
  790.         $game_map.events_xy_nt(block_x, block_y).any? do |event|
  791.           #If the player is "inside" it, then this event won't be considered,
  792.           #because if it did, the player would be locked on it
  793.           if is_touching_tile?(block_x, block_y)
  794.             false
  795.           else
  796.             event.normal_priority? || self.is_a?(Game_Event)
  797.           end
  798.         end
  799.       end
  800.     end
  801.  
  802.     def collide_with_vehicles?(x, y)
  803.       run_for_all_positions(x, y) do |block_x, block_y|
  804.         super(block_x, block_y)
  805.       end
  806.     end  
  807.  
  808.     def can_go_up?(x, y, recursive = true, step_size = Step_Size)
  809.       if Enable_Hitbox
  810.         the_x = x + hitbox_x_size
  811.         the_y = y + hitbox_y_size
  812.  
  813.         end_x = the_x + hitbox_h_size - 0.01
  814.         destination_y = the_y - step_size
  815.  
  816.         if the_y.floor != destination_y.floor
  817.           for new_x in the_x.floor..end_x.floor
  818.  
  819.  
  820.             return false unless $game_map.loop_passable?(new_x, the_y.floor, Direction.up)
  821.             return false unless $game_map.loop_passable?(new_x, destination_y.floor, Direction.down)
  822.             # return false unless $game_map.loop_passable?(new_x, destination_y.floor, Direction.up)
  823.           end
  824.         else
  825.           for new_x in the_x.floor..end_x.floor
  826.             return false unless $game_map.loop_passable?(new_x, the_y.floor, Direction.up) || $game_map.loop_passable?(new_x, the_y.floor, Direction.down)
  827.           end
  828.         end
  829.       else
  830.         y_diff = y.floor - y
  831.  
  832.         if y_diff < step_size
  833.           return false unless $game_map.loop_passable?(x.floor, y.floor, Direction.up)
  834.         end        
  835.  
  836.         if recursive
  837.           if x > x.floor
  838.             return false unless can_go_right?(x, y, false)
  839.           end
  840.         end
  841.       end
  842.  
  843.       return true
  844.     end
  845.  
  846.     def can_go_left?(x, y, recursive = true, step_size = Step_Size)
  847.       if Enable_Hitbox
  848.         the_x = x + hitbox_x_size
  849.         the_y = y + hitbox_y_size
  850.  
  851.         end_y = the_y + hitbox_v_size - 0.01
  852.         destination_x = the_x - step_size
  853.  
  854.         if the_x.floor != destination_x.floor
  855.           for new_y in the_y.floor..end_y.floor
  856.             return false unless $game_map.loop_passable?(the_x.floor, new_y, Direction.left)
  857.             return false unless $game_map.loop_passable?(destination_x.floor, new_y, Direction.right)
  858.           end
  859.         else
  860.           for new_y in the_y.floor..end_y.floor
  861.             return false unless $game_map.loop_passable?(the_x.floor, new_y, Direction.left) || $game_map.loop_passable?(the_x.floor, new_y, Direction.right)
  862.           end         
  863.         end
  864.       else
  865.         x_diff = x.floor - x
  866.  
  867.         if x_diff < step_size
  868.           return false unless $game_map.loop_passable?(x.floor, y.floor, Direction.left)
  869.         end
  870.  
  871.         if recursive
  872.           if y > y.floor
  873.             return false unless can_go_down?(x, y, false)
  874.           end
  875.         end
  876.       end
  877.  
  878.  
  879.       return true
  880.     end
  881.  
  882.     def can_go_down?(x, y, recursive = true, step_size = Step_Size)
  883.       if Enable_Hitbox
  884.         the_x = x + hitbox_x_size
  885.         the_y = y + hitbox_y_size
  886.  
  887.         end_x = the_x + hitbox_h_size - 0.01
  888.         end_y = the_y + hitbox_v_size - 0.01
  889.         destination_y = the_y + step_size
  890.         destination_end_y = end_y + step_size
  891.  
  892.         if end_y.floor != destination_end_y.floor
  893.           for new_x in the_x.floor..end_x.floor
  894.             return false unless $game_map.loop_passable?(new_x, end_y.floor, Direction.down)
  895.             return false unless $game_map.loop_passable?(new_x, destination_end_y.floor, Direction.up)
  896.           end
  897.         end
  898.       else
  899.         return false unless $game_map.loop_passable?(x.floor, y.floor, Direction.down)
  900.         return false unless $game_map.loop_passable?(x.floor, y.floor + 1, Direction.up)
  901.  
  902.         if x > x.floor
  903.           return false unless $game_map.loop_passable?(x.floor + 1, y.floor, Direction.down)
  904.           #I'm not sure if "y.floor + 1" is right, shouldn't it be y.ceil and only if that's different from y.floor?
  905.           return false unless $game_map.loop_passable?(x.floor + 1, y.floor + 1, Direction.up)
  906.         end
  907.  
  908.         if y > y.floor && y + step_size >= y.ceil
  909.           return false unless $game_map.loop_passable?(x.ceil, y.ceil, Direction.down)
  910.         end
  911.  
  912.         if recursive
  913.           if x > x.floor
  914.             return false unless can_go_right?(x, y, false)
  915.           end
  916.         end
  917.       end
  918.  
  919.       true
  920.     end
  921.  
  922.     def can_go_right?(x, y, recursive = true, step_size = Step_Size)
  923.       if Enable_Hitbox
  924.         the_x = x + hitbox_x_size
  925.         the_y = y + hitbox_y_size
  926.  
  927.         end_x = the_x + hitbox_h_size - 0.01
  928.         end_y = the_y + hitbox_v_size - 0.01
  929.         destination_x = the_x + step_size
  930.         destination_end_x = end_x + step_size
  931.  
  932.         if end_x.floor != destination_end_x.floor
  933.           for new_y in the_y.floor..end_y.floor
  934.             return false unless $game_map.loop_passable?(end_x.floor, new_y, Direction.right)
  935.             return false unless $game_map.loop_passable?(destination_end_x.floor, new_y, Direction.left)
  936.           end
  937.         end
  938.       else
  939.         return false unless $game_map.loop_passable?(x.floor, y.floor, Direction.right)
  940.         return false unless $game_map.loop_passable?(x.floor + 1, y.floor, Direction.left)
  941.  
  942.         if x > x.floor && x + step_size >= x.ceil
  943.           return false unless $game_map.loop_passable?(x.ceil, y.floor, Direction.right)
  944.         end
  945.  
  946.         if y > y.floor
  947.           return false unless $game_map.loop_passable?(x.floor, y.ceil, Direction.right)
  948.           #I'm not sure if "x.floor + 1" is right, shouldn't it be x.ceil and only if that's different from x.floor?
  949.           return false unless $game_map.loop_passable?(x.floor + 1, y.ceil, Direction.left)
  950.  
  951.           if y + step_size >= y.ceil
  952.             return false unless $game_map.loop_passable?(x.floor, y.floor, Direction.right)
  953.           end
  954.         end        
  955.  
  956.         if recursive
  957.           if y > y.floor
  958.             return false unless can_go_down?(x, y, false)
  959.           end
  960.         end
  961.       end
  962.  
  963.       true
  964.     end
  965.  
  966.     def module_map_passable?(x, y, d)
  967.       if direction_goes_up?(d)
  968.         return false unless can_go_up?(x, y)
  969.       elsif direction_goes_down?(d)
  970.         return false unless can_go_down?(x, y)
  971.       end
  972.  
  973.       if direction_goes_left?(d)
  974.         return false unless can_go_left?(x, y)
  975.       elsif direction_goes_right?(d)
  976.         return false unless can_go_right?(x, y)
  977.       end
  978.  
  979.       return true
  980.     end
  981.  
  982.     def diagonal_passable?(x, y, horz, vert)
  983.       x2 = $game_map.round_player_x_with_direction(x, horz, my_step_size)
  984.       y2 = $game_map.round_player_y_with_direction(y, vert, my_step_size)
  985.  
  986.       if passable?(x, y, vert) && passable?(x, y2, horz)
  987.         return true
  988.       end
  989.  
  990.       if passable?(x, y, horz) && passable?(x2, y, vert)
  991.         return true
  992.       end
  993.  
  994.       return false
  995.     end
  996.  
  997.     def module_move_straight(d, turn_ok = true)
  998.       @move_succeed = passable?(@x, @y, d)
  999.       if @move_succeed
  1000.         set_direction(d)
  1001.  
  1002.         if Align_To_Grid == true
  1003.           if (move_route_forcing && Fixed_Move_Route_Use_Pixel_Movement == false) || OrangeMovement::Tile_Sections == 1
  1004.             case d
  1005.             when Direction.left
  1006.               step_size = @x - @x.floor
  1007.             when Direction.right
  1008.               step_size = @x.ceil - @x
  1009.             when Direction.up
  1010.               step_size = @y - @y.floor
  1011.             when Direction.down
  1012.               step_size = @y.ceil - @y
  1013.             else
  1014.               step_size = 0
  1015.             end
  1016.  
  1017.             step_size = my_step_size if step_size == 0
  1018.           else
  1019.             step_size = my_step_size
  1020.           end
  1021.         else
  1022.           step_size = my_step_size
  1023.         end
  1024.  
  1025.         @x = $game_map.round_player_x_with_direction(@x, d, step_size)
  1026.         @y = $game_map.round_player_y_with_direction(@y, d, step_size)
  1027.         @real_x = $game_map.player_x_with_direction(@x, reverse_dir(d), step_size)
  1028.         @real_y = $game_map.player_y_with_direction(@y, reverse_dir(d), step_size)
  1029.  
  1030.         increase_steps
  1031.       elsif turn_ok
  1032.         set_direction(d)
  1033.         check_event_trigger_touch_front
  1034.       end
  1035.     end   
  1036.  
  1037.     def module_move_diagonal(horz, vert)
  1038.       @move_succeed = diagonal_passable?(@x, @y, horz, vert)
  1039.       if @move_succeed
  1040.         vert_step_size = my_step_size
  1041.         horz_step_size = my_step_size
  1042.  
  1043.         if Align_To_Grid == true
  1044.           if (move_route_forcing && Fixed_Move_Route_Use_Pixel_Movement == false) || (OrangeMovement::Tile_Sections == 1)
  1045.             case horz
  1046.             when Direction.left
  1047.               horz_step_size = @x - @x.floor
  1048.             when Direction.right
  1049.               horz_step_size = @x.ceil - @x
  1050.             else
  1051.               horz_step_size = 0
  1052.             end
  1053.  
  1054.             case vert
  1055.             when Direction.up
  1056.               vert_step_size = @y - @y.floor
  1057.             when Direction.down
  1058.               vert_step_size = @y.ceil - @y
  1059.             else
  1060.               vert_step_size = 0
  1061.             end
  1062.  
  1063.             horz_step_size = my_step_size if horz_step_size == 0
  1064.             vert_step_size = my_step_size if vert_step_size == 0
  1065.           end
  1066.         end
  1067.  
  1068.         @x = $game_map.round_player_x_with_direction(@x, horz, horz_step_size)
  1069.         @y = $game_map.round_player_y_with_direction(@y, vert, vert_step_size)
  1070.         @real_x = $game_map.player_x_with_direction(@x, reverse_dir(horz), horz_step_size)
  1071.         @real_y = $game_map.player_y_with_direction(@y, reverse_dir(vert), vert_step_size)
  1072.         increase_steps
  1073.       end
  1074.       set_direction(horz) if @direction == reverse_dir(horz)
  1075.       set_direction(vert) if @direction == reverse_dir(vert)
  1076.     end
  1077.   end
  1078.  
  1079.   class Game_Follower < Game_Character
  1080.     include OrangeMovement
  1081.     include Orange_Character
  1082.     # include Orange_ActorCharacter
  1083.  
  1084.     alias :hudell_orange_movement_game_follower_map_passable? :map_passable?
  1085.     def map_passable?(x, y, d)
  1086.       return hudell_orange_movement_game_follower_map_passable?(x, y, d) unless enabled?
  1087.  
  1088.       return module_map_passable?(x, y, d)
  1089.     end
  1090.  
  1091.     alias :orange_movement_game_follower_move_straight :move_straight
  1092.     def move_straight(d, turn_ok = true)
  1093.       return orange_movement_game_follower_move_straight(d, turn_ok) unless enabled?
  1094.  
  1095.       module_move_straight(d, turn_ok)
  1096.     end
  1097.  
  1098.     alias :orange_movement_game_follower_move_diagonal :move_diagonal
  1099.     def move_diagonal(horz, vert)
  1100.       return orange_movement_game_follower_move_diagonal(horz, vert) unless enabled?
  1101.       module_move_diagonal(horz, vert)
  1102.     end
  1103.  
  1104.     alias :orange_movement_game_follower_chase_preceding_character :chase_preceding_character
  1105.     def chase_preceding_character
  1106.       return orange_movement_game_follower_chase_preceding_character unless enabled?
  1107.  
  1108.       unless moving?
  1109.         ideal_x = @preceding_character.float_x
  1110.         ideal_y = @preceding_character.float_y
  1111.  
  1112.         case @preceding_character.direction
  1113.         when 2
  1114.           ideal_y -= 1
  1115.         when 4
  1116.           ideal_x += 1
  1117.         when 6
  1118.           ideal_x -= 1
  1119.         when 8
  1120.           ideal_y += 1
  1121.         end
  1122.  
  1123.         sx = distance_x_from(ideal_x)
  1124.         sy = distance_y_from(ideal_y)
  1125.         if sx.abs >= Step_Size && sy.abs >= Step_Size
  1126.           move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
  1127.         elsif sx.abs >= Step_Size
  1128.           move_straight(sx > 0 ? 4 : 6)
  1129.         elsif sy.abs >= Step_Size
  1130.           move_straight(sy > 0 ? 8 : 2)
  1131.         end
  1132.       end
  1133.     end
  1134.   end
  1135.  
  1136.   class Game_Player < Game_Character
  1137.     include OrangeMovement
  1138.     include Orange_Character
  1139.     include Orange_ActorCharacter
  1140.  
  1141.     def my_step_size
  1142.       if move_route_forcing && Fixed_Move_Route_Use_Pixel_Movement == false
  1143.         1
  1144.       else
  1145.         Step_Size
  1146.       end
  1147.     end
  1148.  
  1149.     def region_inside_rect?(left, right, top, down, region_id)
  1150.       for x in (left.floor)..(right.floor)
  1151.         for y in (top.floor)..(down.floor)
  1152.           if region_id.is_a? Array
  1153.             region_id.each do |id|
  1154.               return true if $game_map.region_id(x, y) == id
  1155.             end
  1156.           else
  1157.             return true if $game_map.region_id(x, y) == region_id
  1158.           end
  1159.         end
  1160.       end
  1161.  
  1162.       false
  1163.     end
  1164.  
  1165.     def feet_touching_region?(region_id)
  1166.       min_x, min_y, max_x, max_y = position_data
  1167.       #Checks only the max_y
  1168.       region_inside_rect?(min_x, max_x, max_y, max_y, region_id)
  1169.     end
  1170.  
  1171.     def touching_region?(region_id)
  1172.       min_x, min_y, max_x, max_y = position_data
  1173.       region_inside_rect?(min_x, max_x, min_y, max_y, region_id)
  1174.     end
  1175.  
  1176.     def update_actor_graphic
  1177.       if OrangeMovement::Use_Dashing_Sprites
  1178.         @was_moving = false if @was_moving.nil?
  1179.  
  1180.         if actor
  1181.           #Change actor graphic if they are running or not
  1182.           if dash? && (moving? || @was_moving) && SceneManager.scene_is?(Scene_Map)
  1183.             new_sprite_name = actor.dashing_sprite_name
  1184.             new_sprite_index = actor.dashing_sprite_index
  1185.           else
  1186.             new_sprite_name = actor.walking_sprite_name
  1187.             new_sprite_index = actor.walking_sprite_index
  1188.           end
  1189.  
  1190.           unless new_sprite_name.nil? || new_sprite_index.nil?
  1191.             if new_sprite_name != $game_player.character_name || new_sprite_index != $game_player.character_index
  1192.               $game_map.interpreter.change_actor_graphic(actor.id, new_sprite_name, new_sprite_index, actor.face_name, actor.face_index)
  1193.             end
  1194.           end
  1195.         end
  1196.  
  1197.         @was_moving = moving?
  1198.       end      
  1199.     end
  1200.  
  1201.     alias :hudell_orange_movement_game_player_update :update
  1202.     def update
  1203.       @moved_last_frame = false if @moved_last_frame.nil?
  1204.  
  1205.       update_actor_graphic
  1206.  
  1207.       last_real_x = @real_x
  1208.       last_real_y = @real_y
  1209.       last_moving = moving?
  1210.  
  1211.       hudell_orange_movement_game_player_update
  1212.  
  1213.       moved = @real_y != last_real_y || @real_x != last_real_x
  1214.  
  1215.       #Edge case: the player moved to the destination so fast that the Game_Player class thought he didn't move at all
  1216.       #This happens when dashing with Tile_Sections = 8
  1217.       if moved && !moving? && !last_moving
  1218.         $game_party.on_player_walk
  1219.         check_touch_event
  1220.       end
  1221.  
  1222.       @moved_last_frame = moved
  1223.  
  1224.       unless Auto_Jump == false
  1225.         if enabled?
  1226.           @jump_delay = Auto_Jump_Delay if @jump_delay.nil?
  1227.           @jump_delay -= 1 unless @jump_delay == 0
  1228.         end
  1229.       end
  1230.     end
  1231.  
  1232.     alias :hudell_orange_movement_game_player_map_passable? :map_passable?
  1233.     def map_passable?(x, y, d)
  1234.       return hudell_orange_movement_game_player_map_passable?(x, y, d) unless enabled?
  1235.  
  1236.       return module_map_passable?(x, y, d)
  1237.     end
  1238.  
  1239.     alias :orange_movement_game_player_move_straight :move_straight
  1240.     def move_straight(d, turn_ok = true)
  1241.       return orange_movement_game_player_move_straight(d, turn_ok) unless enabled?
  1242.  
  1243.       module_move_straight(d, turn_ok)
  1244.       @followers.move if @move_succeed
  1245.     end
  1246.  
  1247.     alias :orange_movement_game_player_move_diagonal :move_diagonal
  1248.     def move_diagonal(horz, vert)
  1249.       return orange_movement_game_player_move_diagonal(horz, vert) unless enabled?
  1250.       module_move_diagonal(horz, vert)
  1251.  
  1252.       @followers.move if @move_succeed
  1253.     end
  1254.  
  1255.     alias :orange_movement_game_player_start_map_event :start_map_event
  1256.     def start_map_event(x, y, triggers, normal)
  1257.       return orange_movement_game_player_start_map_event(x, y, triggers, normal) unless enabled?
  1258.       return if $game_map.interpreter.running?
  1259.  
  1260.       run_for_all_positions(x, y) do |block_x, block_y|
  1261.         unless Trigger_All_Events
  1262.           return if $game_map.any_event_starting?
  1263.         end
  1264.  
  1265.         #If any of those two settings is enabled, then we have to use the custom "start_map_event"
  1266.         if Block_Repeated_Event_Triggering == true || OrangeMovement::Ignore_Empty_Events == true
  1267.           do_actual_start_map_event(block_x, block_y, triggers, normal)
  1268.         else
  1269.           #If they are both disabled, then run the standard "start_map_event" to keep compatibility with scripts that use it
  1270.           orange_movement_game_player_start_map_event(block_x, block_y, triggers, normal)
  1271.         end
  1272.       end
  1273.     end
  1274.  
  1275.     def event_has_anything_to_run?(event)
  1276.       return true unless OrangeMovement::Ignore_Empty_Events == true
  1277.  
  1278.       event.list.each do |command|
  1279.         next if command.code == 108 || command.code == 408 #comments
  1280.         next if command.code == 118 #Label
  1281.         next if command.code == 0 #End of list
  1282.  
  1283.         return true
  1284.       end
  1285.  
  1286.       return false
  1287.     end
  1288.  
  1289.     def do_actual_start_map_event(block_x, block_y, triggers, normal)
  1290.       return if is_tile_checked?(block_x, block_y)
  1291.  
  1292.       $game_map.events_xy(block_x, block_y).each do |event|
  1293.         next if event.erased
  1294.  
  1295.         if event.trigger_in?(triggers) && event.normal_priority? == normal && event_has_anything_to_run?(event)
  1296.           mark_tile_as_checked(event.x, event.y) if event.trigger == 1 || event.trigger == 2
  1297.           event.start
  1298.         end
  1299.       end
  1300.     end
  1301.  
  1302.     def is_tile_checked?(block_x, block_y)
  1303.       return false if @checked_tiles.nil?
  1304.  
  1305.       @checked_tiles.each do |tile|
  1306.         next if tile[:x] != block_x
  1307.         next if tile[:y] != block_y
  1308.  
  1309.         return true
  1310.       end
  1311.  
  1312.       return false
  1313.     end
  1314.  
  1315.     def mark_tile_as_checked(x, y)
  1316.       @checked_tiles = [] if @checked_tiles.nil?
  1317.       @checked_tiles << {:x => x, :y => y}
  1318.     end
  1319.  
  1320.     def clear_checked_tiles
  1321.       return if @checked_tiles.nil?
  1322.       new_list = []
  1323.  
  1324.       @checked_tiles.each do |tile|
  1325.         next if tile[:x] != $game_player.float_x.floor && tile[:x] != $game_player.float_x.ceil
  1326.         next if tile[:y] != $game_player.float_y.floor && tile[:y] != $game_player.float_y.ceil
  1327.  
  1328.         new_list << tile
  1329.       end
  1330.  
  1331.       @checked_tiles = new_list
  1332.     end
  1333.  
  1334.     unless OrangeMovement::Auto_Jump == false && OrangeMovement::Auto_Avoid == false
  1335.       alias :orange_movement_game_player_move_by_input :move_by_input
  1336.       def move_by_input
  1337.         return orange_movement_game_player_move_by_input unless enabled?
  1338.         return if !movable? || $game_map.interpreter.running?
  1339.  
  1340.         @avoid_diagonally_delay = 0 if @avoid_diagonally_delay.nil?
  1341.         @avoid_offset_delay = 0 if @avoid_offset_delay.nil?
  1342.  
  1343.         button = :DOWN
  1344.  
  1345.         d = Input.dir4
  1346.         diagonal_d = Input.dir8
  1347.         alternative_d = d
  1348.         return false unless input_direction_enabled?(d)
  1349.  
  1350.         #If the player is trying to move diagonally and the non-diagonal direction is unavailable, try the other non-diagonal direction
  1351.         if d != diagonal_d
  1352.           case diagonal_d
  1353.           when Direction.up_left
  1354.             alternative_d = d == Direction.up ? Direction.left : Direction.up
  1355.           when Direction.up_right
  1356.             alternative_d = d == Direction.up ? Direction.right : Direction.up
  1357.           when Direction.down_left
  1358.             alternative_d = d == Direction.down ? Direction.left : Direction.down
  1359.           when Direction.down_right
  1360.             alternative_d = d == Direction.down ? Direction.right : Direction.down
  1361.           end
  1362.         end
  1363.  
  1364.         case d
  1365.           when 2; button = :DOWN
  1366.           when 4; button = :LEFT
  1367.           when 6; button = :RIGHT
  1368.           when 8; button = :UP
  1369.         end
  1370.  
  1371.         clear_checked_tiles
  1372.  
  1373.         if passable?(@x, @y, d) || passable?(@x, @y, alternative_d)
  1374.           #Restart the delay
  1375.           if Auto_Avoid_Ignore_Delay_When_Dashing && dash?
  1376.             @avoid_diagonally_delay = 0
  1377.             @avoid_offset_delay = 0
  1378.           else
  1379.             @avoid_diagonally_delay = Auto_Avoid_Diagonally_Delay
  1380.             @avoid_offset_delay = Auto_Avoid_Offset_Delay
  1381.           end
  1382.  
  1383.           #Try the diagonal movement first
  1384.           unless OrangeMovement::Enable_Diagonal_Movement == false
  1385.             do_movement(diagonal_d)
  1386.             return if @move_succeed
  1387.           end
  1388.  
  1389.           do_movement(d)
  1390.           do_movement(alternative_d) unless @move_succeed
  1391.         else
  1392.           tileset_passable = tileset_passable?(@x, @y, d)
  1393.           should_try_jumping = true
  1394.           max_offset = Auto_Avoid_Max_Offset
  1395.           should_try_avoiding_diagonally = Auto_Avoid == true
  1396.           should_try_avoiding_walking_around = Auto_Avoid == true && Auto_Avoid_Max_Offset != false
  1397.  
  1398.           if tileset_passable
  1399.             x2 = $game_map.round_player_x_with_direction(@x, d, my_step_size)
  1400.             y2 = $game_map.round_player_y_with_direction(@y, d, my_step_size)
  1401.  
  1402.             if collide_with_characters?(x2, y2)
  1403.               if should_try_avoiding_diagonally
  1404.                 if Auto_Avoid_Events_Diagonally
  1405.                   if Auto_Avoid_Events_Diagonally_Only_When_Dashing
  1406.                     should_try_avoiding_diagonally = dash?
  1407.                   end
  1408.                 else
  1409.                   should_try_avoiding_diagonally = false
  1410.                 end
  1411.               end
  1412.               if should_try_avoiding_walking_around
  1413.                 if Auto_Avoid_Events_Walking_Around
  1414.                   if Auto_Avoid_Events_Walking_Around_Only_When_Dashing
  1415.                     should_try_avoiding_walking_around = dash?
  1416.                   end
  1417.                 else
  1418.                   should_try_avoiding_walking_around = false
  1419.                 end
  1420.                 max_offset = Auto_Avoid_Events_Max_Offset
  1421.               end
  1422.             end
  1423.           end
  1424.  
  1425.           if Auto_Avoid_Try_Jumping_First == true
  1426.             return true if call_jump(d)
  1427.             should_try_jumping = false
  1428.           end
  1429.  
  1430.  
  1431.           if should_try_avoiding_diagonally
  1432.             if try_to_avoid(d)
  1433.               should_try_jumping = false
  1434.               should_try_avoiding_walking_around = false
  1435.             end
  1436.           end
  1437.  
  1438.           if should_try_jumping
  1439.             return true if call_jump(d)
  1440.           end
  1441.  
  1442.           if should_try_avoiding_walking_around
  1443.             return true if try_to_avoid_again(d, max_offset)
  1444.           end
  1445.  
  1446.           if @direction != d
  1447.             set_direction(d)
  1448.             check_event_trigger_touch_front
  1449.           end
  1450.  
  1451.           @avoid_diagonally_delay -= 1 if @avoid_diagonally_delay > 0
  1452.           @avoid_offset_delay -= 1 if @avoid_offset_delay > 0
  1453.         end
  1454.       end
  1455.  
  1456.       def call_jump(d)
  1457.         if Auto_Jump == true || (Auto_Jump.is_a?(Fixnum) && Auto_Jump > 0 && $game_switches[Auto_Jump])
  1458.           if !Auto_Jump_Only_When_Dashing || dash?
  1459.             if !Auto_Jump_Only_When_Alone || $game_party.members.length == 1
  1460.               return true if try_to_jump(d)
  1461.             end
  1462.           end
  1463.         end
  1464.  
  1465.         return false
  1466.       end
  1467.  
  1468.       def do_movement(d)
  1469.         case d
  1470.           when 2, 4, 6, 8
  1471.             move_straight(d, true)
  1472.           when 1
  1473.             move_diagonal(4, 2)
  1474.           when 3
  1475.             move_diagonal(6, 2)
  1476.           when 7
  1477.             move_diagonal(4, 8)
  1478.           when 9
  1479.             move_diagonal(6, 8)
  1480.         end
  1481.       end      
  1482.     end
  1483.  
  1484.     unless OrangeMovement::Auto_Avoid == false
  1485.       def try_to_avoid(d)
  1486.         return false if Auto_Avoid_Diagonally == false
  1487.  
  1488.         if Auto_Avoid_Diagonally_Only_When_Dashing == true
  1489.           return false unless dash?
  1490.         end
  1491.  
  1492.         return false if @avoid_diagonally_delay > 0
  1493.  
  1494.         if d == Direction.left || d == Direction.right
  1495.           if diagonal_passable?(@x, @y, d, Direction.down)
  1496.             do_movement(d - 3)
  1497.             return true
  1498.           elsif diagonal_passable?(@x, @y, d, Direction.up)
  1499.             do_movement(d + 3)
  1500.             return true
  1501.           end
  1502.         elsif d == Direction.up || d == Direction.down
  1503.           if diagonal_passable?(@x, @y, Direction.left, d)
  1504.             do_movement(d - 1)
  1505.             return true
  1506.           elsif diagonal_passable?(@x, @y, Direction.right, d)
  1507.             do_movement(d + 1)
  1508.             return true
  1509.           end
  1510.         end
  1511.  
  1512.         return false
  1513.       end
  1514.  
  1515.       #If the first try failed, try again considering the offset
  1516.       def try_to_avoid_again(d, max_offset)
  1517.         return false if Auto_Avoid_Walking_Around == false
  1518.  
  1519.         if Auto_Avoid_Offset_Only_When_Dashing == true
  1520.           return false unless dash?
  1521.         end
  1522.  
  1523.         return false if @avoid_offset_delay > 0
  1524.  
  1525.         if d == Direction.left || d == Direction.right
  1526.           #If the player can't walk diagonally on the current position, but would be able to walk if he were a little higher or lower then move vertically instead
  1527.           #on the next iterations it will keep trying to move diagonally again and it will eventually work before the offset is reached
  1528.  
  1529.           offset = Step_Size
  1530.           while offset <= max_offset
  1531.             if diagonal_passable?(@x, @y + offset, d, Direction.down)
  1532.               do_movement(Direction.down)
  1533.               set_direction(d) if Auto_Avoid_Retain_Direction == true
  1534.  
  1535.               return true
  1536.             elsif diagonal_passable?(@x, @y - offset, d, Direction.up)
  1537.               do_movement(Direction.up)
  1538.  
  1539.               set_direction(d) if Auto_Avoid_Retain_Direction == true
  1540.               return true
  1541.             end
  1542.  
  1543.             offset += Step_Size
  1544.           end
  1545.         elsif d == Direction.up || d == Direction.down
  1546.           offset = Step_Size
  1547.           while offset <= max_offset
  1548.             if diagonal_passable?(@x + offset, @y, Direction.right, d)
  1549.               do_movement(Direction.right)
  1550.               set_direction(d) if Auto_Avoid_Retain_Direction == true
  1551.  
  1552.               return true
  1553.             elsif diagonal_passable?(@x - offset, @y, Direction.left, d)
  1554.               do_movement(Direction.left)
  1555.  
  1556.               set_direction(d) if Auto_Avoid_Retain_Direction == true
  1557.               return true
  1558.             end
  1559.  
  1560.             offset += Step_Size
  1561.           end
  1562.         end
  1563.  
  1564.         return false
  1565.       end
  1566.     end
  1567.  
  1568.     unless OrangeMovement::Auto_Jump == false
  1569.       def events_allow_jump?(destination_x, destination_y)
  1570.         return true if Auto_Jump_Over_Events == true
  1571.         return false if Auto_Jump_Over_Events == false
  1572.  
  1573.         #Conditional jumping has not been implemented yet
  1574.         return true
  1575.       end
  1576.  
  1577.       def on_jump
  1578.         return if Auto_Jump_Sound_Effect == false
  1579.  
  1580.         se = Auto_Jump_Sound_Effect
  1581.         if se.is_a? Array
  1582.           se = se.sample
  1583.         end
  1584.  
  1585.         volume = Auto_Jump_Sound_Effect_Volume
  1586.         pitch = Auto_Jump_Sound_Effect_Pitch
  1587.  
  1588.         if pitch.is_a? Range
  1589.           pitch = pitch.to_a
  1590.         end
  1591.  
  1592.         if pitch.is_a? Array
  1593.           pitch = pitch.sample
  1594.         end
  1595.  
  1596.         RPG::SE.new(se, volume, pitch).play
  1597.       end
  1598.  
  1599.       def do_jump(jump_x, jump_y, go_through = true)
  1600.         old_through = @through
  1601.  
  1602.         if go_through
  1603.           @through = true
  1604.         end
  1605.  
  1606.         on_jump
  1607.         jump(jump_x, jump_y)
  1608.  
  1609.         if go_through
  1610.           @through = old_through
  1611.         end
  1612.  
  1613.         return true
  1614.       end
  1615.  
  1616.       def try_to_jump(d)
  1617.         jump_x = 0
  1618.         jump_y = 0
  1619.  
  1620.         case d
  1621.           when 2
  1622.             jump_y = 1
  1623.           when 4
  1624.             jump_x = -1
  1625.           when 6
  1626.             jump_x = 1
  1627.           when 8
  1628.             jump_y = -1
  1629.         end
  1630.  
  1631.         #origin is the tile where the player is
  1632.         #destination is the tile where the player will jump to
  1633.         origin_x = float_x
  1634.         origin_y = float_y
  1635.         destination_x = origin_x + jump_x
  1636.         destination_y = origin_y + jump_y
  1637.         jumped = false
  1638.  
  1639.         if @jump_delay.nil? || @jump_delay == 0
  1640.           # jump over events
  1641.  
  1642.           if collide_with_characters?(destination_x, destination_y)
  1643.             if events_allow_jump?(destination_x, destination_y)
  1644.               if can_jump_over_event?(origin_x, origin_y, d)
  1645.                 jump_x *= 2
  1646.                 jump_y *= 2
  1647.  
  1648.                 destination_x = float_x + jump_x
  1649.                 destination_y = float_y + jump_y
  1650.  
  1651.                 unless collide_with_characters?(destination_x, destination_y)
  1652.                   do_jump(jump_x, jump_y)
  1653.                   return true
  1654.                 end
  1655.               end
  1656.             end
  1657.           end
  1658.         end
  1659.  
  1660.         unless Auto_Jump_Region_Id == false
  1661.           #If it's jumping to the next tile
  1662.           if passable_any_direction?(destination_x, destination_y)
  1663.             if (Auto_Jump_Region_Id == true) || ($game_map.region_id(origin_x, origin_y) == Auto_Jump_Region_Id) || ($game_map.region_id(destination_x, destination_y) == Auto_Jump_Region_Id)
  1664.               jumped = jump_if_clear(jump_x, jump_y, d)
  1665.             end
  1666.           else
  1667.             #this "else" treats the case where the player is jumping over a whole tile, stopping two tiles away from it's original position            
  1668.             if collide_with_characters?(destination_x, destination_y)
  1669.               return
  1670.             end
  1671.  
  1672.             #Check if the tile allow's jump
  1673.             if (Auto_Jump_Region_Id == true) || ($game_map.region_id(destination_x, destination_y) == Auto_Jump_Region_Id)
  1674.               #Updates the destination tile
  1675.               jump_x *= 2
  1676.               jump_y *= 2
  1677.  
  1678.               destination_x = origin_x + jump_x
  1679.               destination_y = origin_y + jump_y
  1680.  
  1681.               if passable_any_direction?(destination_x, destination_y)
  1682.                 jumped = jump_if_clear(jump_x, jump_y, d)
  1683.               end
  1684.             end
  1685.           end
  1686.         end
  1687.  
  1688.         return true if jumped
  1689.         return false unless Auto_Jump_Fall_Enabled == true
  1690.  
  1691.         case d
  1692.           #when falling down, it should test the front tile instead, because on this case the "fallable" area is visible on screen
  1693.         when Direction.down; return fall_down if position_has_region?(x, y + 1, Auto_Jump_Fall_Down_Region)
  1694.         when Direction.left; return fall_left if position_has_region?(float_x, y, Auto_Jump_Fall_Left_Region)
  1695.         when Direction.right; return fall_right if position_has_region?(float_x, y, Auto_Jump_Fall_Right_Region)
  1696.         when Direction.up; return fall_up if position_has_region?(x, y, Auto_Jump_Fall_Up_Region)
  1697.         end
  1698.  
  1699.         return false
  1700.       end
  1701.  
  1702.       def position_has_region?(x, y, region_id)
  1703.         return true if $game_map.region_id(x.floor, y.floor) == region_id
  1704.         return true if $game_map.region_id(x.floor, y.ceil) == region_id
  1705.         return true if $game_map.region_id(x.ceil, y.ceil) == region_id
  1706.         return true if $game_map.region_id(x.ceil, y.floor) == region_id
  1707.         false
  1708.       end
  1709.  
  1710.       def fall_down
  1711.         fall_x = x
  1712.         fall_x2 = x
  1713.         jump_y = 1
  1714.         fall_y = float_y + jump_y
  1715.  
  1716.         if x != float_x
  1717.           fall_x = float_x.floor
  1718.           fall_x2 = float_x.ceil
  1719.         end
  1720.  
  1721.         return false unless position_has_region?(fall_x2, fall_y, Auto_Jump_Fall_Down_Region)
  1722.  
  1723.         #While the region doesn't change, keep falling
  1724.         while position_has_region?(fall_x, fall_y, Auto_Jump_Fall_Down_Region) && position_has_region?(fall_x2, fall_y, Auto_Jump_Fall_Down_Region)
  1725.  
  1726.           #If it's an invalid tile, abort falling
  1727.           return false if !$game_map.valid?(fall_x, fall_y.floor)
  1728.           return false if !$game_map.valid?(fall_x2, fall_y.floor)
  1729.           return false if !$game_map.valid?(fall_x, fall_y.ceil)
  1730.           return false if !$game_map.valid?(fall_x2, fall_y.ceil)
  1731.  
  1732.           jump_y += 1
  1733.           fall_y = y + jump_y
  1734.         end
  1735.  
  1736.         return jump_if_clear(0, jump_y, Direction.down, true)
  1737.       end
  1738.  
  1739.       def fall_left
  1740.         jump_x = -1
  1741.         fall_x = float_x + jump_x
  1742.         fall_y = y
  1743.         fall_y2 = y
  1744.  
  1745.         if y != float_y
  1746.           fall_y = float_y.floor
  1747.           fall_y2 = float_y.ceil
  1748.         end
  1749.  
  1750.         return false unless $game_map.region_id(x, fall_y2) == Auto_Jump_Fall_Left_Region
  1751.  
  1752.         #While the region doesn't change, keep falling
  1753.         while position_has_region?(fall_x, fall_y, Auto_Jump_Fall_Left_Region) && position_has_region?(fall_x, fall_y2, Auto_Jump_Fall_Left_Region)
  1754.           #If it's an invalid tile, abort falling
  1755.           return false if !$game_map.valid?(fall_x.floor, fall_y)
  1756.           return false if !$game_map.valid?(fall_x.floor, fall_y2)
  1757.           return false if !$game_map.valid?(fall_x.ceil, fall_y)
  1758.           return false if !$game_map.valid?(fall_x.ceil, fall_y2)
  1759.  
  1760.           jump_x -= 1
  1761.           fall_x = x + jump_x
  1762.         end
  1763.  
  1764.         return jump_if_clear(jump_x, 0, Direction.left, true)        
  1765.       end
  1766.  
  1767.       def fall_right
  1768.         jump_x = 1
  1769.         fall_x = float_x + jump_x
  1770.         fall_y = y
  1771.         fall_y2 = y
  1772.  
  1773.         if y != float_y
  1774.           fall_y = float_y.floor
  1775.           fall_y2 = float_y.ceil
  1776.         end
  1777.  
  1778.         return false unless position_has_region?(float_x, fall_y2, Auto_Jump_Fall_Right_Region)
  1779.  
  1780.         #While the region doesn't change, keep falling
  1781.         while position_has_region?(fall_x, fall_y, Auto_Jump_Fall_Right_Region) && position_has_region?(fall_x, fall_y2, Auto_Jump_Fall_Right_Region)
  1782.           #If it's an invalid tile, abort falling
  1783.           return false if !$game_map.valid?(fall_x.floor, fall_y)
  1784.           return false if !$game_map.valid?(fall_x.floor, fall_y2)
  1785.           return false if !$game_map.valid?(fall_x.ceil, fall_y)
  1786.           return false if !$game_map.valid?(fall_x.ceil, fall_y2)
  1787.  
  1788.           jump_x += 1
  1789.           fall_x = x + jump_x
  1790.         end
  1791.  
  1792.         return jump_if_clear(jump_x, 0, Direction.right, true)        
  1793.       end
  1794.  
  1795.       def fall_up
  1796.         fall_x = x
  1797.         fall_x2 = x
  1798.         jump_y = -1
  1799.         fall_y = float_y + jump_y
  1800.  
  1801.         if x != float_x
  1802.           fall_x = float_x.floor
  1803.           fall_x2 = float_x.ceil
  1804.         end
  1805.  
  1806.         return false unless position_has_region?(fall_x2, float_y, Auto_Jump_Fall_Up_Region)
  1807.  
  1808.         #While the region doesn't change, keep falling
  1809.         while position_has_region?(fall_x, fall_y, Auto_Jump_Fall_Up_Region) && position_has_region?(fall_x2, fall_y, Auto_Jump_Fall_Up_Region)
  1810.           #If it's an invalid tile, abort falling
  1811.           return false if !$game_map.valid?(fall_x, fall_y)
  1812.           return false if !$game_map.valid?(fall_x2, fall_y)
  1813.  
  1814.           jump_y -= 1
  1815.           fall_y = y + jump_y
  1816.         end
  1817.  
  1818.         return jump_if_clear(0, jump_y, Direction.up, true)
  1819.       end
  1820.  
  1821.       def jump_if_clear(jump_x, jump_y, d, go_through = true)
  1822.         #If there's an event at the destination position, don't jump
  1823.         if collide_with_characters?(float_x + jump_x, float_y + jump_y)
  1824.           return false
  1825.         end
  1826.  
  1827.         #If it's jumping to the next tile only, then check for events on the origin tile too
  1828.         if (jump_x == 1 or jump_y == 1)
  1829.           if collide_with_characters?(float_x, float_y)
  1830.             return false
  1831.           end
  1832.         end
  1833.  
  1834.         return do_jump(jump_x, jump_y, go_through)
  1835.       end
  1836.  
  1837.       def can_jump_over_event?(x, y, d)
  1838.         x2 = $game_map.round_x_with_direction(x, d)
  1839.         y2 = $game_map.round_y_with_direction(y, d)
  1840.  
  1841.         x3 = $game_map.round_x_with_direction(x2, d)
  1842.         y3 = $game_map.round_y_with_direction(y2, d)
  1843.  
  1844.         return false unless $game_map.valid?(x2, y2)
  1845.         return false unless $game_map.valid?(x3, y3)
  1846.  
  1847.         return true if @through || debug_through? || custom_through?
  1848.         return false unless map_passable?(x, y, d)
  1849.         return false unless map_passable?(x2, y2, reverse_dir(d))
  1850.         return false unless map_passable?(x2, y2, d)
  1851.         return false unless map_passable?(x3, y3, reverse_dir(d))
  1852.         # return false if collide_with_characters?(x2, y2)
  1853.         return true   
  1854.       end
  1855.  
  1856.       def passable_any_direction?(x, y)
  1857.         return false if Auto_Jump_Region_Never_Passable == true
  1858.         unless Auto_Jump_Region_Never_Passable == false
  1859.           return false if $game_map.region_id(x, y) == Auto_Jump_Region_Never_Passable
  1860.         end
  1861.  
  1862.         return true if passable?(x, y, 2)
  1863.         return true if passable?(x, y, 4)
  1864.         return true if passable?(x, y, 6)
  1865.         return true if passable?(x, y, 8)
  1866.  
  1867.         return true if Auto_Jump_Region_Always_Passable == true
  1868.         unless Auto_Jump_Region_Always_Passable == false
  1869.           return true if $game_map.region_id(x, y) == Auto_Jump_Region_Always_Passable
  1870.         end
  1871.  
  1872.         return false
  1873.       end
  1874.     end
  1875.   end
  1876. end
  1877.  
  1878.  
  1879. class Game_Interpreter
  1880.   #Use command 322 to change it, this is done to keep compatibility with effectus
  1881.   def change_actor_graphic(actor_id, sprite_name, sprite_index, face_name, face_index)
  1882.     @params = [actor_id, sprite_name, sprite_index, face_name, face_index]
  1883.     command_322
  1884.   end
  1885.  
  1886.   if OrangeMovement::Block_Repeated_Event_Triggering == true
  1887.     alias :hudell_orange_movement_game_interpreter_command_201 :command_201
  1888.     def command_201
  1889.       hudell_orange_movement_game_interpreter_command_201
  1890.       return if $game_party.in_battle
  1891.  
  1892.       $game_player.clear_checked_tiles
  1893.       $game_player.mark_tile_as_checked($game_player.x, $game_player.y) if OrangeMovement::Ignore_Teleported_Tile
  1894.     end
  1895.   end
  1896.  
  1897.   if OrangeMovement::Dashing_Sprites_Reset_On_Teleport == true
  1898.     alias :hudell_orange_movement_game_interpreter_command_201_B :command_201
  1899.     def command_201
  1900.       $game_player.update_actor_graphic
  1901.       hudell_orange_movement_game_interpreter_command_201_B
  1902.     end
  1903.   end
  1904. end
  1905.  
  1906. class Game_Character < Game_CharacterBase
  1907.   def turn_toward_player
  1908.     sx = distance_x_from($game_player.float_x)
  1909.     sy = distance_y_from($game_player.float_y)
  1910.  
  1911.     if sx.abs < 1 && sy.abs < 1
  1912.       set_direction(10 - $game_player.direction)
  1913.     else
  1914.       if sx.abs > sy.abs
  1915.         set_direction(sx > 0 ? 4 : 6)
  1916.       elsif sy != 0
  1917.         set_direction(sy > 0 ? 8 : 2)
  1918.       end
  1919.     end
  1920.   end
  1921.  
  1922.   def turn_away_from_player
  1923.     sx = distance_x_from($game_player.float_x)
  1924.     sy = distance_y_from($game_player.float_y)
  1925.  
  1926.     if sx.abs < 1 && sy.abs < 1
  1927.       set_direction($game_player.direction)
  1928.     else
  1929.       if sx.abs > sy.abs
  1930.         set_direction(sx > 0 ? 6 : 4)
  1931.       elsif sy != 0
  1932.         set_direction(sy > 0 ? 2 : 8)
  1933.       end
  1934.     end
  1935.   end
  1936. end
  1937.  
  1938. class Game_Event < Game_Character
  1939.   attr_reader :erased
  1940.  
  1941.   if OrangeMovement::Use_Event_Hitboxes == true
  1942.     include OrangeMovement
  1943.  
  1944.     def get_config(regex, default)
  1945.       return default if @list.nil?
  1946.  
  1947.       @list.each do |command|
  1948.         if command.code == 108 || command.code == 408
  1949.           begin
  1950.             result = command.parameters[0].scan(regex)
  1951.             unless result.nil?
  1952.               value = result[0][0].to_i
  1953.               return value
  1954.             end
  1955.           rescue
  1956.           end
  1957.         end
  1958.       end
  1959.  
  1960.       default
  1961.     end
  1962.  
  1963.     def hitbox_x_size
  1964.       if @hitbox_x_size.nil?
  1965.         regex = /hitbox\_x_*=_*(.*)$/
  1966.         @hitbox_x_size = get_config(regex, 0)
  1967.       end
  1968.  
  1969.       @hitbox_x_size
  1970.     end
  1971.  
  1972.     def hitbox_y_size
  1973.       if @hitbox_y_size.nil?
  1974.         regex = /hitbox\_y_*=_*(.*)$/
  1975.         @hitbox_y_size = get_config(regex, 0)
  1976.       end
  1977.  
  1978.       @hitbox_y_size
  1979.     end
  1980.  
  1981.     def hitbox_h_size
  1982.       if @hitbox_h_size.nil?
  1983.         regex = /hitbox\_width_*=_*(.*)$/
  1984.         @hitbox_h_size = get_config(regex, 1)
  1985.       end
  1986.  
  1987.       @hitbox_h_size
  1988.     end
  1989.  
  1990.     def hitbox_v_size
  1991.       if @hitbox_v_size.nil?
  1992.         regex = /hitbox\_height_*=_*(.*)$/
  1993.         @hitbox_v_size = get_config(regex, 1)
  1994.       end
  1995.  
  1996.       @hitbox_v_size
  1997.     end
  1998.  
  1999.     def uses_default_hitbox?
  2000.       return false unless @hitbox_x_size == 0
  2001.       return false unless @hitbox_y_size == 0
  2002.       return false unless @hitbox_h_size == 1
  2003.       return false unless @hitbox_v_size == 1
  2004.       true
  2005.     end
  2006.  
  2007.     def left_x
  2008.       @x + hitbox_x_size
  2009.     end
  2010.  
  2011.     def right_x
  2012.       left_x + hitbox_h_size
  2013.     end
  2014.  
  2015.     def top_y
  2016.       @y + hitbox_y_size
  2017.     end
  2018.  
  2019.     def bottom_y
  2020.       top_y + hitbox_v_size
  2021.     end
  2022.  
  2023.     alias :hudell_orange_movement_event_hitboxes_pos? :pos?
  2024.     def pos?(x, y)
  2025.       if uses_default_hitbox?
  2026.         hudell_orange_movement_event_hitboxes_pos?(x, y)
  2027.       else
  2028.         left_x = @x + hitbox_x_size
  2029.         right_x = left_x + hitbox_h_size
  2030.         top_y = @y + hitbox_y_size
  2031.         bottom_y = top_y + hitbox_v_size
  2032.  
  2033.         x >= left_x && x < right_x && y >= top_y && y < bottom_y
  2034.       end
  2035.     end
  2036.  
  2037.     #This method is made to ensure compatibility with effectus. It won't do anything if Effectus isn't loaded.
  2038.     alias :hudell_orange_movement_event_hitboxes_game_event_refresh :refresh
  2039.     def refresh
  2040.       hudell_orange_movement_event_hitboxes_game_event_refresh
  2041.  
  2042.       unless uses_default_hitbox?
  2043.         if @ms_effectus_position_registered
  2044.           unless @hudell_ms_effectus_position_registered
  2045.             $game_map.ms_effectus_event_pos[@y * $game_map.width + @x].delete(self)
  2046.  
  2047.             for x in (left_x.floor)..(right_x.ceil - 1)
  2048.               for y in (top_y.floor)..(bottom_y.ceil - 1)
  2049.                 $game_map.ms_effectus_event_pos[y * $game_map.width + x] << self
  2050.               end
  2051.             end
  2052.           end
  2053.  
  2054.           @hudell_ms_effectus_position_registered = true
  2055.         end
  2056.       end
  2057.     end
  2058.  
  2059.     alias :hudell_orange_movement_game_event_setup_page :setup_page
  2060.     def setup_page(new_page)
  2061.       hudell_orange_movement_game_event_setup_page(new_page)
  2062.  
  2063.       if @hudell_ms_effectus_position_registered
  2064.         for x in (left_x.floor)..(right_x.ceil - 1)
  2065.           for y in (top_y.floor)..(bottom_y.ceil - 1)
  2066.             $game_map.ms_effectus_event_pos[y * $game_map.width + x].delete(self)
  2067.           end
  2068.         end
  2069.         @hudell_ms_effectus_position_registered = false
  2070.       end
  2071.  
  2072.       @hitbox_x_size = nil
  2073.       @hitbox_y_size = nil
  2074.       @hitbox_h_size = nil
  2075.       @hitbox_v_size = nil
  2076.     end
  2077.   end
  2078. end


RUBY 代码复制
  1. #==============================================================================
  2. # ★ RGSS3_フットステップス Ver1.0
  3. #==============================================================================
  4. =begin
  5.  
  6. 作者:tomoaky
  7. webサイト:ひきも記は閉鎖しました。 ([url]http://hikimoki.sakura.ne.jp/[/url])
  8.  
  9. プレイヤーやイベントキャラクターが移動する際に足音を鳴らします。
  10.  
  11. イベントの名前に <nofoots> という文字列を含む、あるいは
  12. 注釈コマンドの内容に <nofoots> という文字列を含むイベントは
  13. 足音を鳴らしません。(後者は注釈のあるイベントページのみ有効)
  14.  
  15. また、<foots 1> という文字列を含めることで足音タイプを指定した値に設定でき、
  16. これによりキャラクターと地形の組み合わせによって足音を変えることができます。
  17.  
  18. 使用するゲームスイッチ(初期設定)
  19.   0001, 0002
  20.  
  21. 2015/09/14  Ver1.0
  22. 公開
  23.  
  24. =end
  25.  
  26. #==============================================================================
  27. # □ 設定項目
  28. #==============================================================================
  29. module TMFOOTS
  30.   PLAYER_FOOTS    = true            # プレイヤーの足音の有無
  31.   FOLLOWERS_FOOTS = true           # フォロワーの足音の有無
  32.  
  33.   MUTE_NO_GRAPHIC  = true           # 歩行グラフィックなしのとき足音を無効化
  34.   MUTE_TRANSPARENT = true          # 透明状態のとき足音を無効化
  35.  
  36.   FOOTS_RANGE = 9                   # 足音が聴こえる範囲
  37.  
  38.   # スクリプト側で使用するスイッチ番号の設定
  39.   SW_FOOTS_STOP  = 100                # 禁用所有脚步声
  40.   SW_CAMERA_MODE = 99                # 根据离照相机的距离计算脚步声
  41.  
  42.   # 地形タグごとの足音設定 [ファイル名, ボリューム, ピッチ]
  43.   SE = []
  44.   SE[0] = [                         # 足音タイプ0(足音タイプ省略時に使用)
  45.     ["脚步", 70, 85],            # 地形タグ0
  46.     ["水_1", 100, 150],          # 地形タグ1
  47.     ["草地_1", 100, 100],            # 地形タグ2
  48.     ["踩雪", 100, 50],            # 地形タグ3
  49.     ["水_1", 100, 150],            # 地形タグ4
  50.     ["脚步", 70, 80],            # 地形タグ5
  51.     ["脚步", 70, 80],            # 地形タグ6
  52.     ["脚步", 70, 80],            # 地形タグ7
  53.   ]
  54.   SE[1] = [                         # 足音タイプ1
  55.     ["脚步", 80, 75],          # 地形タグ0
  56.     ["脚步", 70, 80],            # 地形タグ1
  57.     ["脚步", 70, 80],            # 地形タグ2
  58.     ["脚步", 70, 80],            # 地形タグ3
  59.     ["脚步", 70, 80],            # 地形タグ4
  60.     ["脚步", 70, 80],            # 地形タグ5
  61.     ["脚步", 70, 80],            # 地形タグ6
  62.     ["脚步", 70, 80],            # 地形タグ7
  63.   ]
  64. end
  65.  
  66. #==============================================================================
  67. # ■ Game_CharacterBase
  68. #==============================================================================
  69. class Game_CharacterBase
  70.   #--------------------------------------------------------------------------
  71.   # ● 歩数増加
  72.   #--------------------------------------------------------------------------
  73.   alias tmfoots_game_characterbase_increase_steps increase_steps
  74.   def increase_steps
  75.     tmfoots_game_characterbase_increase_steps
  76.     if use_foots?
  77.       foots_se  = TMFOOTS::SE[foots_type][terrain_tag]
  78.       file_name = "Audio/SE/" + foots_se[0]
  79.       volume    = foots_volume(foots_se[1])
  80.       pitch     = foots_se[2]
  81.       Audio.se_play(file_name, volume, pitch)
  82.     end
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ○ 足音機能を使うかどうか
  86.   #--------------------------------------------------------------------------
  87.   def use_foots?
  88.     return false if TMFOOTS::MUTE_NO_GRAPHIC && @character_name == ""
  89.     return false if TMFOOTS::MUTE_TRANSPARENT && @transparent
  90.     !$game_switches[TMFOOTS::SW_FOOTS_STOP]
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ○ 足音タイプ
  94.   #--------------------------------------------------------------------------
  95.   def foots_type
  96.     return 0
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ○ プレイヤーとの距離
  100.   #--------------------------------------------------------------------------
  101.   def distance_from_player
  102.     dx = distance_x_from($game_player.x)
  103.     dy = distance_y_from($game_player.y)
  104.     Math.hypot(dx, dy)
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ○ カメラとの距離
  108.   #--------------------------------------------------------------------------
  109.   def distance_from_camera
  110.     dx = distance_x_from(($game_map.display_x + Graphics.width / 2 / 32) % $game_map.width)
  111.     dy = distance_y_from(($game_map.display_y + Graphics.height / 2 / 32) % $game_map.height)
  112.     Math.hypot(dx, dy)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ○ 足音のボリューム
  116.   #--------------------------------------------------------------------------
  117.   def foots_volume(original_volume)
  118.     if $game_switches[TMFOOTS::SW_CAMERA_MODE]
  119.       rate = [TMFOOTS::FOOTS_RANGE - distance_from_camera, 0].max
  120.     else
  121.       rate = [TMFOOTS::FOOTS_RANGE - distance_from_player, 0].max
  122.     end
  123.     original_volume * rate / TMFOOTS::FOOTS_RANGE
  124.   end
  125. end
  126.  
  127. #==============================================================================
  128. # ■ Game_Player
  129. #==============================================================================
  130. class Game_Player
  131.   #--------------------------------------------------------------------------
  132.   # ○ 足音機能を使うかどうか
  133.   #--------------------------------------------------------------------------
  134.   def use_foots?
  135.     super && TMFOOTS::PLAYER_FOOTS && normal_walk?
  136.   end
  137. end
  138.  
  139. #==============================================================================
  140. # ■ Game_Follower
  141. #==============================================================================
  142. class Game_Follower
  143.   #--------------------------------------------------------------------------
  144.   # ○ 足音機能を使うかどうか
  145.   #--------------------------------------------------------------------------
  146.   def use_foots?
  147.     super && TMFOOTS::FOLLOWERS_FOOTS
  148.   end
  149. end
  150.  
  151. #==============================================================================
  152. # ■ Game_Event
  153. #==============================================================================
  154. class Game_Event
  155.   #--------------------------------------------------------------------------
  156.   # ● イベントページの設定をセットアップ
  157.   #--------------------------------------------------------------------------
  158.   alias tmfoots_game_event_setup_page_settings setup_page_settings
  159.   def setup_page_settings
  160.     tmfoots_game_event_setup_page_settings
  161.     @use_foots  = /<nofoots>/i =~ @event.name ? false : true
  162.     @foots_type = /<foots\s*(\d+)>/i =~ @event.name ? $1.to_i : 0
  163.     if @list
  164.       @list.each do |list|
  165.         if list.code == 108 || list.code == 408
  166.           @use_foots = false if /<nofoots>/i =~ list.parameters[0]
  167.           @foots_type = $1.to_i if /<foots\s*(\d+)>/i =~ list.parameters[0]
  168.         end
  169.       end
  170.     end
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ 足音機能を使うかどうか
  174.   #--------------------------------------------------------------------------
  175.   def use_foots?
  176.     super && @use_foots
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ○ 足音タイプ
  180.   #--------------------------------------------------------------------------
  181.   def foots_type
  182.     @foots_type
  183.   end
  184. end

最佳答案

查看完整内容

简单写了一下[fold]module TMFOOTS STEP_INTERVAL = { default: 2, player: [2, 1.5], event: 2, } end module Orange_Character alias tmfoots_patch_module_move_straight module_move_straight def module_move_straight(*args) @tmfoots_pixel = true ret = tmfoots_patch_module_move_straight(*args) @tmfoots_pixel = false ret end alias tmfoots_patch_module_move_diagonal ...

Lv4.逐梦者

梦石
0
星屑
13723
在线时间
5685 小时
注册时间
2011-7-18
帖子
158

开拓者

2
发表于 2022-11-15 19:44:29 | 只看该作者
本帖最后由 gqxastg 于 2022-11-16 21:30 编辑

简单写了一下
将以上代码新开一页,置于ORANGE 移动系统和足音脚本之下即可

可调整STEP_INTERVAL,每项后面的数字为每多少“格”播放一次足音,player的第一个数字对应默认(整格移动)时,第二个数字对应ORANGE移动系统开启(像素移动)时
player对应玩家和随从,event对应事件,default对应除此以外的其他情况(防出错)

点评

T T含泪感谢前辈的耐心解答!!!!❤❤❤  发表于 2022-11-16 22:46

评分

参与人数 1+1 收起 理由
yz3440080 + 1 成功了!!啊啊啊啊!!T T真的太感谢前辈.

查看全部评分

这里岚风·雷,任饭、PM理性粉、UT/DR原作粉、(Trans)Furry自萌,半吊子技术一枚_(:з」∠)_    游戏制作交流工(liao)作(tian)室欢迎来玩!
【无偿/有偿】RGSS3(VA)脚本定制 + 合作招募/同好交友    修正Firefox/火狐浏览器的代码框复制问题(油猴脚本)
Click→←Click
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-19 15:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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