MapSwitch 2 for RPG Maker VX [Exclusive]
#1
MapSwitch! 2 (RMVX)
Version: 2

Introduction
This script is pretty much designed to help developers streamline their projects with great ease. Here's how the script works and try to bear with my sloppy attempt at an explanation.

Okay so when a player enters a certain group of Map IDs, a particular switch would activate. When the player leaves one of those Map IDs, the switch that activated upon entering in the map would deactivate as well.

Again, I think it's totally useful and it helps streamline your project a little bit. Alright, here's an example:
How about marking which maps are "dungeons"? Whenever the player enters a map marked as a "dungeon", a switch would activate.

Features
  • Developers can set up what group of map IDs would activate a switch.
  • Switch deactivates whenever the player is not in a marked map ID.
  • It might help streamline your project.

Screenshots
I can't screenshot this but I will say this. Try the script out, set it up, enter multiple rooms and use RMVX's debug function (press F9) to see which switches are activated.

Demo
No demo.

Script
Code:
=begin
????????????????????????????????????????????????????????????????????????????????
? MapSwitch 2 for RPG Maker VX                                                 ?
? Version 2                                                                    ?
? by PK8                                                                       ?
? July 3rd, 2009                                                               ?
? http://rmvxp.com                                                             ?
????????????????????????????????????????????????????????????????????????????????
? ? Table of Contents                                                          ?
? ?? Author's Notes                - Line 17?20                                ?
? ?? Introduction & Description    - Line 22?34                                ?
? ?? Features                      - Line 36?39                                ?
? ?? Setting Up                    - Line 41?50                                ?
? ?? This aliases the following... - Line 52?53                                ?
? ?? Thanks                        - Line 55?57                                ?
????????????????????????????????????????????????????????????????????????????????
? ? Author's Notes                                                             ?
? I made v1 a year ago, mainly to give users (primarily eventers) a script     ?
? which could help them out a little. Version 2 might not be much but it's a   ?
? vast improvement over the first.                                             ?
????????????????????????????????????????????????????????????????????????????????
? ? Introduction & Description                                                 ?
? This script is pretty much designed to help developers streamline their      ?
? projects with great ease. Here's how the script works and try to bear with my?
? sloppy attempt at an explanation.                                            ?
?                                                                              ?
? Okay so when a player enters a certain group of Map IDs, a particular switch ?
? would activate. When the player leaves one of those Map IDs, the switch that ?
? activated upon entering in the map would deactivate as well.                 ?
?                                                                              ?
? Again, I think it's totally useful and it helps streamline your project a    ?
? little bit. Alright, here's an example:                                      ?
? How about marking which maps are "dungeons"? Whenever the player enters a map?
? marked as a "dungeon", a switch would activate.                              ?
????????????????????????????????????????????????????????????????????????????????
? ? Features                                                                   ?
? ? Developers can set up what group of map IDs would activate a switch.       ?
? ? Switch deactivates whenever the player is not in a marked map ID.          ?
? ? It might help streamline your project.                                     ?
????????????????????????????????????????????????????????????????????????????????
? ? Setting Up                                                                 ?
?   Take a look at this:                                                       ?
?                                                                              ?
?   Usage:                                                                     ?
?   Mapswitch[switch id] = [multiple map ids]                                  ?
?                                                                              ?
?   Example:                                                                   ?
?   Mapswitch[1] = [2, 3, 5]                                                   ?
?   Whenever the player is on maps 2, 3 or 5, switch 1 would activate. Whenever?
?   the player is not in any of those maps, the switch would deactivate.       ?
????????????????????????????????????????????????????????????????????????????????
? ? This aliases the following...                                              ?
? update_transfer_player - Scene_Map                                           ?
????????????????????????????????????????????????????????????????????????????????
? ? Thanks                                                                     ?
? EJlol: Helping out with a hash-related problem I had while remaking this     ?
?        short script.                                                         ?
????????????????????????????????????????????????????????????????????????????????
=end

#===============================================================================
# ** MapSwitch 2 for RPG Maker VX customisation!
#-------------------------------------------------------------------------------
# Set up which maps would activate a particular switch.
# Remember: Mapswitch[switchid] = [map ids]
#===============================================================================
class PK8
  Mapswitch = {} # Don't touch this.
 
  # Switch ID  |  Multiple Map IDs
  Mapswitch[1] = [1, 100]
  Mapswitch[3] = [2, 3, 4, 5, 6]
  Mapswitch[11] = [8]
end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
  alias pk8_mapswitch_update_transfer_player :update_transfer_player
 
  #--------------------------------------------------------------------------
  # * Player Transfer  Processing
  #--------------------------------------------------------------------------
  def update_transfer_player
    pk8_mapswitch_update_transfer_player
    PK8::Mapswitch.each_pair { |pk8_maps_sid, pk8_maps_mid|
    $game_switches[pk8_maps_sid] = pk8_maps_mid.include?($game_map.map_id) }
  end
end

Instructions
Jump to line 70 and set up the script from there.

FAQ
Awaiting question.

Compatibility
This aliases update_transfer_player of Scene_Map < Scene_Base.

Credits and Thanks
EJlol helped me out with stuff related to hashes.

Author's Notes
I made v1 a year ago, mainly to give users (primarily eventers) a script which could help them out a little. Version 2 might not be much but it's a vast improvement over the first.

Terms and Conditions
Exclusive to RMVXPUniverse, also, credit me please. :3
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Title Screen Replacer + Enhancer v1.0.1 [Exclusive] PK8 1 6,989 07-03-2009, 04:19 AM
Last Post: Hsia_Nu
   P's MessageBack Changer and Enhancer [Exclusive] PK8 0 5,779 07-02-2009, 04:28 PM
Last Post: PK8



Users browsing this thread: 1 Guest(s)