- Joined
- Jul 2, 2013
- Messages
- 10
- Reaction score
- 0
- First Language
- English
- Primarily Uses
Event Radius Check v1.0
Dolarmak
Introduction
This plugin will allow you to have events detect one another.
Features
Set custom event name detectionSet radius of detectionSet which Self Switch detection activates
How to Use
Set the Self Switch you want to active in the Plugin Manager.Use the Plugin Command : EventRadiusCheck name_of_event_to_check #_of_tiles_awayThis will then check if the event name_of_event_to_check is within the # of tiles you specified.
Script
//=========================================================
// Event Radius Check
// EventRadiusCheck.js
// Version: 1.00
//=========================================================
/*:
* @author Dolarmak
* @plugindesc Checks if an Event2 with a specific name is within a desired radius of the Event1
Sets the Event1's selfswitch to A, B, C or D
*
*
*@param Self Switch
*@desc Set Self Switch of Event if it detects the desired Event.
A, B, C, or D.
*@default A
*
* @help
* =============================================================================
* What does it do?
* =============================================================================
*
* Checks if an Event2 with a specific name is within a desired radius of the
Event1. Sets the Event1's self switch to A, B, C or D. If it fails to detect the
Event2, it turns OFF the self switch.
*
* =============================================================================
* Usage
* =============================================================================
* To check for Event2 with a specific name around the Event1 use the
Plugin Command: EventRadiusCheck name_of_event_to_check #_of_tiles_away
*
* This will then check if the event name_of_event_to_check is with the # of
tiles you specified.
*
* =============================================================================
*/
var parameters = PluginManager.parameters('EventRadiusCheck');
var ev_which_switch = parameters['Self Switch'];
var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args)
{
aliasPluginCommand.call(this, command, args);
if(command == "EventRadiusCheck")
{
var ev_event_x = $gameMap._events[this._eventId]._x;
var ev_event_y = $gameMap._events[this._eventId]._y;
var ev_event_true = false;
var ev_event_name = String(args[0]);
var ev_radius = Number(args[1]);
for(var ev_event_y_check = (ev_event_y - ev_radius); ev_event_y_check < (ev_event_y + ev_radius + 1); ev_event_y_check = (ev_event_y_check + 1))
{
for(var ev_event_x_check = (ev_event_x - ev_radius); ev_event_x_check < (ev_event_x + ev_radius + 1); ev_event_x_check = (ev_event_x_check + 1))
{
if ($gameMap.isXyHasEventName(ev_event_name,ev_event_x_check,ev_event_y_check) == 1)
{
var ev_event_true = true;
}
}
}
//----- End Result ----//
if (ev_event_true == true)
{
//----Event is in Range ----//
$gameSelfSwitches.setValue([this._mapId, this._eventId, String(ev_which_switch)], true);
}
else
{
//----Event is not in Range ----//
$gameSelfSwitches.setValue([this._mapId, this._eventId, String(ev_which_switch)], false);
}
}
}
FAQCredit and Thanks- Dolarmak (Wylie Capp)- Marked Author's Notes
This was build for my own project, but I figured it might be useful for other people.
Terms of Use
Free for use in non-commercial projects with credits.Contact me for commercial use.
Dolarmak
Introduction
This plugin will allow you to have events detect one another.
Features
Set custom event name detectionSet radius of detectionSet which Self Switch detection activates
How to Use
Set the Self Switch you want to active in the Plugin Manager.Use the Plugin Command : EventRadiusCheck name_of_event_to_check #_of_tiles_awayThis will then check if the event name_of_event_to_check is within the # of tiles you specified.
Script
//=========================================================
// Event Radius Check
// EventRadiusCheck.js
// Version: 1.00
//=========================================================
/*:
* @author Dolarmak
* @plugindesc Checks if an Event2 with a specific name is within a desired radius of the Event1
Sets the Event1's selfswitch to A, B, C or D
*
*
*@param Self Switch
*@desc Set Self Switch of Event if it detects the desired Event.
A, B, C, or D.
*@default A
*
* @help
* =============================================================================
* What does it do?
* =============================================================================
*
* Checks if an Event2 with a specific name is within a desired radius of the
Event1. Sets the Event1's self switch to A, B, C or D. If it fails to detect the
Event2, it turns OFF the self switch.
*
* =============================================================================
* Usage
* =============================================================================
* To check for Event2 with a specific name around the Event1 use the
Plugin Command: EventRadiusCheck name_of_event_to_check #_of_tiles_away
*
* This will then check if the event name_of_event_to_check is with the # of
tiles you specified.
*
* =============================================================================
*/
var parameters = PluginManager.parameters('EventRadiusCheck');
var ev_which_switch = parameters['Self Switch'];
var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args)
{
aliasPluginCommand.call(this, command, args);
if(command == "EventRadiusCheck")
{
var ev_event_x = $gameMap._events[this._eventId]._x;
var ev_event_y = $gameMap._events[this._eventId]._y;
var ev_event_true = false;
var ev_event_name = String(args[0]);
var ev_radius = Number(args[1]);
for(var ev_event_y_check = (ev_event_y - ev_radius); ev_event_y_check < (ev_event_y + ev_radius + 1); ev_event_y_check = (ev_event_y_check + 1))
{
for(var ev_event_x_check = (ev_event_x - ev_radius); ev_event_x_check < (ev_event_x + ev_radius + 1); ev_event_x_check = (ev_event_x_check + 1))
{
if ($gameMap.isXyHasEventName(ev_event_name,ev_event_x_check,ev_event_y_check) == 1)
{
var ev_event_true = true;
}
}
}
//----- End Result ----//
if (ev_event_true == true)
{
//----Event is in Range ----//
$gameSelfSwitches.setValue([this._mapId, this._eventId, String(ev_which_switch)], true);
}
else
{
//----Event is not in Range ----//
$gameSelfSwitches.setValue([this._mapId, this._eventId, String(ev_which_switch)], false);
}
}
}
FAQCredit and Thanks- Dolarmak (Wylie Capp)- Marked Author's Notes
This was build for my own project, but I figured it might be useful for other people.
Terms of Use
Free for use in non-commercial projects with credits.Contact me for commercial use.
Last edited by a moderator: