Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Little Edit of an Region System by Gubid [Resolved]

Save-Point

Full Version: Little Edit of an Region System by Gubid [Resolved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Long Time ago (about 2 years xD) I found a script, don't know who made it but now it's necessary for me^^ the script needs just one little edit to fit my need. so here is the script:

Code:
class Game_Map
  #----------------------------------------------------------------------
  # This item enables and disables the system.  This allows lower level maps
  # to be enabled as well, if desired
  #----------------------------------------------------------------------
  REGIONS_ENABLED = true
  
  #--------------------------------------------------------------------------
  # Region Setup
  # This simply add the new variables for regioning.
  #--------------------------------------------------------------------------
  alias region_setup setup
  def setup(map_id)
    region_setup(map_id)
    @cur_reg = []
    @regions = REGIONS::regions(@map_id)
  end
  #--------------------------------------------------------------------------
  # Region Update
  # This item runs Check Region, which in turn returns what region you are in
  #--------------------------------------------------------------------------
  alias region_update update
  def update
    if REGIONS_ENABLED
      check_current_region
    end
    region_update
  end
  #--------------------------------------------------------------------------
  # Current Region
  # This checks your current region and displays it.
  #--------------------------------------------------------------------------
  def cur_region
    if @cur_reg.size < 2
      if @cur_reg[0] == nil
        return nil
      else
        return @cur_reg[0]+1
      end
    else
      return sprintf("%d, and %d",@cur_reg[0]+1, @cur_reg[1]+1)
    end
  end
  
  #--------------------------------------------------------------------------
  # Check Region
  # This checks what region you are currently in.  You can be in more than one.
  #--------------------------------------------------------------------------
  def check_current_region
    @cur_reg = []
    unless @regions.size == 0
      for i in 0...@regions.size
        region = @regions[i]
        if (region[1]-1 <= $game_player.x and region[2] >= $game_player.x) and (region[3]-1 <= $game_player.y and region[4] >= $game_player.y)
          @cur_reg.push(i)
        end
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # Get Encounter List
  # This is replacing the existing method for encounter list.  Basically it
  # returns the default list if a region is not defined, and when defined
  #--------------------------------------------------------------------------  
  def encounter_list
    if @cur_reg.size == 0
      return @map.encounter_list
    elsif @cur_reg.size == 1
      return @regions[@cur_reg[0]][5]
    elsif @cur_reg.size > 1
      @list = []
      for i in 0...@cur_reg.size
        troops = @regions[@cur_reg[i]][5]
        @list += troops
      end
      return @list
    end
  end
end

  #----------------------------------------------------------------------
  # Module:: REGIONS
  # This is the section where you can add new regions to an exiting map or
  # to a new map.  Use the below diagram to determine varibles you should set.
  # Regions can overlap so go ahead and play with it.
  #----------------------------------------------------------------------
  # [Name, starting_x, ending_x, starting_y, ending_y, [TroopID_1, TroopID_2..]]
  #----------------------------------------------------------------------
  
module REGIONS
  def self.regions(map_id)
    regions = []
    case map_id
    when 4
      name = "Enzar"  #region1
      sx = 20
      ex = 23
      sy = 13
      ey = 18
      troops = [1]  #Ghost
      regions.push([name,sx,ex,sy,ey,troops])
      
      name = "Yanko Ebene"  #region2
      sx = 1
      ex = 300
      sy = 1
      ey = 250
      troops = [2]  #Basilisk
      regions.push([name,sx,ex,sy,ey,troops])
    
    
    end
    return regions
  end
end

The script allows you to make different regions on one map with different encounters per region. now i just want to set the battleback also per region, so could someone edit this script so i can set for each region a individual battleback?

Ty in Advance, you will be in my credits ^^
It's by Gubid. from 2 years ago. The header was trimmed off so identifying it wasn't easy.
Code:
#----------------------------------------------------------------------
#Regions System
# By GubiD
# Created 8/23/07
#----------------------------------------------------------------------

class Game_Map
#----------------------------------------------------------------------
# This item enables and disables the system. This allows lower level maps
# to be enabled as well, if desired
#----------------------------------------------------------------------
REGIONS_ENABLED = true

#--------------------------------------------------------------------------
# Region Setup
# This simply add the new variables for regioning.
#--------------------------------------------------------------------------
alias region_setup setup
def setup(map_id)
region_setup(map_id)
@cur_reg = []
@regions = REGIONS::regions(@map_id)
end
#--------------------------------------------------------------------------
# Region Update
# This item runs Check Region, which in turn returns what region you are in
#--------------------------------------------------------------------------
alias region_update update
def update
if REGIONS_ENABLED
check_current_region
end
region_update
end
#--------------------------------------------------------------------------
# Current Region
# This checks your current region and displays it.
#--------------------------------------------------------------------------
def cur_region
if @cur_reg.size < 2
if @cur_reg[0] == nil
return nil
else
return @cur_reg[0]+1
end
else
return sprintf("%d, and %d",@cur_reg[0]+1, @cur_reg[1]+1)
end
end

#--------------------------------------------------------------------------
# Check Region
# This checks what region you are currently in. You can be in more than one.
#--------------------------------------------------------------------------
def check_current_region
@cur_reg = []
unless @regions.size == 0
for i in 0...@regions.size
region = @regions[i]
if (region[1]-1 <= $game_player.x and region[2] >= $game_player.x) and (region[3]-1 <= $game_player.y and region[4] >= $game_player.y)
@cur_reg.push(i)
end
end
end
end

#--------------------------------------------------------------------------
# Get Encounter List
# This is replacing the existing method for encounter list. Basically it
# returns the default list if a region is not defined, and when defined
#--------------------------------------------------------------------------
def encounter_list
if @cur_reg.size == 0
return @map.encounter_list
elsif @cur_reg.size == 1
return @regions[@cur_reg[0]][5]
elsif @cur_reg.size > 1
@list = []
for i in 0...@cur_reg.size
troops = @regions[@cur_reg[i]][5]
@list += troops
end
return @list
end
end
end

#----------------------------------------------------------------------
# Module:: REGIONS
# This is the section where you can add new regions to an exiting map or
# to a new map. Use the below diagram to determine varibles you should set.
# Regions can overlap so go ahead and play with it.
#----------------------------------------------------------------------
# [Name, starting_x, ending_x, starting_y, ending_y, [TroopID_1, TroopID_2..]]
#----------------------------------------------------------------------

module REGIONS
def self.regions(map_id)
regions = []
case map_id
when 1
name = "Halase" #region1
sx = 1
ex = 9
sy = 1
ey = 7
troops = [1,2] #Ghost
regions.push([name,sx,ex,sy,ey,troops])

name = "Belasten" #region2
sx = 6
ex = 15
sy = 1
ey = 7
troops = [3,4] #Basilisk
regions.push([name,sx,ex,sy,ey,troops])

when 2 #This method is the same as just setting them in RMXP on the map.
name = "Jimco"
sx = 1
ex = $game_map.width
sy = 1
ey = $game_map.height
troops = [5,6] #Shaglins
regions.push([name,sx,ex,sy,ey,troops])
end
return regions
end
end

Demo

Maybe he'll find the post now that it's identified who made the script
ok thx, at least i can credit him now :D now I just need someone to edit this :)
Ok i found the Individual Troop Battlebacks Script by PK8, so it's not necessary to implement that in this script anymore. Ty, Topic resolved^^