ForeverZer0
Sponsor
Custom Event Triggers Version: 1.1
By: ForeverZer0
Introduction
Allows you to easily create custom triggers for events. Uses simple commentcode in their event page to create a new trigger. If trigger evaluates as 'true', their code will execute. Work differently than conditions, since the page conditions must still be met and they are what actually what begin execution of the event commands for that page.
Features
Screenshots
None.
Script
[rgss]#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Custom Event Triggers
# Author: ForeverZer0
# Version: 1.1
# Date: 10.13.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# VERSION HISTORY
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# v.1.0 7.14.2010
# - Original release
# v.1.1 10.13.2010
# - Shortened and made more efficient. Added comments.
# - Eliminated bug and removed an unnecessary Regular Expression.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
# Allows you to easily create custom triggers for events. Uses simple comment
# code in their event page to create a new trigger. If trigger evaluates as
# 'true', their code will execute. Work differently than conditions, since the
# page conditions must still be met and they are what actually what begin
# execution of the event commands for that page.
#
# Instructions:
#
# - Very simple. Make a comment at the TOP of the page you want the custom
# trigger to execute that simply reads "Custom Trigger". Now in the same
# comment on the next line, or in another comment directly below the first,
# simply write the a scripted true/false statement. If this line ever results
# in a true statement, and the page conditions are met, the page will execute
# its commands.
# - You can use as many comment boxes you need to script the trigger, but they
# must be consecutive and immediately after the "Custom Trigger" comment. Do
# not use an arbitrary comment right after these comments, else the game will
# attempt to include them in the trigger.
# - This will also disable all other triggers for this page.
#
# Here's an example:
#
# Comment: Custom Trigger
# : Input.press?(Input::L) && Input.press?(Input::R) &&
# : Input.trigger?(Input::C)
#
# This will execute the event if the C button is pressed while the L and R
# buttons are being held down (if page conditions are met).
#
# Another example:
#
# Comment: Custom Trigger
# : $game_party.steps == 23423
#
# This executes if the party step count is equal to 23423.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#===============================================================================
# ** Game_Event
#===============================================================================
class Game_Event
attr_accessor :trigger
alias zer0_custom_trigger_refresh refresh
def refresh
# Normal refresh method.
zer0_custom_trigger_refresh
# Search top of current page for the string "Custom Trigger".
if @page != nil && @page.list[0].code == 108 &&
@page.list[0].parameters[0] == 'Custom Trigger'
trigger, list_index = '', 1
# If found, loop until the next command is not a comment, adding each line
# of the comments into a single string.
while [108, 408].include?(@page.list[list_index].code)
trigger += @page.list[list_index].parameters[0] + ' '
list_index += 1
end
# Set event trigger to -1, which no method exists for by default.
@custom_trigger, @trigger = trigger, -1
end
end
alias zer0_custom_trigger_upd update
def update
zer0_custom_trigger_upd
# If trigger is -1, and the created string evaluates as true, start event.
if @trigger == -1 && !@erased && eval(@custom_trigger)
start
end
end
end
[/rgss]
Instructions
See script. Even if you have no scripting experience, you can will likely still be able to create the triggers, so do not let that turn you off to the script.
Compatibility
No known compatibility issues.
Author's Notes
Please report any bugs/issues so that they can be resolved. Enjoy!
Terms and Conditions
Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
By: ForeverZer0
Introduction
Allows you to easily create custom triggers for events. Uses simple commentcode in their event page to create a new trigger. If trigger evaluates as 'true', their code will execute. Work differently than conditions, since the page conditions must still be met and they are what actually what begin execution of the event commands for that page.
Features
- Very easy to use (requires very simple script statements)
- Can use ABSOLUTELY anything to trigger an event.
- No longer confined to the few basic triggers.
Screenshots
None.
Script
[rgss]#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Custom Event Triggers
# Author: ForeverZer0
# Version: 1.1
# Date: 10.13.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# VERSION HISTORY
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# v.1.0 7.14.2010
# - Original release
# v.1.1 10.13.2010
# - Shortened and made more efficient. Added comments.
# - Eliminated bug and removed an unnecessary Regular Expression.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
# Allows you to easily create custom triggers for events. Uses simple comment
# code in their event page to create a new trigger. If trigger evaluates as
# 'true', their code will execute. Work differently than conditions, since the
# page conditions must still be met and they are what actually what begin
# execution of the event commands for that page.
#
# Instructions:
#
# - Very simple. Make a comment at the TOP of the page you want the custom
# trigger to execute that simply reads "Custom Trigger". Now in the same
# comment on the next line, or in another comment directly below the first,
# simply write the a scripted true/false statement. If this line ever results
# in a true statement, and the page conditions are met, the page will execute
# its commands.
# - You can use as many comment boxes you need to script the trigger, but they
# must be consecutive and immediately after the "Custom Trigger" comment. Do
# not use an arbitrary comment right after these comments, else the game will
# attempt to include them in the trigger.
# - This will also disable all other triggers for this page.
#
# Here's an example:
#
# Comment: Custom Trigger
# : Input.press?(Input::L) && Input.press?(Input::R) &&
# : Input.trigger?(Input::C)
#
# This will execute the event if the C button is pressed while the L and R
# buttons are being held down (if page conditions are met).
#
# Another example:
#
# Comment: Custom Trigger
# : $game_party.steps == 23423
#
# This executes if the party step count is equal to 23423.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#===============================================================================
# ** Game_Event
#===============================================================================
class Game_Event
attr_accessor :trigger
alias zer0_custom_trigger_refresh refresh
def refresh
# Normal refresh method.
zer0_custom_trigger_refresh
# Search top of current page for the string "Custom Trigger".
if @page != nil && @page.list[0].code == 108 &&
@page.list[0].parameters[0] == 'Custom Trigger'
trigger, list_index = '', 1
# If found, loop until the next command is not a comment, adding each line
# of the comments into a single string.
while [108, 408].include?(@page.list[list_index].code)
trigger += @page.list[list_index].parameters[0] + ' '
list_index += 1
end
# Set event trigger to -1, which no method exists for by default.
@custom_trigger, @trigger = trigger, -1
end
end
alias zer0_custom_trigger_upd update
def update
zer0_custom_trigger_upd
# If trigger is -1, and the created string evaluates as true, start event.
if @trigger == -1 && !@erased && eval(@custom_trigger)
start
end
end
end
[/rgss]
Instructions
See script. Even if you have no scripting experience, you can will likely still be able to create the triggers, so do not let that turn you off to the script.
Compatibility
No known compatibility issues.
Author's Notes
Please report any bugs/issues so that they can be resolved. Enjoy!
Terms and Conditions
Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
You are free:
to Share - to copy, distribute and transmit the work
to Remix - to adapt the work
Under the following conditions:
Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
Noncommercial. You may not use this work for commercial purposes.
Share alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
- For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.
- Any of the above conditions can be waived if you get permission from the copyright holder.
- Nothing in this license impairs or restricts the author's moral rights.
to Share - to copy, distribute and transmit the work
to Remix - to adapt the work
Under the following conditions:
Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
Noncommercial. You may not use this work for commercial purposes.
Share alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
- For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.
- Any of the above conditions can be waived if you get permission from the copyright holder.
- Nothing in this license impairs or restricts the author's moral rights.