Jump to content
Zerbu

Zerbu Engine - Change (in game) or Randomize Battle Transition

Recommended Posts

Change or Randomize Battle Transition

 

Introduction

This script allows you to change the battle transition graphic in-game, and/or randomize between more than one graphic.

 

Instructions

To change the battle transition graphic in the game:

ze_chrbt(:graphics, ["NewTransition"])

 

To change to a list of random graphics:

ze_chrbt(:graphics, ["Image1", "Image2", "etc"])

 

Change Log

  • 1.1 - It is now possible to set the graphics directory for the battle start transitions.

 

Script

 

 

#============================================================================
# Zerbu Engine - Change or Randomize Battle Transition
#----------------------------------------------------------------------------
# This script allows you to change the battle transition graphic in-game, and/or
# randomize between more than one graphic.
#----------------------------------------------------------------------------
# To change the battle transition graphic in the game:
# ze_chrbt(:graphics, ["NewTransition"])
#----------------------------------------------------------------------------
# To change to a list of random graphics:
# ze_chrbt(:graphics, ["Image1", "Image2", "etc"])
#============================================================================

#============================================================================
# ZE_Change_Randomize_Battle_Transition
#============================================================================
class ZE_Change_Randomize_Battle_Transition
 #--------------------------------------------------------------------------
 # new method: initialize
 #--------------------------------------------------------------------------
 def initialize
#---
@data = {
  #----------------------------------------------------------------------
  # Options
  #----------------------------------------------------------------------
  # This option will enable or disable the system. When it is disabled,
  # the usual battle transition graphic will be used.
  #----------------------------------------------------------------------
  :ENABLED => true,
  #----------------------------------------------------------------------
  # This is a list of the possible graphics that can be used as the
  # battle transition screen.
  #----------------------------------------------------------------------
  :GRAPHICS => ["BattleStart"],
  #----------------------------------------------------------------------
  # This is the directory containing the battle transitions.
  #----------------------------------------------------------------------
  :DIRECTORY => "Graphics/System",
}
#---
 end

 #--------------------------------------------------------------------------
 # new method: []
 #--------------------------------------------------------------------------
 def [](setting)
#---
@data[setting] || false
#---
 end

 #--------------------------------------------------------------------------
 # new method: []=
 #--------------------------------------------------------------------------
 def []=(setting, value)
#---
@data[setting] = value
#---
 end
end

#============================================================================
# DataManager
#============================================================================
module DataManager
 class << self
#------------------------------------------------------------------------
# alias method: create_game_objects
#------------------------------------------------------------------------
alias ze_chrbt_create_game_objects create_game_objects
def create_game_objects
  #---
  ze_chrbt_create_game_objects
  $ze_chrbt = ZE_Change_Randomize_Battle_Transition.new
  #---
end

#------------------------------------------------------------------------
# alias method: make_save_contents
#------------------------------------------------------------------------
alias ze_chrbt_make_save_contents make_save_contents
def make_save_contents
  #---
  contents = ze_chrbt_make_save_contents
  contents[:ze_chrbt] = $ze_chrbt
  contents
  #---
end

#------------------------------------------------------------------------
# alias method: extract_save_contents
#------------------------------------------------------------------------
alias ze_chrbt_extract_save_contents extract_save_contents
def extract_save_contents(contents)
  #---
  ze_chrbt_extract_save_contents(contents)
  $ze_chrbt = contents[:ze_chrbt] ? contents[:ze_chrbt] : ze_chrbt.new
  #---
end
 end
end

#============================================================================
# Scene_Map
#============================================================================
class Scene_Map < Scene_Base
 #--------------------------------------------------------------------------
 # alias method: perform_battle_transition
 #--------------------------------------------------------------------------
 alias ze_chrbt_perform_battle_transition perform_battle_transition
 def perform_battle_transition
#---
if $ze_chrbt[:ENABLED]
  Graphics.transition(60, $ze_chrbt[:DIRECTORY]+"/"+$ze_chrbt[:GRAPHICS][rand($ze_chrbt[:GRAPHICS].size)], 100)
  Graphics.freeze
else
  ze_chrbt_perform_battle_transition
end
#---
 end
end

#============================================================================
# Game_Interpreter
#============================================================================
class Game_Interpreter
 #--------------------------------------------------------------------------
 # new method: ze_chrbt
 #--------------------------------------------------------------------------
 def ze_chrbt(setting, value)
#---
$ze_chrbt[setting.upcase] = value
#---
 end
end

 

 

Edited by Zerbu

Share this post


Link to post
Share on other sites

I have used a similar script on VX. If I do modify this line:

 

Graphics.transition(60, "Graphics/System/"+$ze_chrbt[:GRAPHICS][rand($ze_chrbt[:GRAPHICS].size)], 100)

 

to

 

Graphics.transition(60, "Graphics/System/Transition"+$ze_chrbt[:GRAPHICS][rand($ze_chrbt[:GRAPHICS].size)], 100)

 

The whole thing will break?. I don't want to have a lot of items of the same folder

Edited by oriceles

Share this post


Link to post
Share on other sites

Both the codes you gave are the same, I think you might have made a mistake in your post.

 

EDIT: I've updated the script to add the option to set the transitions directory.

Edited by Zerbu

Share this post


Link to post
Share on other sites

I'm having a Issue, when i start the game it says:

 

Script 'ZE Randomize Battle Transition' line 44: SyntaxError Ocurred.

 

unexpected tSYMBEG, expecting '}'

:DIRECTORY => "Graphics/System/Transitions/"

 

I just modified the script to this:

 

:GRAPHICS => ["BattleStart", "Ash", "Blind01", "Blind02", "Blind03",
	  "Bind04", "Brick01", "Brick02", "Cloud", "CrossFlame", "Cube",
	  "Diamond01", "Diamond02", "Embryo", "Flat01", "Fur", "Galaxy",
	  "Hurricane", "Line01", "Line02", "Pixel", "Pixelated", "RadialCloud",
	  "Random01", "Random02", "Random04", "Sharp", "Smash", "Square01",
	  "Square02", "Stripe01", "Stripe02", "Whirlwind", "Whitehole", "Whorl01"]
	  #----------------------------------------------------------------------
	  # This is the directory containing the battle transitions.
	  #----------------------------------------------------------------------
	  :DIRECTORY => "Graphics/System/Transitions/" 

Edited by oriceles

Share this post


Link to post
Share on other sites

You're missing the comma at the end of the list of battle backgrounds. The correct code should be:

 

:GRAPHICS => ["BattleStart", "Ash", "Blind01", "Blind02", "Blind03",
	  "Bind04", "Brick01", "Brick02", "Cloud", "CrossFlame", "Cube",
	  "Diamond01", "Diamond02", "Embryo", "Flat01", "Fur", "Galaxy",
	  "Hurricane", "Line01", "Line02", "Pixel", "Pixelated", "RadialCloud",
	  "Random01", "Random02", "Random04", "Sharp", "Smash", "Square01",
	  "Square02", "Stripe01", "Stripe02", "Whirlwind", "Whitehole", "Whorl01"],
	  #----------------------------------------------------------------------
	  # This is the directory containing the battle transitions.
	  #----------------------------------------------------------------------
	  :DIRECTORY => "Graphics/System/Transitions/" 

Edited by Zerbu

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted