Eventer's Toolbox
by Hevendor of rmxp.org, version 0.2.2
Introduction
Just a simple script to make eventing life easier for you.
Instructions/Features
Paste in the appropriate spot, above "Main" and below "Materials".
Copied from the script:
Screenshots
N/A
Script
Notes
Usable everywhere with credit to Hevendor.
Author's Notes
I'll be adding to this script as ideas come. Feel free to suggest your own
Older Versions
N/A
by Hevendor of rmxp.org, version 0.2.2
Introduction
Just a simple script to make eventing life easier for you.
Instructions/Features
Paste in the appropriate spot, above "Main" and below "Materials".
Copied from the script:
Code:
#==============================================================================
# * INSTRUCTIONS
# Remember when you had to set player coords, event coords to variables
# just to check where your events were, where rocks were etc.?
# Not anymore! Rock-pushing puzzles? Made easy!
# Use each of these commands wherever you want, though they are designed to use
# in a conditional branch event command. An example follows:
# @>Conditional Branch: $game_map.standing_on_tile?(5, 13)
# @> Do stuff, will happen if you ARE standing on the coords 5,13
# Else
# @> Do the rest of stuff, will happen if you ARE NOT standing on 5,13
#------------------------------------------------------------------------------
# * COMMANDS
# $game_map.standing_on_tile?(x, y)
# - checks if player is standing on map coordinates (x, y)
#
# $game_map.standing_on_event?(id)
# - checks if player is standing on event (id)
#
# $game_map.adjacent_tile?(x, y, standing)
# - checks if player is adjacent to tile (x, y).
# - if standing = false, it will check only if you are adjacent
# - if standing = true, it will check if you are adjacent OR standing on tile
#
# $game_map.cross_adjacent_event?(id, n)
# - checks if player is in a cross range of event ID, where n is the radius
# of the cross. To check if player is adjacent to event, use n=1
#
# $game_map.event_adjacent_event?(id, id2, n)
# - checks if event (id) is adjacent to event (id2), where n is the radius
# of the cross. To check if the events are directly adjacent, use n=1.
#
# $game_map.event_standing_coords?(id, x, y)
# - checks if event (id) is standing on map coordinates (x, y).
#==============================================================================
Screenshots
N/A
Script
Code:
#==============================================================================
# ** RMVX Eventer's Toolbox
#------------------------------------------------------------------------------
# * Includes several different utilities to make eventing easier.
# 10-03-2008 (dd-mm-yyyy) © Hevendor of rmxp.org
# Version 0.2.2
# Latest update: N/A
#==============================================================================
#==============================================================================
# * INSTRUCTIONS
# Remember when you had to set player coords, event coords to variables
# just to check where your events were, where rocks were etc.?
# Not anymore! Rock-pushing puzzles? Made easy!
# Use each of these commands wherever you want, though they are designed to use
# in a conditional branch event command. An example follows:
# @>Conditional Branch: $game_map.standing_on_tile?(5, 13)
# @> Do stuff, will happen if you ARE standing on the coords 5,13
# Else
# @> Do the rest of stuff, will happen if you ARE NOT standing on 5,13
#------------------------------------------------------------------------------
# * COMMANDS
# $game_map.standing_on_tile?(x, y)
# - checks if player is standing on map coordinates (x, y)
#
# $game_map.standing_on_event?(id)
# - checks if player is standing on event (id)
#
# $game_map.adjacent_tile?(x, y, standing)
# - checks if player is adjacent to tile (x, y).
# - if standing = false, it will check only if you are adjacent
# - if standing = true, it will check if you are adjacent OR standing on tile
#
# $game_map.cross_adjacent_event?(id, n)
# - checks if player is in a cross range of event ID, where n is the radius
# of the cross. To check if player is adjacent to event, use n=1
#
# $game_map.event_adjacent_event?(id, id2, n)
# - checks if event (id) is adjacent to event (id2), where n is the radius
# of the cross. To check if the events are directly adjacent, use n=1.
#
# $game_map.event_standing_coords?(id, x, y)
# - checks if event (id) is standing on map coordinates (x, y).
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :px
attr_accessor :py
#--------------------------------------------------------------------------
# * Alias Definitions
#--------------------------------------------------------------------------
alias hev_rmvx_toolbox_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
hev_rmvx_toolbox_initialize
@px = 0
@py = 0
end
#--------------------------------------------------------------------------
# * Player standing on map coords (x, y)?
#--------------------------------------------------------------------------
def standing_on_tile?(x, y)
if $game_player.x == x and $game_player.y == y
return true
else
return false
end
end
#--------------------------------------------------------------------------
# * Player standing on event (id)?
#--------------------------------------------------------------------------
def standing_on_event?(id)
if $game_player.x == @events[id].x && $game_player.y == @events[id].y
return true
else
return false
end
end
#--------------------------------------------------------------------------
# * Is player adjacent (or standing on) to tile (x, y)?
#--------------------------------------------------------------------------
def adjacent_tile?(x, y, standing)
@px = $game_player.x
@py = $game_player.y
if standing = false
if (@px != x && @py != y) || (@px == x && @py == y)
return false
end
end
if standing = true
if (@px != x && @py != y)
return false
end
end
if @px < x
if (x - @px) <= 1
return true
end
end
if @px > x
if (@px - x) - @px <= 1
return true
end
end
if @py > y
if (@py - y) <= 1
return true
end
end
if @py < y
if (y - @py) <= 1
return true
end
end
end
#--------------------------------------------------------------------------
# * Is player (n) tiles adjacent to event (id) [in a cross pattern]?
#--------------------------------------------------------------------------
def cross_adjacent_event?(id, n)
@px = $game_player.x
@py = $game_player.y
if (@px != @events[id].x && @py != @events[id].y) || (@px == @events[id].x && @py == @events[id].y)
return false
end
if @px < @events[id].x
if (@events[id].x - @px) <= n
return true
end
end
if @px > @events[id].x
if (@px - @events[id].x) - @px <= n
return true
end
end
if @py > @events[id].y
if (@py - @events[id].y) <= n
return true
end
end
if @py < @events[id].y
if (@events[id].y - @py) <= n
return true
end
end
end
#--------------------------------------------------------------------------
# * Is event (id) adjacent to event (id2?)
#--------------------------------------------------------------------------
def event_adjacent_event?(id, id2, n)
if @events[id].x != @events[id2].x && @events[id].y != @events[id2].y
return false
end
if @events[id].x == @events[id2].x && @events[id].y == @events[id2].y
return false
end
if @events[id].x < @events[id2].x
if (@events[id2].x - @events[id].x) <= n
return true
end
end
if @events[id].x > @events[id2].x
if (@events[id].x - @events[id2].x) - @events[id].x <= n
return true
end
end
if @events[id].y > @events[id2].y
if (@events[id].y - @events[id2].y) <= n
return true
end
end
if @events[id].y < @events[id2].y
if (@events[id2].y - @events[id].y) <= n
return true
end
end
end
#--------------------------------------------------------------------------
# * Is event (id) standing on map coords. (x, y)?
#--------------------------------------------------------------------------
def event_standing_coords?(id, x, y)
if @events[id].x == x && @events[id].y == y
return true
else
return false
end
end
end
Notes
Usable everywhere with credit to Hevendor.
Author's Notes
I'll be adding to this script as ideas come. Feel free to suggest your own
Older Versions
N/A