Stealth Detection System (SDS)

Version: 1.1
Author: Cmpsr2000
Release Date: June 17 2008
Introduction
SDS allows the developer to build games that include "Stealth" features similar to certain Final Fantasy games or even Metal Gear Solid.
Features
- Make any event "aware" of its surroundings, effectively turning it into a "guard"
- Execute 4 different actions on detection:
- Mode 0: Send to Jail (transfer player)
- Mode 1: Game Over
- Mode 2: Common Event
- Mode 3: MGS Mode
- Create a "jail" event anywhere on the map!
- MGS Mode allows guards to be alerted before trying to capture the player
- Guard intercept speed in MGS mode can be customized
- Final capture action in MGS mode can be customized
- Guard search time in MGS mode can be customized
- Guards can have custom sight ranges
- Guards can have tunnel vision or a "cone" field of view
- Tunnel width for tunnel vision can be customized
- Guards' sight is blocked by objects by default, but this can be disabled by granting "truesight"
- Mode 2 can execute any custom event you specify
- Guards have a circle of awareness around themselves that can be disabled if desired
Script
Redefinitions
Game_Stealth
Also, put this sound in your ../Sound/SE folder: Click to view attachment
Customization
How to configure an event:CODE
#-------------------------------------------------------------------------------
#
# SDS is an advanced stealth detection system for use in RPG Maker VX games.
# To use the system, you need to build an event that begins with a script call:
#
# $game_stealth.detector(eventID, detectRange, detectAction,
# tunnelVision, trueSight)
#
# eventID: The ID of the event. Use @event_id as it's the easiest way
# detectRange: How far the "guard" is able to see. Higher numbers require
# more CPU time to proccess! Lag increases exponentially if
# you are NOT using tunnel vision.
# detectAction: The action to perform when the guard detects the player
# DEFAULT = 1
# 0: Goto jail event
# 1: Game Over
# 2: Execute common event
# 3: MGS Mode
# tunnelVision: determines whether the guard's field of view cones out or
# goes in a straight line.
# DEFAULT = false
# trueSight: determines whether the guard can see through obstacles
# DEFAULT = false
#
# NOTE: You do NOT have to set parameters that have a default.
#
# MGS MODE EXPLAINATION:
#
# When using detectAction 3 (MGS Mode) guards will be "alerted" if
# they spot the player. The guard will run to the position they spotted
# the player at, then begin to look around for the player again. If the
# guard sees the player a second time, the captureAction is performed.
#
#-------------------------------------------------------------------------------
Game_Stealth options:
Tunnel width option:CODE
#---------------------------------------------------------------------------
# If you use tunnel vision, set the tunnel width here. It MUST be an ODD
# number or the game will round up to the next odd number! Widths over 3
# are not recomended.
#---------------------------------------------------------------------------
@tunnelWidth = 3
To specify the common event for Mode 2:CODE
#---------------------------------------------------------------------------
# The common event ID to execute when using the common event detect action
#---------------------------------------------------------------------------
@common_event_id = 1
To specify the speed of an intercepting MGS guard:CODE
#---------------------------------------------------------------------------
# The speed and frequency the guards move when they detect the player in
# MGS mode.
# speed: 1: x8 slower,
# 2: x4 slower
# 3: x2 slower
# 4: normal
# 5: x2 faster
# 6: x4 faster
#
# frequency: 1: lowest
# 2: lower
# 3: normal
# 4: higher
# 5: highest
#---------------------------------------------------------------------------
@guardInterceptSpeed = 4
@guardInterceptFrequency = 5
To set the MGS Mode capture action:CODE
#---------------------------------------------------------------------------
# When in MGS mode, the action to be performed if the guard detects the
# player a second time. This is set by default to game_over since all other
# options require some configuration. Valid values are:
# captureAction: 0: Goto jail event
# 1: Game Over
# 2: Execute common event
#---------------------------------------------------------------------------
@captureAction = 1
To set the search time for an alerted guard in MGS mode:CODE
#---------------------------------------------------------------------------
# How many frames a guard will wait before executing each turn when
# searching for the player after detecting them in MGS mode.
#---------------------------------------------------------------------------
@waitTime = 60
To disable "awareness" bubble around guards:CODE
#---------------------------------------------------------------------------
# Change this to false to disable the detection radius around guards.
# This means the player can safely stand next to a guard as long as he's
# not in the guard's line of sight.
#---------------------------------------------------------------------------
@allowDetectRadius= true
Compatibility
Requires RGSS2. Redefines Scene_Title, Scene_Map and Game_Event
Screenshot
Guard field of view explanations:
Normal Cone Vision:
An obstacle in the way hides the area behind the object:
Tunnel Vision with an obstacle:
Tunnel Vision and True Sight:
DEMO
Right Here!
Installation
Copy the script files into your game under the materials section.
Todo List:
- Check pathfinding logic more thouroughly
- Add ability to stop checking FoV when all tiles in a row are blocked
- Add ability for fighting MGS events
- Add option for more realistic FoV obstacles (blocking cones should extend out at the angle of incidence)
- Fix mgs goto bug where guard stops in front of player if the player doesn't move
FAQ
None yet!
Terms and Conditions
Feel free to use this in your game, but please give me a shout in the credits! Also, feel free to edit this for your own personal purposes but please do not repost an edited version without my consent first.
Thanks ^^/




