Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: PrinceEndymion88 on October 20, 2022, 04:01:52 am

Title: [RMXP] Transition when Escape or win a Battle
Post by: PrinceEndymion88 on October 20, 2022, 04:01:52 am
In the standard Battle System, when a battle end or when Escape there is a standard fade out transition. Is it possible to show the same transition specified in System -> Battle transition graphic ?

Thanks :)
Title: Re: [RMXP] Transition when Escape or win a Battle
Post by: KK20 on October 21, 2022, 09:10:55 pm
The transition effect plays on the scene you're switching over to. So when leaving the battle scene, you're probably heading back to the map scene. Thus we need to introduce our code changes to Scene_Map.

You should already be aware that this is what we need to change in Scene_Map:
    # Transition run
    Graphics.transition

In Scene_Battle, it handles the transition like so
    # Execute transition
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end

We need to copy some of this over, but we also need to make Scene_Map aware that we're coming from Scene_Battle.

I would suggest adding a new method to Scene_Map:
  def initialize(last_scene = nil)
    @_last_scene = last_scene
  end
Replace the Graphics.transition code called out above with this:
    # Transition run
    if @_last_scene == :battle
      if $data_system.battle_transition == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $data_system.battle_transition)
      end
    else
      Graphics.transition
    end
Then find "def battle_end" in Scene_Battle 1 and make the following change:
    # Switch to map screen
    $scene = Scene_Map.new(:battle)

All of this assumes you're using the default scripts, of course.
Title: Re: [RMXP] Transition when Escape or win a Battle
Post by: PrinceEndymion88 on October 22, 2022, 12:18:10 pm
Oh, thanks! I considered only scene_battle script and, obviously, it didn't work! 😅 Now it works properly 😊 again, thanks!