Archeia

Touch Event RMVXA

Oct 5th, 2017
179
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Game_Event < Game_Character
  2.  
  3.   def check_event_trigger_touch(x, y)
  4.     return if $game_map.interpreter.running?
  5.     follower_touch = false
  6.     #---
  7.     $game_player.followers.each do |follower|
  8.       if follower.pos?(x,y)
  9.         follower_touch = true
  10.         break
  11.       end
  12.     end
  13.     #---
  14.     if @trigger == 2 && ($game_player.pos?(x, y) || follower_touch)
  15.       start
  16.     end
  17.   end
  18.  
  19.   alias testtee_move_straight move_straight
  20.   def move_straight(d, turn_ok = true)
  21.     testtee_move_straight(d, turn_ok)
  22.     check_event_trigger_touch(@x, @y)
  23.   end
  24.  
  25. end
  26.  
  27. class Game_Player < Game_Character
  28.  
  29.   def start_map_event(x, y, triggers, normal)
  30.     return if $game_map.interpreter.running?
  31.     $game_map.events_xy(x, y).each do |event|
  32.       if event.trigger_in?(triggers)
  33.         event.start
  34.       end
  35.     end
  36.   end
  37.  
  38. end
  39.  
  40. # Snippet Below has followers not affecting anything
  41.  
  42. #~ class Game_Event < Game_Character
  43. #~  
  44. #~   def check_event_trigger_touch(x, y)
  45. #~     return if $game_map.interpreter.running?
  46. #~     if @trigger == 2 && $game_player.pos?(x, y)
  47. #~       start
  48. #~     end
  49. #~   end
  50. #~  
  51. #~   alias testtee_move_straight move_straight
  52. #~   def move_straight(d, turn_ok = true)
  53. #~     testtee_move_straight(d, turn_ok)
  54. #~     check_event_trigger_touch(@x, @y)
  55. #~   end
  56. #~  
  57. #~ end
  58.  
  59. #~ class Game_Player < Game_Character
  60. #~  
  61. #~   def start_map_event(x, y, triggers, normal)
  62. #~     return if $game_map.interpreter.running?
  63. #~     $game_map.events_xy(x, y).each do |event|
  64. #~       if event.trigger_in?(triggers)
  65. #~         event.start
  66. #~       end
  67. #~     end
  68. #~   end
  69. #~  
  70. #~ end
RAW Paste Data