11-22-2016, 04:44 AM
Oh, then, I guess the problem is the number of events and also the script
Let's see how light event working
see the code above, the light system will refresh every frames to call "update_light_event"
now let see what in "update_light_event"
see, it call a loop to refresh every events that has "light_event" comment
let's imagine if you have 10 light-events in map, for each 1 frame, the system will load 10 events and refresh these events. The more light-events, the more refresh-works system must do each frame
To solve this "too-much-refresh" problem, I think you should increase the time to check update from "for each 1 frame" to "for each 4 frames" or more, or integrates a custom anti-lag code into this script by yourself.
Let's see how light event working
Code:
if $game_system.activate_light
# Update the light of the event
update_light_event
# Update the light of the player
update_light_player
end
else
# Draw an empty night when the switch is on
@light.bitmap.fill_rect(@light.bitmap.rect, Color.new(0,0,0,0))
end
# Increase the frame count for the animation
@frame += 1
see the code above, the light system will refresh every frames to call "update_light_event"
now let see what in "update_light_event"
Code:
def update_light_event
# Display the ligth when one or more light were created
if $game_map.light_event != {}
# Cycle through the light list
$game_map.light_event.each { |i, light|
see, it call a loop to refresh every events that has "light_event" comment
let's imagine if you have 10 light-events in map, for each 1 frame, the system will load 10 events and refresh these events. The more light-events, the more refresh-works system must do each frame
To solve this "too-much-refresh" problem, I think you should increase the time to check update from "for each 1 frame" to "for each 4 frames" or more, or integrates a custom anti-lag code into this script by yourself.