Help - Search - Members - Calendar
Full Version: [RMVX] Battle Backgrounds
RPG RPG Revolution Forums > Scripting > Script Tutorials > RGSS2
Ty
Script Name: Battle Backgrounds
Written by: Synthesize
Current version: Version 1.00A
Release Date: January 20, 2008

What is this script?
This simple script allows you to have a battle background instead of the abstract background which is the default for RPG Maker VX. Simply define the Background filename in the customization section, along with your Map_ID.

Features:
- Simple
- Easy to use
- Turn ON/OFF the battlefloor
- Once RMVX is released, I will interpret more features

Version History:
V1.00
- Script is released

[Show/Hide] Script:

CODE
#===============================================================================
# Battle Backgrounds - RMVX
#===============================================================================
# Written by Synthesize
# January 20, 2008
# Version 1.00A
#===============================================================================
#                       * This script is untested. *
#===============================================================================
module SynBattleB
  # Place your battle backgrounds in the 'Pictures' folder (Graphics/Pictures)
  # Format = {map_id => Battleback Name}
  Battle_background =
  {
  1 => "001-Grassland01",
  2 => "001-Grassland01"
  }
  #-----------------------------------------------------------------------------
  # Create the battlefloor?
  Create_battlefloor = false
  #-----------------------------------------------------------------------------
  # This was being requested on quite a fe forums now, so I threw a quick script
  # together. It is nice and simple, and does what it is suppsoed to do. Once
  # RMVX is released in English, then I will add additional features into this.
  #-----------------------------------------------------------------------------
end
#-------------------------------------------------------------------------------
# Spriteset_Battle
#-------------------------------------------------------------------------------
class Spriteset_Battle
  alias syn_create_battlefloor create_battlefloor
  #-----------------------------------------------------------------------------
  # Create Battleback
  #-----------------------------------------------------------------------------
  def create_battleback
    image = SynBattleB::Battle_background[$game_map.map_id]
    @battleback_sprite = Sprite.new(@viewport1)
    @battleback_sprite.bitmap = Cache.picture(image)
  end
  def create_battlefloor
    @battlefloor_sprite = Sprite.new(@viewport1)
    syn_create_battlefloor if SynBattleB::Create_battlefloor == true
  end
end
#===============================================================================
#                        * This script is untested *
#===============================================================================  
# Version 1.00A
# January 20, 2008
# Written by Synthesize
#===============================================================================
# Battle Backgrounds - RMVX
#===============================================================================


Questions? Concerns? Post them.
jens009
Wow. NIce add Synthesize to the RMVX scripts.

You should eventually convert most of XP scripts to VX. ;-]
Rabu
Seems to be a good first step. Would be nice, if you will enhace it, when english FV is released, so Battle-Backgrounds are corresponding to Map-Areas, you're on.

And could you give an example, how to exhance this section, when using more backgrounds for other maps.
CODE
{
  1 => "001-Grassland01",
  2 => "001-Grassland01"
  }
Ty
QUOTE (Rabu @ Jan 20 2008, 04:10 AM) *
Seems to be a good first step. Would be nice, if you will enhace it, when english FV is released, so Battle-Backgrounds are corresponding to Map-Areas, you're on.

And could you give an example, how to exhance this section, when using more backgrounds for other maps.
CODE
{
  1 => "001-Grassland01",
  2 => "001-Grassland01"
  }


Once I get Vx when it comes out, I will enhance it so you can put a tag in the map name, say [F1] then when you enter battle on that map, the battle background will use the 'Forest1' battle background as defined in the customization. As for your question:

CODE
{
  1 => "001-Grassland01",
  2 => "001-Grassland01",
  3 => "Battle Back 3",
  4 => "Back 4"
  }


For every map you want to have battles on, place a comma (Reference above), press enter then insert your map name followed by the battle background. Everything inside the {} brackets is a hash, so the way scripts use them is a script will check the value in the hash, then use the returning value. So in this case the script checks to see what map_id the player is on when the battle starts, so the scripts then 'asks' the hash to return the value that the script uses. So if you are on map 3 and enter a battle, the hash will tell the script to draw a battle background called 'Battle Back 3"
Lord Grundlefunk
Looks like a simplified version of Moghunter's script. Nice Job.
ComicStripGod
I'm underStand.How i call to this script on battle?
I ask this because i'm think Changed The Snece.
Ty
QUOTE (ComicStripGod @ Jan 22 2008, 08:53 AM) *
I'm underStand.How i call to this script on battle?
I ask this because i'm think Changed The Snece.


As long as this script is under all other scripts, it will work. It is called automatically in when a battle starts.
kageryuto
i have a question. the background depend on which map you are, right? ok, thats fine. but what about a map with more than 1 landscape. for example desert, snow and forest( on the world map). what to do?
Ty
QUOTE (kageryuto @ Mar 1 2008, 09:25 AM) *
i have a question. the background depend on which map you are, right? ok, thats fine. but what about a map with more than 1 landscape. for example desert, snow and forest( on the world map). what to do?


The problem with is, I think RMVX removed Terrain Tag support, which would have been the easiest way to get that done. So if that is the case, you would have to come up with a different way of making it work.
kageryuto
QUOTE (Synthesize @ Mar 1 2008, 07:28 PM) *
QUOTE (kageryuto @ Mar 1 2008, 09:25 AM) *
i have a question. the background depend on which map you are, right? ok, thats fine. but what about a map with more than 1 landscape. for example desert, snow and forest( on the world map). what to do?


The problem with is, I think RMVX removed Terrain Tag support, which would have been the easiest way to get that done. So if that is the case, you would have to come up with a different way of making it work.


the problem is i dont know ruby and i even cant programming. i need someones help
semajames
QUOTE (Synthesize @ Mar 2 2008, 11:35 AM) *
QUOTE (kageryuto @ Mar 1 2008, 09:25 AM) *
i have a question. the background depend on which map you are, right? ok, thats fine. but what about a map with more than 1 landscape. for example desert, snow and forest( on the world map). what to do?


The problem with is, I think RMVX removed Terrain Tag support, which would have been the easiest way to get that done. So if that is the case, you would have to come up with a different way of making it work.


http://f44.aaa.livedoor.jp/~ytomy/software/tkool/index.html

VXTilesetTool allows terrain tags and directional movement.
Lentho
One bug with this script is the inability to use the "Battle Test" feature in VX due to an error with the Cache. Anyone know how to fix this?
Icedsnake
For me it say Error

Script 'Cache' line 75: type error occurred.
cannot convert nil into String.

anny one can help me out ??
2gamergirl2
I think what is wrong with yours is that you named your maps. So instead of your map name being MAP001 (or whatever the default map names are), you named it Feild1 or something like that. I am not sure, and I have a feeling I am wrong, but I think you should change this:

1 => "001-Grassland01"



to this:

(map name) => "001-Grassland01"

so for example it would be this:

Field1 => "001-Grassland01"


Edit: Ok nevermind it didnt work lol i am totally stupid dont listen to me! Lol nvm nvm nvm nvm! Hopefully someone who is WAY more skilled then me comes along and helps you Icedsnake but sorry i couldnt lol.
YanXie
QUOTE
For me it say Error

Script 'Cache' line 75: type error occurred.
cannot convert nil into String.

anny one can help me out ??


This problem has happened several times to some members in the forum, and the reason is the same. Using unofficial translated english VX copy.

To fix that, you'll need to uninstall that unofficial VX, and install the official english version of VX.

Refer to this thread for some more detail :

http://www.rpgrevolution.com/forums/?showtopic=15276

cheers,puppeto4. smile.gif


Shanefpt
QUOTE (semajames @ Apr 26 2008, 04:29 AM) *
QUOTE (Synthesize @ Mar 2 2008, 11:35 AM) *
QUOTE (kageryuto @ Mar 1 2008, 09:25 AM) *
i have a question. the background depend on which map you are, right? ok, thats fine. but what about a map with more than 1 landscape. for example desert, snow and forest( on the world map). what to do?


The problem with is, I think RMVX removed Terrain Tag support, which would have been the easiest way to get that done. So if that is the case, you would have to come up with a different way of making it work.


http://f44.aaa.livedoor.jp/~ytomy/software/tkool/index.html

VXTilesetTool allows terrain tags and directional movement.


Ummmm... Is there anyone here that knows Japanese that can translate the functions of the tileset tool so that and English speaking user can get the advantages of using terrain tags? I'm not asking for a hack but just like, button at the top left does ~(blah blah blah) and the one under, etc etc...? Sorry, just not Japanese.
ChaoticFox9900
Awesome! Thanks for uploading this!
breadlord
please don't necropost.
TalesOf_Fantasy
cool script! it's simple and easy. definely gonna use it
megamario
When You get that error, its from the script, I got it too so i removed it and it still said it. Then i removed the battle back picture and it went fine! wink.gif
Jediknightjace
Working great, but does anyone know if there's a way to center the backgrounds instead of displaying from the top left? Thanks in advance!
ZeroManArmy
QUOTE (Jediknightjace @ Dec 14 2009, 02:59 PM) *
Working great, but does anyone know if there's a way to center the backgrounds instead of displaying from the top left? Thanks in advance!

You would have to get a battle background that's exactly 544x416 pixels.

Jediknightjace
QUOTE (ZeroManArmy @ Dec 16 2009, 08:42 PM) *
QUOTE (Jediknightjace @ Dec 14 2009, 02:59 PM) *
Working great, but does anyone know if there's a way to center the backgrounds instead of displaying from the top left? Thanks in advance!

You would have to get a battle background that's exactly 544x416 pixels.


Crud, that's what I was afraid of. Thanks for the reply, though. Guess I'll start cropping. dry.gif
Hiromu656
sorry for necro, but this is a very useful script: My rpg maker is completely legit and i payed money for it yet I still gte the Cache string 75 nil thingamagig error, so the fix posted on the first page does not work for me yet i still cannot battletest.
Kread-EX
That's because you are probably entering a battle on a map for which you have not set a battle background.
mozzy
QUOTE (Kread-EX @ Dec 14 2010, 09:08 AM) *
That's because you are probably entering a battle on a map for which you have not set a battle background.


Sorry to necropost, but I'm curious how to set your battle background, I'm new to this and curious.

EDIT: Never mind, my reading skills just went herp for a second there.
akura
QUOTE (megamario @ Nov 13 2009, 12:09 AM) *
When You get that error, its from the script, I got it too so i removed it and it still said it. Then i removed the battle back picture and it went fine! wink.gif

What battle back picture o.o , you mean the one from the main folder?
Varaosa
QUOTE (Icedsnake @ Jun 17 2008, 06:59 PM) *
For me it say Error

Script 'Cache' line 75: type error occurred.
cannot convert nil into String.

anny one can help me out ??


I get same error, how to fix this in full version of english rpg maker VX? huh.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.