[VX] Advanced Areas

Started by modern algebra, March 25, 2008, 03:47:38 pm

Previous topic - Next topic

modern algebra

March 25, 2008, 03:47:38 pm Last Edit: February 21, 2009, 05:45:46 am by shdwlink1993
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


  • Allows you to marry an in-game switch to an area, thus allowing it to be turned on and off at will. This can be useful if say, after some event in your game, like a volcano erupting, you want different monsters to pop up

  • Allows you to set an encounter step for each area. Where two areas conflict, it takes the smallest encounter step




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


  • modern algebra

  • Jensen for the request




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.

Blizzard

Not compatible with Blizz-ABS. =/ I rewrote Game_Player completely due to the control system change.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

modern algebra

March 26, 2008, 12:27:25 pm #2 Last Edit: March 26, 2008, 12:30:23 pm by modern algebra
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

Blizzard

March 26, 2008, 12:42:05 pm #3 Last Edit: March 26, 2008, 12:43:13 pm by Blizzard
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.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

modern algebra

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