Lighting Systems, Lag, and a Dilemma

I've been in the process of changing my battle system to Victor's Map Turn Battle, but I have run into major issues with my current lighting script. I am currently using CSCA Light Effects.

Main issue: All lights turn off when a map battle starts. This is most likely due to an incompatibility between the lighting script and the map turn battle script.

I noticed that Victor has a lighting system as well. It works great with the map turn battle system. The problem is now I have an insane amount of lag due to the fact that each lighting event in his script has to be a parallel process, or the lighting will not show up. I have tried several anti-lag scripts, and they don't help.

My larger maps will have 100+ lighting events. Even just 40 events crushed my FPS.

Normally, with the CSCA Light Effects script, I do not get much lag at all. Even with a ton of lighting events.

So, my options come down to this:

1. Figure out how to make CSCA Light Effects compatible with the Victor Map Turn Battle (I don't know how to script, so someone has to do this for me).

2. Somehow make the Victor Lighting Engine not laggy. (I don't expect this to happen)

3. Keep searching for a lighting script that won't be laggy and that's compatible with the Victor Map Turn Battle.

Any suggestions or help? What do you guys recommend I do?
Moved to: RGSSX Script Support

Your original issue was more likely due to incorrect configuration, where you've used the same switch or variable in both scripts (usually happens when someone adds a script but doesn't check or reserve/name the variables it uses).

Anti-lag scripts usually do not affect parallel process events.

Please check for switches/variables in the two original scripts, and if you don't find any issues, post a link to the lighting script from Victor.
While the CSCA lighting effects script uses switches to determine if a light effect is activated, the Victor Map Turn Battle script does not use switches/variables in the configurable section. It uses the comment box to call a battle.

I do see a section of code at the bottom of the Map Turn Battle script that makes it compatible with the Victor Lighting Engine. Maybe it has to do with how the screen transitions from the map scene to the battle scene?

Victor Light Effects
The Map Turn Battle script is an addon to the Animated Battle script. Does that one have any switches/variables? Are they all in the correct order, as listed in the script header? And have you tried to swap their order (the two you list in your first post) in the script list?


edit: oh - look at this:
Code:
#    The events ID 1, 2 and 3 will become enemies. They will become the enemy
#    ID 1, and will turn on the switch local A for each event.

Any chance your light effects events are events 1, 2 and/or 3?
My light switches are 21 to 60. I took a quick look at the animated battle script and saw no switches/variables in the configurable section.

I have also tried swapping the order. I have put the CSCA lighting script above the map battle script, just below it, below all my victor scripts, and above all my victor scripts.
did you see my edit?
Victor's Map Turn Battle doesn't actually use the map scene for the battle, it uses the battle scene.
The lighting script you used only works on the map scene, so it's not a surprise that the lights won't show up during the battle.

There is only one way to fix this, and that requires a little patch to initialize the lights in the battle scene as well.
I already made a patch for this battle system but with another lighting system, that's why I know exactly why CSCA lights don't work for you.
On my mobile now, but when I get to sit down and boot up my laptop, I will try to find that patch I made and edit it to work with CSCA instead.
did you see my edit?
Yes. I have tested it on a map where there are light events that are not those numbers, and they disappear too. Also, my main event that turns on the light switches is not one of those numbers.

@Sixth Thank you!
Here is the patch for it:
Spoiler


Also, here is another critical fix for Victor's Map Battle:
Spoiler
Code:
class Spriteset_MapBattle < Spriteset_Battle

  def initialize
    super
    create_characters
    create_tilemap
    create_parallax
    create_shadow
    create_weather
    update
  end

  def dispose
    dispose_tilemap
    dispose_parallax
    dispose_characters
    dispose_shadow
    dispose_weather
    super
  end
 
end

if $imported[:ve_light_effects]

  class Spriteset_MapBattle < Spriteset_Battle

    def initialize
      initialize_ve_map_battle
      2.times { update_light(true) }
    end
 
    def dispose
      dispose_ve_map_battle
      dispose_light unless SceneManager.scene_is?(Scene_Map)
    end
    
  end
 
end
This fixes several disposal errors and duplicate character sprite initialization.
Place it right below Victor's Map Turn Battle.
Here is the patch for it:
Spoiler


Also, here is another critical fix for Victor's Map Battle:
Spoiler
Code:
class Spriteset_MapBattle < Spriteset_Battle

  def initialize
    super
    create_characters
    create_tilemap
    create_parallax
    create_shadow
    create_weather
    update
  end

  def dispose
    dispose_tilemap
    dispose_parallax
    dispose_characters
    dispose_shadow
    dispose_weather
    super
  end

end

if $imported[:ve_light_effects]

  class Spriteset_MapBattle < Spriteset_Battle

    def initialize
      initialize_ve_map_battle
      2.times { update_light(true) }
    end

    def dispose
      dispose_ve_map_battle
      dispose_light unless SceneManager.scene_is?(Scene_Map)
    end
   
  end

end
This fixes several disposal errors and duplicate character sprite initialization.
Place it right below Victor's Map Turn Battle.

Thank you so much! It seems to work well. I'm very grateful! 😤

Original thread: https://forums.rpgmakerweb.com/threads/lighting-systems-lag-and-a-dilemma.131386/