Chaos Project

RPG Maker => RPG Maker Scripts => RMVX Script Database => Topic started by: modern algebra on March 25, 2008, 03:47:38 pm

Title: [VX] Advanced Areas
Post by: modern algebra on March 25, 2008, 03:47:38 pm
Advanced Areas
Authors: modern algebra
Version: 1.0
Type: Map Configuration
Key Term: Environment Add-on



Introduction

Adds a couple of options to areas. If anyone has any ideas for more, please tell me.


Features




Screenshots

N/A


Demo

N/A


Script
Spoiler: ShowHide

#==============================================================================
#  Advanced Areas
#  Version 1.0
#  Author: modern algebra
#  Date: March 12, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    Set up the database below in the Editable Regions. Both are set up in the
#    same way, and they look like this:
#
#      when id
#        rate/switch = value
#
#    You only need to set it if it is not default. If an area has no switch,
#    then don't set it up. If you want the encounter step to be the same as
#    the parent map, then do not set it up. In any case, just so we are clear,
#    I provided a few examples in the Editable Regions. Feel free to
#    replace/delete them once you know what you're doing.
#==============================================================================

#==============================================================================
# ** RPG::Area
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of changes:
#    new methods - encounter_step, active?
#==============================================================================

class RPG::Area
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Encounter Rate
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def encounter_step
    rate = $game_map.encounter_step
    # Branch by ID
    case @id
    #----------------------------------------------------------------------
    #  EDITABLE REGION
    #----------------------------------------------------------------------
    when 1
      rate = 10
    when 3
      rate = 15
    #----------------------------------------------------------------------
    #  END EDITABLE REGION
    #----------------------------------------------------------------------
    end
    return rate
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Active?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def active?
    switch = 0
    case @id
    #----------------------------------------------------------------------
    #  EDITABLE REGION                                                   
    #----------------------------------------------------------------------
    when 1
      switch = 1
    when 4
      switch = 1
    #----------------------------------------------------------------------
    #  END EDITABLE REGION
    #----------------------------------------------------------------------
    end
    return true if switch == 0
    return $game_switches[switch]
  end
end

#==============================================================================
# ** Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - encounter_step
#==============================================================================

class Game_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Encounter Step
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_advncd_areas_step_encntr encounter_step
  def encounter_step
    # Get original Map Encounter Step
    encounter_rates = [modalg_advncd_areas_step_encntr]
    # Get all the areas the player is in. For ne
    $data_areas.values.each { |i| encounter_rates.push (i.encounter_step) if i.map_id == @map && $game_player.in_area? (i) }
    return encounter_rates.min
  end
end

#==============================================================================
# ** Game_Player
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - in_area?
#==============================================================================

class Game_Player
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * In Area?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_advnced_areas_area_in? in_area?
  def in_area? (area)
    return false unless area.active?
    modalg_advnced_areas_area_in? (area)
  end
end



Instructions

See inside the script.


Compatibility

This script will not work with Blizz-ABS


Credits and Thanks




Author's Notes

Just post here if you have any errors. I will try to fix them. If you have any ideas about good options to add to the areas, please post here and if I think they are good I will write them in.
Title: Re: [VX] Advanced Areas
Post by: Blizzard on March 26, 2008, 11:48:06 am
Not compatible with Blizz-ABS. =/ I rewrote Game_Player completely due to the control system change.
Title: Re: [VX] Advanced Areas
Post by: modern algebra on March 26, 2008, 12:27:25 pm
Blizz-ABS works in VX? That's pretty wicked. But in any case, this script would be kind of useless in an ABS anyway. If I remember correctly, you set events as enemies: you wouldn't use areas to determine encounters. I'll add it to the Compatibility Issues List anyway
Title: Re: [VX] Advanced Areas
Post by: Blizzard on March 26, 2008, 12:42:05 pm
Right, that's VX. >.< No, Blizz-ABS doesn't work in VX. Couldn't this script work in XP, too?
And no, I don't think that it would be useless. There is quite a number of people that asked me to allow the normal battle scene call in Blizz-ABS which I did.
Title: Re: [VX] Advanced Areas
Post by: modern algebra on March 26, 2008, 01:10:32 pm
Ah.

No, this script won't work in XP - I wrote a different script that would. I think it's on the old forum : (

But in VX, areas are already built in - all this script does is add two options to it - encounter rate and the ability to activate and deactivate areas with a switch.

But yeah, you're right. I guess that it does have some relevance in an ABS if they allow for regular battles