Temporarily Remove Page From Event
by Khale_Kitha
Introduction
Allows the designer to temporarily remove a specified page from an event. Though the event will continue to process until it reaches it's end, this allows the designer to have parallel process pages on an event that execute once and then remove themselves until the player re-enters the map.
How to Use
Paste above main.
Inside of an event page, use
$game_map.events[id].remove_page(#), where id is the event id you wish to modify and # is the page on that event.
Alternate usages:
- You may choose to use remove_current_page to remove the currently active page on an event. (According to find_proper_page) Eg.
$game_map.events[id].remove_current_page
- You may also choose to simply use the code segment '
remove_current_page' from the script of an event to remove the currently active page of the event you are on.
- There are aliases for each of the methods, as well, if you are running out of space in your script block, but they shouldn't be needed.
Note:
The script simply removes the page and then checks the event, again, to see which page is the next valid page. The current page will continue to execute until it finishes and then it will not exist again, until the player re-enters the map. This works similarly to "Erase" for an event, but it allows full functionality of an event to exist without having multiple events for one purpose.
An example of it's use will be illustrated in an upcoming tutorial, in the next few days.
When choosing a page, pick the number listed in the UI, rather than the data page index. I did this to make it easier on people who don't think in a 0-based indexing system to be able to wrap their head around the script. (If you want it to be 0-based, simply remove the -1 from the script)
Script
Spoiler#===============================================================================
#
# Temporarily Remove Page From Event
# Author: Khale_Kitha
# Date (07/07/2013)
# Version: (1.0.1) (VXA)
# Level: (Easy)
#
#===============================================================================
#
# NOTES:# 1. The script simply removes the page and then checks the event, again, to see which page is the next valid page. The current page will continue to execute until it finishes and
# then it will not exist again, until the player re-enters the map. This works similarly to "Erase" for an event, but it allows full functionality of an event to exist without having multiple
# events for one purpose
# 2. When choosing a page, pick the number listed in the UI, rather than the data page index. I did this to make it easier on people who don't think in a 0-based indexing system
# to be able to wrap their head around the script. (If you want it to be 0-based, simply remove the -1 from the script)
#
#===============================================================================
#
# Description: Allows the designer to temporarily remove a specified page from an event.
#
# Credits: Khale_Kitha
#
#===============================================================================
#
# Instructions
# Paste above main.
# Inside of an event page, use $game_map.events[id].remove_page(#), where id is the event id you wish to modify and # is the page on that event.
# Alternate usages:
# - You may choose to use remove_current_page to remove the currently active page on an event. (According to find_proper_page) Eg. $game_map.events[id].remove_current_page
# - You may also choose to simply use the code segment 'remove_current_page' from the script of an event to remove the currently active page of the event you are on.
# - There are aliases for each of the methods, as well, if you are running out of space in your script block, but they shouldn't be needed.
#
#===============================================================================
#
# Free for any use as long as I'm credited.
#
class Game_Event < Game_Character
def remove_current_page
@event.pages.delete(@page)
refresh
end
def remove_page(id)
@event.pages.delete_at(id - 1)
refresh
end
alias_method :rm_cur_page, :remove_current_page
alias_method :rm_page, :remove_page
end
class Game_Interpreter
def remove_current_page
$game_map.events[event_id].remove_current_page
end
alias_method :rm_cur_page, :remove_current_page
end
FAQ
None right now.
Credit and Thanks
- Khale_Kitha & Mithran
Version Notes:
1.0.1 - Added the ability to remove the current page of a referenced event.
- Added the ability for an event page to remove itself.
- Added space-saving aliases for the methods if script space is an issue.
本贴来自国际rpgmaker官方论坛作者:Khale_Kitha处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/temporarily-remove-a-page-from-an-event.15457/