Guest User

S9

a guest
Jan 22nd, 2016
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. #===============================================================================
  2. # * Falcao Pearl ABS script shelf # 9
  3. #
  4. # Pearl Antilag v 1.1
  5. # This is just an add on for the Pearl ABS system, it run as standalone mode too
  6. #
  7. # This script reduce the lag coused by tons of events on a map, this script
  8. # ignores parallel process events, and autorun events triggers
  9. #
  10. # Website: http://falcaorgss.wordpress.com/
  11. # Foro: www.makerpalace.com
  12. #===============================================================================
  13.  
  14. module PearlAntilag
  15.  
  16. # How many tiles outside the screen the script going to tolerate
  17. OutRange = 2
  18.  
  19. # if you want to disable the script for an especific evet, tag <global> in the
  20. # event name box
  21.  
  22. end
  23.  
  24. class Game_Map
  25. attr_reader :max_width, :max_height
  26. alias falcaopearl_antilag_initialize initialize
  27. def initialize
  28. set_max_screen
  29. falcaopearl_antilag_initialize
  30. end
  31.  
  32. def set_max_screen
  33. @max_width = (Graphics.width / 32).truncate
  34. @max_height = (Graphics.height / 32).truncate
  35. end
  36. end
  37.  
  38. class << Graphics
  39. alias falcaopearl_antilag_g resize_screen
  40. def resize_screen(w, h)
  41. falcaopearl_antilag_g(w, h)
  42. $game_map.set_max_screen unless $game_map.nil?
  43. end
  44. end
  45.  
  46. class Game_Event < Game_Character
  47. attr_accessor :allow_update
  48. alias falcaopearl_antilag_ini initialize
  49. def initialize(map_id, event)
  50. falcaopearl_antilag_ini(map_id, event)
  51. @ignore_antilag = event.name.include?('<global>')
  52. @parallel_mode = @trigger == 3 || @trigger == 4 || @ignore_antilag
  53. @allow_update = true
  54. update_on_screen_event
  55. end
  56.  
  57. alias falcaopearl_antilag_page setup_page_settings
  58. def setup_page_settings
  59. falcaopearl_antilag_page
  60. @parallel_mode = @trigger == 3 || @trigger == 4 || @ignore_antilag
  61. end
  62.  
  63. def update_on_screen_event
  64. @allow_update = false unless @parallel_mode
  65. max_w = $game_map.max_width ; max_h = $game_map.max_height
  66. out = PearlAntilag::OutRange
  67. sx = (screen_x / 32).to_i
  68. sy = (screen_y / 32).to_i
  69. if sx.between?(0 - out, max_w + out) and sy.between?(0 - out, max_h + out)
  70. @allow_update = true
  71. end
  72. end
  73.  
  74. alias falcaopearl_antilag_up update
  75. def update
  76. unless @parallel_mode
  77. update_on_screen_event
  78. return unless @allow_update
  79. end
  80. falcaopearl_antilag_up
  81. end
  82. end
  83.  
  84. class Sprite_Character < Sprite_Base
  85. alias falcaopearl_antilag_update update
  86. def update
  87. if @character.is_a?(Game_Event) #and [email protected]_mode
  88. unless @character.allow_update
  89. end_animation if @character.animation_id > 0
  90. end_balloon if @character.balloon_id > 0
  91. self.x = @character.screen_x
  92. self.y = @character.screen_y
  93. self.z = @character.screen_z
  94. return
  95. end
  96. end
  97. falcaopearl_antilag_update
  98. end
  99. end
Add Comment
Please, Sign In to add comment