Allow events to be triggered when the player is On & Beside it.
Though it's a bit tricky to use, this allows developers to build traps that can be disarmed without having the player to trigger the traps first.
How to Use:
[1] Place the script below Material and above Main.
[2] Put <trap> tag in the event's name you wish to set up with 2 trigger.
[3] Set the event to trigger by "Player Touch" and Priority to "Below Characters"
[4] In the event's page, set up a conditional branch using this in the script box.
$game_map.events[@event_id].x == $game_player.x && $game_map.events[@event_id].y == $game_player.y[5] This will allow you to set up 2 trigger conditions.
When the player walks on to the trap: trigger damage
When the player is beside the trap and pushed a button to trigger it: trigger disarm.
Compatibility:
This script is using alias method, so it's unlikely it will cause any conflicts.
Terms of Use:
Free for use in both commercial and non-commercial.
Script:
Spoiler Code:
#==============================================================================# ■ Meow Face 2 trigger type Traps#------------------------------------------------------------------------------# Allow the trap to be triggered On AND Beside the event#==============================================================================# How to Use:# [1] Plug & Play, Put this script below Material and above Main# [2] Put <trap> in the event's name you wish to have 2 trigger type#==============================================================================class Game_Event < Game_Character attr_reader :meowname alias meow_name initialize def initialize(map_id, event) meow_name(map_id, event) @meowname = event.name endendclass Game_Player < Game_Character alias meow_map start_map_event def start_map_event(x, y, triggers, normal) $game_map.events_xy(x, y).each do |event| if event.trigger_in?(triggers) return event.start if $game_map.events[event.id].meowname.include?('<trap>') && event.normal_priority? != normal end end meow_map(x, y, triggers, normal) endend