The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: Infinate X on October 01, 2011, 02:38:19 AM

Title: A Breakthrough in Battlebacks
Post by: Infinate X on October 01, 2011, 02:38:19 AM
Battle Maps
Description:


I've just had a brilliant idea! What if there were a script that removed the crappy swirl effect from the background and teleported your player to a pre-specified map whenever a battle occurs? What I mean is, what if there were battle maps, apposed to battlebacks? As soon as the battle ends your location should be returned to and the event (if an event was in process) would continue. (If no event was in process it would return you as if a regular battle occured.) It would save a lot of time for game developers and it would save the space required for the Map Saver script + the Battlebacks script. There would be no need for a Map Saver script so you could just use the brand new battlebacks script!


Wouldn't it just be wonderful?  ;8

Features:



More feature may be added.[/list]
Title: Re: A Breakthrough in Battlebacks
Post by: modern algebra on October 03, 2011, 12:05:17 AM
I would suggest just using one of the battleback scripts that allow you to use pictures (which already exist) and just use pictures of the maps to which you'd want to teleport in your idea. It would load a lot faster than composing an entirely new tilemap graphic every time you go to battle.
Title: Re: A Breakthrough in Battlebacks
Post by: Infinate X on October 05, 2011, 06:57:06 PM
No tile maps would be required (at least I think so :S)

It would just be normal maps that you take the pictures of. I have a battlebacks script but I was hoping for this script to save time.
Title: Re: A Breakthrough in Battlebacks
Post by: pacdiggity on October 06, 2011, 04:17:21 AM
You'd need to create a tilemap to take a picture of the map. I think it would be best if you used a pre-existing battleback script and used screenshots of your map as the background. It would be much faster. I think said script would also be able to remove the 'crappy' blur effect as well.
Title: Re: A Breakthrough in Battlebacks
Post by: JonFawkes on October 06, 2011, 05:54:27 AM
I'm not sure if this would achieve what you want, but couldn't you also use the snapshot_for_background (defined in Scene_Map I think) to create a picture of the map you're on and use it as a battleback? Please correct me if I'm wrong or if this is infeasible.
Title: Re: A Breakthrough in Battlebacks
Post by: pacdiggity on October 06, 2011, 07:03:14 AM
snapshot_for_background is defined in Scene_Base.
  def snapshot_for_background
    $game_temp.background_bitmap.dispose
    $game_temp.background_bitmap = Graphics.snap_to_bitmap
    $game_temp.background_bitmap.blur
  end

It would work to do it that way, but it would actually probably be quicker to load pictures preset in a module than to go to the new map, take a snapshot and use that as the battleback then transport back to the original map.
Title: Re: A Breakthrough in Battlebacks
Post by: Infinate X on October 06, 2011, 11:32:44 PM
Quote from: Pacman on October 06, 2011, 07:03:14 AM
snapshot_for_background is defined in Scene_Base.
  def snapshot_for_background
    $game_temp.background_bitmap.dispose
    $game_temp.background_bitmap = Graphics.snap_to_bitmap
    $game_temp.background_bitmap.blur
  end

It would work to do it that way, but it would actually probably be quicker to load pictures preset in a module than to go to the new map, take a snapshot and use that as the battleback then transport back to the original map.

The reason I don't want to do this is because of the number of maps I have for battlebacks... Well I only have three but I will eventually have lots.
Title: Re: A Breakthrough in Battlebacks
Post by: pacdiggity on October 07, 2011, 03:42:37 AM
Quote from: Infinate X on October 06, 2011, 11:32:44 PM
The reason I don't want to do this is because of the number of maps I have for battlebacks... Well I only have three but I will eventually have lots.
I don't think you quite understand what I was getting at. Doing it by your proposed way would take the same amount of wasted time and space every time you went into a battle. My way only takes up the data to store the graphics (which can be compressed anyway) and the time it takes to take the screenshots and store them. It's marginally easier to do, takes far less time and the only con is the used data.
Title: Re: A Breakthrough in Battlebacks
Post by: cozziekuns on October 07, 2011, 03:59:02 AM
I think he means linking to a map as if it were an ABS, and then teleporting back to the original map with the same co-ordinates and everything.

Edit: Cooked this up in a few minutes -

# NOTE: This script REQUIRES my Tilemap to Bitmap script, which can be found
# here:
#
# http://pastebin.com/raw.php?i=Jmqcn5rq
#
#===============================================================================
# Map to Battleback
#-------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns (rmrk)
# Last Date Updated: 10/6/2011
#===============================================================================
# Description:
#-------------------------------------------------------------------------------
# A tool which allows you to directly use tilemaps as battlebacks. Does not
# support parallax mapping as of yet, and requires Cozziekuns' Tilemap to Bitmap
# script.
#===============================================================================
# Updates
# ------------------------------------------------------------------------------
# o 10/6/2011 - Started Script.
#===============================================================================
# To-do List
#-------------------------------------------------------------------------------
# o Nothing. Post some ideas.
#===============================================================================
# Instructions
#-------------------------------------------------------------------------------
# Copy and paste this script above Main Process but below Materials. The modules
# should be changed following these instructions:
#
# o MANUAL_TRIGGER: The switch id to set to true if you want to manually change
#                    the map id of the battle taking place.
#
# o MANUAL_VARIABLE_ID: The variable id of the map_id you want the battle to
#                        take place. Will only be used when the Manual Trigger
#                        switch is set to on.
#
# o DEFAULT_MAP_IDS: The map id you want to use as a battleback when on a
#                    certain map id. For example, if I wanted to use the
#                    map with id of 4 as my battleback, and I wanted it to be my
#                    battleback whenever I was on the map with the id of 2, then
#                    I would add into the hash: 2 => 4.
#                    Syntax: DEFAULT_MAP_IDS ={
#                      map_id => battleback_map_id,
#                      map_id => battleback_map_id,
#                      ...
#                    }
#
# o USE_REGULAR_BLUR: Do you want your map to be blurred? Set to true if so,
#                     otherwise set to false.
#
# o USE_RADIAL_BLUR: Do you want your map to have the default radial blur? Set 
#                    to true if so, otherwise set to false.
#
# o STRETCH_BACKGROUND: Do you want to stretch the background? Set to true if
#                       so, otherwise set to false.
#
# o STRETCH_BACKGROUND_WIDTH: How wide do you want the background to be. The
#                             value is only used if STRETCH_BACKGROUND is set to
#                             true.
#
# o STRETCH_BACKGROUND_HEIGHT: How tall do you want the background to be. The
#                              value is only used if STRETCH_BACKGROUND is set
#                              to true.
#===============================================================================

module COZZIEKUNS
 
  module REVBB
   
    MANUAL_TRIGGER = 5
    MANUAL_VARIABLE_ID = 6
    DEFAULT_MAP_IDS ={
      1 => 2,
    }
   
    USE_REGULAR_BLUR = false
    USE_RADIAL_BLUR = false
   
    STRETCH_BACKGROUND = false
    STRETCH_BACKGROUND_WIDTH = 640
    STRETCH_BACKGROUND_HEIGHT = 480
 
  end
 
end

if Game_System.instance_methods.include?("tilemap_to_bitmap")
 
#==============================================================================
# ** Scene_Map
#==============================================================================
 
class Scene_Map < Scene_Base
   
  alias coz_infinate_revbb_scm_terminate terminate
  def terminate
    coz_infinate_revbb_scm_terminate
    if $scene.is_a?(Scene_Battle)     
      id = COZZIEKUNS::REVBB::MANUAL_TRIGGER
      manual_id = COZZIEKUNS::REVBB::MANUAL_VARIABLE_ID
      default_map = COZZIEKUNS::REVBB::DEFAULT_MAP_IDS[$game_map.map_id]
      map_id = $game_switches[id] ? $game_variables[manual_id] : default_map
      $game_temp.background_bitmap.dispose
      $game_temp.background_bitmap = $game_system.tilemap_to_bitmap(map_id)
      $game_temp.background_bitmap.blur if COZZIEKUNS::REVBB::USE_REGULAR_BLUR
    end
  end
 
end

#==============================================================================
# ** Spriteset_Battle
#==============================================================================

class Spriteset_Battle
 
  if not COZZIEKUNS::REVBB::USE_RADIAL_BLUR
    def create_battleback
      if COZZIEKUNS::REVBB::STRETCH_BACKGROUND
        width = COZZIEKUNS::REVBB::BACKGROUND_WIDTH
        height = COZZIEKUNS::REVBB::BACKGROUND_HEIGHT
        source = $game_temp.background_bitmap
        bitmap = Bitmap.new(width, height)
        bitmap.stretch_blt(bitmap.rect, source, source.rect)
      else
        bitmap = $game_temp.background_bitmap
      end
      @battleback_sprite = Sprite.new(@viewport1)
      @battleback_sprite.bitmap = bitmap
      @battleback_sprite.ox = bitmap.width / 2
      @battleback_sprite.oy = bitmap.height / 2
      @battleback_sprite.x = 272
      @battleback_sprite.y = 208
    end
  end
 
end
 
else
 
  p "This script requires Cozziekuns Tilemap to Bitmap Converter."
  exit
 
end


It requires my Tilemap to Bitmap (http://pastebin.com/raw.php?i=Jmqcn5rq) converter. Tell me if that wasn't what you wanted.
Title: Re: A Breakthrough in Battlebacks
Post by: Infinate X on October 07, 2011, 07:57:46 PM
I just skimmed through the comments and it seems perfect. I'll try it out and if it works, I'll use it.

EDIT: PERFECT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!