Battle Processing exiting during tint change?

Hello there! Okay so i started using the trial version of RPG Maker XP and so far loving it! however i have ran into an issue;


I made an attempt at creating my first ever script and it runs perfectly apart from one odd issue. For some reason if i enter a battle the battle screen will "Exit" in middle of the battle, no crash,no error it just returns me back to the world to carry on my adventures even without defeating the enemy, it acts almost like it was scripted to be exited yet its not.


When i stop my Day/Night script that i made from running i have no issues, only when my day/night cycle plays. It exits the battle screen as soon as the screen tint starts. Below is my script code. Both are Common Events, set to parallel with a switch setup to store it. Like i said works fine but seems to conflict with the battle system and i don't know why.


Anyone able to help? Thank you.


Danny.


Edit: Is it possible to to add my switch to the battle system somehow, so when the battle system is activated i can add a switch to turn my day/night script off just before they go into battle? (Including the Random encounter battle) if so what script would i edit? Thank you.


1.PNG


2.PNG
Hi!  Welcome to the forums.


I'm not 100% sure but I think there's an interaction between the Timer and Battle system that causes battle to abort under some conditions, possibly when the timer hits 0:00.  Try removing the "Control Timer: Startup" from all of your events and see if that fixes it.


In general the onscreen Timer isn't the best approach to a day/night system anyhow; you can do it more gracefully with Parallel Process common events that increment a variable every, say, 60 frames (1 second).


Parallel Process Common Events do not run while the battle system is active, so you should be okay without adding a switch to the battle system.  If you do need the switch to be toggled as soon as battle starts for some reason, you can add a Troop event that runs on Turn 0 of every battle which turns the switch on/off as soon as battle begins.


By the way, what you've done is "Eventing" not "Scripting".  I know this sounds really pedantic of me, but the term "Script" is commonly used around here to refer to a piece of Ruby or JavaScript code that can be inserted into a game to change its underlying behavior, so you may confuse people trying to help you if you conflate the terms.
That's spot on.  In the battle scene script, there is a check to see if the timer is running and it reaches 0, it aborts the battle.
If you want to remove the "timers ending battle" function from the battle scripts, go into Scene_Battle1 and delete the following code:


    # If timer has reached 0
    if $game_system.timer_working and $game_system.timer == 0
      # Abort battle
      $game_temp.battle_abort = true
    end


This should be lines 244-248, assuming that your script hasn't been modified elsewhere.

Original thread: https://forums.rpgmakerweb.com/threads/battle-processing-exiting-during-tint-change.61296/