RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[REQUEST]World Map-Change Enemy Encounters Script

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 82
"I'm a doctor. I get rid of illnesses, like you".
Summary
A script for World Maps that will enable you to change which enemy troops you encounter depending on which region you are currently in. Ex.While on the snowy part of the world map, you would encounter Arctic Wolves and Polar Bears but when you are in the grassland area you would encounter Goblins and Trolls.

Features Desired
The ability to switch between at least 20 different Troop Variations.

Games its been in

•It's in alot of RPGs with World Maps.
« Last Edit: August 16, 2010, 12:59:03 AM by pyrodudexiii »
I wish I had a good signature...

**
Rep: +0/-0Level 82
"I'm a doctor. I get rid of illnesses, like you".
I wish I had a good signature...

*
Rep:
Level 85
I solve practical problems.
For taking arms in the name of your breakfast.
I think there is a tutorial / event system for this, look for RMXP  enemy encounters based on level or RMXP enemy encounters based on location

**
Rep: +0/-0Level 82
"I'm a doctor. I get rid of illnesses, like you".
Thanks, I'll try to find it.
I wish I had a good signature...

***
Rep:
Level 89
I have attention problems.
You can change each tile's terrain tag in the tileset section in the database.  This allows you to have about 7 different mob lists based on the tile you're standing on with another script.  I'm not sure if there is a way to go above the 7 maximum for terrain tag number.

Insert the following script into your game.  It's not mine, don't credit me for it.
Code: [Select]
#===============================================================================
# ** Map : Change Encounters
#===============================================================================
#    * $game_map.encounter_list = [...] will change encounter list on current map
#    * $game_map.encounter_step = number will change encounter steps on current map
#    * $game_map.encounter_list = nil will reset encounter list to default
#    * $game_map.encounter_step = nil will reset encounter step to default
#    * $game_map.encounters[map_id].list = [...] will change encounter list on specified map
#    * $game_map.encounters[map_id].step = number will change encounter steps on specified map
#    * $game_map.encounters[map_id].list = nil will reset specified map's encounter list to default
#    * $game_map.encounters[map_id].step = nil will reset specified map's encounter step to default
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
if Object.const_defined?(:SDK)
  SDK.log('Map.ChangeEncounters', 'Kain Nobel ©', 3.5, '2009.06.17')
end
 
#===============================================================================
# ** Game_Map::Encounter_List
#===============================================================================
 
class Game_Map::Encounters
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_accessor :list
  attr_accessor :step
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize
    @list = nil
    @step = nil
  end
end
 
#===============================================================================
# ** Game_Map
#===============================================================================
 
class Game_Map
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_reader :encounters
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :chgencounters_gmmap_setup,          :setup
  alias_method :chgencounters_gmmap_encounterlist,  :encounter_list
  alias_method :chgencounters_gmmap_encounterstep,  :encounter_step
  #-----------------------------------------------------------------------------
  # * Setup
  #-----------------------------------------------------------------------------
  def setup(map_id)
    @encounters ||= Hash.new
    chgencounters_gmmap_setup(map_id)
    @encounters[map_id] ||= Game_Map::Encounters.new
  end
  #-----------------------------------------------------------------------------
  # * Reset Encounters
  #-----------------------------------------------------------------------------
  def reset_encounters
    encounter_list = @map.encounter_list
    encounter_step = @map.encounter_step
  end
  #-----------------------------------------------------------------------------
  # * Encounter List
  #-----------------------------------------------------------------------------
  def encounter_list
    unless @encounters[map_id].list.is_a?(Array)
      old_list = chgencounters_gmmap_encounterlist
      @encounters[map_id].list = old_list
    end
    @encounters[map_id].list
  end
  #-----------------------------------------------------------------------------
  # * Encounter Step
  #-----------------------------------------------------------------------------
  def encounter_step
    unless @encounters[map_id].step.is_a?(Numeric)
      old_step = chgencounters_gmmap_encounterstep
      @encounters[map_id].step = old_step
      $game_player.make_encounter_count
    end
    @encounters[map_id].step
  end
  #-----------------------------------------------------------------------------
  # * Encounter List = (list)
  #-----------------------------------------------------------------------------
  def encounter_list=(list)
    unless list.is_a?(Array) || list.is_a?(NilClass)
      err  = "Wrong argument for changing $game_map.encounter_list\n\nThe argum"
      err += "ent must be an :Array: (or :NilClass: object to reset), not a "
      err += ":#{list.class}:"
      raise ArgumentError.new(err)
    end
    @encounters[map_id].list = list
  end
  #-----------------------------------------------------------------------------
  # * Encounter Step = (step)
  #-----------------------------------------------------------------------------
  def encounter_step=(step)
    unless step.is_a?(Numeric) || step.is_a?(NilClass)
      err  = "Wrong argument for changing $game_map.encounter_step\n\nThe argum"
      err += "ent must be a :Numeric: (or :NilClass: object to reset), not a "
      err += ":#{step.class}:"
      raise ArgumentError.new(err)
    end
    @encounters[map_id].step = step
    $game_player.make_encounter_count
  end
end
 

Next, go to your world map tileset in the database and set each ground tile type's terrain tag to a different number depending on the environment it represents.  Make sure that tiles that aren't on the ground have a terrain tag of 0.

Now, make a common event, parallel trigger
The first command should set a variable to the character's terrain tag.
Now, make a conditional branch for each terrain tag.  Put this script into the conditional branch matching the correct terrain tag #
Code: [Select]
$game_map.encounter_list = [...]
Change the "..." to all of the troop ID's that you want to attack the player on that tile.  Separate them with a comma and space like this: [1, 2, 3, 4]

Now you should encounter different monsters depending on what type of tile you are standing on.
"...because, you know, whatever."

**
Rep: +0/-0Level 82
"I'm a doctor. I get rid of illnesses, like you".
Thanks Tenraah, I really appreciate that.
I wish I had a good signature...