Map Transfer Auto Events 1.0
Shaz
Introduction
This script lets you set up event commands that should be run when entering or exiting a map, using two common events that handle ALL maps.
Using this script, you can dispose of all the autorun or parallel process events on individual maps for "setup" or "reset" tasks, like weather, map tinting, relocating events, etc.
Features
- No need for parallel process events on individual maps.
- No need to reset display (weather, tint) on multiple events or maps when exiting a map - if it's raining in a village, ONE common event will turn the rain off when you enter a building - no need to turn it off on every door or in every interior map
- Condition setup/exit tasks based on progress in game (switches/variables) just like you'd do with a map event
Screenshots
In the example used here, I have an outside map where it's raining and the screen tint is normal, and an inside map where it's not raining and the screen tint is sepia.
Spoiler
How to Use
Copy and paste the script into a new slot in Materials. All methods are aliased, so it can go below all other scripts.
Create a parallel process common event for entering a map, and one for exiting a map.
Give each common event a unique switch, and change the ENTER_MAP_SWITCH and EXIT_MAP_SWITCH constants in this script to refer to the correct switch ids.
Add the following commands to each common event - they will be almost identical:
Code:
- Script: jump_to_label($game_map.map_id)Comment: In case there isn't a label defined for the current map, : jump to the end of the eventJump to Label: End<individual map commands go here>Comment: This should be run on all maps. Turn off the switch that conditions this common eventLabel: EndControl Switches [0015: ENTER MAP] = OFF
复制代码
Then, in the area indicated by <individual map commands go here> above, add the following block of code for every map where you want something to happen:
Code:
- Comment: The label is the map number (no leading zeros)Label: 12<add commands to be run when entering or exiting this map here>Jump to Label: End
复制代码
Here are the Enter Map and Exit Map common events for my sample.
For map 12 (exterior), it makes it rain when entering the map, and stops the rain when exiting the map.
For map 13 (interior), it changes the screen tone to sepia when entering the map, and changes it back to the default when exiting (note the longer change time when exiting - this is so it remains sepia while the screen is fading for the transfer).
Spoiler
Script
Spoiler Code:
- #============================================================================# TRANSFER AUTO EVENTS# v1.0 by Shaz#----------------------------------------------------------------------------# This script allows you to call a common event whenever you leave a map or# enter a map. This can be used to run map setup or exit commands without# needing individual events on each map. For example, screen tint and weather# changes, event location changes, etc.#----------------------------------------------------------------------------# To Install:# Copy and paste into a new script slot in Materials. This script aliases# existing methods, so can go below all other custom scripts.#----------------------------------------------------------------------------# To Use:# Create a parallel process common event for entering a map, and one for# exiting a map. Allocate a unique switch for each one.# ** Change the ENTER_MAP_SWITCH and EXIT_MAP_SWITCH constants below to refer# to the switches you are using# Add a Call Script command to the top of each common event, with the following:# jump_to_label($game_map.map_id)# Add a Jump to Label: End command# Add a Label: End command# Add a command to turn off the switch that conditions that common event# # Between the Jump to Label: End and Label: End command, add a label for# every map where you want this to run. The label name will be the map# number (Map023 will be Label: 23)# Add any commands you want to run when entering or exiting that map.# Add a Jump to Label: End command after every map group#----------------------------------------------------------------------------# Sample Enter Map common event (conditioned by switch 15)## Script: jump_to_label($game_map.map_id)# Comment: add a jump to end label, in case the current map is not listed# Jump to Label: End# # Comment: Entering map 12 # : This is an outside map, and it should be raining# Label: 12# Set Weather Effects: Rain, @0, Wait# Jump to Label: End## Comment: Entering map 13# : This is an inside map, and the screen tone should be sepia# Label: 13# Tint Screen: (34, -34, -68, 170), @1# Jump to Label: End## Comment: This should get processed for every map# Label: End# Control Switches: [0015:ENTER MAP] = OFF#----------------------------------------------------------------------------# Sample Exit Map common event (conditioned by switch 16)## Script: jump_to_label($game_map.map_id)# Comment: add a jump to end label, in case the current map is not listed# Jump to Label: End# # Comment: Exiting map 12 # : This is an outside map and it's raining - turn the rain off# Label: 12# Set Weather Effects: None, @0, Wait# Jump to Label: End## Comment: Exiting map 13# : This is an inside map with a sepia tone - reset the tone# : with a delay (don't wait) so it doesn't change while fading# Label: 13# Tint Screen: (0, 0, 0, 0), @60# Jump to Label: End## Comment: This should get processed for every map# Label: End# Control Switches: [0016:EXIT MAP] = OFF#----------------------------------------------------------------------------# Terms:# Use in free or commercial games# Credit Shaz#============================================================================ENTER_MAP_SWITCH = 15EXIT_MAP_SWITCH = 16class Game_Map alias shaz_tae_setup_events setup_events def setup_events $game_switches[ENTER_MAP_SWITCH] = true shaz_tae_setup_events endendclass Game_Player alias shaz_tae_reserve_transfer reserve_transfer def reserve_transfer(map_id, x, y, d = 2) $game_switches[EXIT_MAP_SWITCH] = true if map_id != $game_map.map_id shaz_tae_reserve_transfer(map_id, x, y, d) endendclass Game_Interpreter def jump_to_label(value) @list.size.times do |i| if @list[i].code == 118 && @list[i].parameters[0] == value.to_s @index = i return end end endend
复制代码
Or
download here
FAQ
Credit and Thanks
- Credit Shaz
- Okay to use in commercial games - no payment required
Author's Notes
I advise you to use this ONLY for things that need to be done
every time you enter or leave a map. I recommend you don't use this for cutscenes that will only play once (you
could, but I
wouldn't).
本贴来自国际rpgmaker官方论坛作者:Shaz处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/map-transfer-auto-events.17401/