Lycan Sneak Armor
#1
Lycan Sneak Armor
Version: 1.0


Introduction
This script allows you to make armor that can allow the wearer to be 100% undetectable. It keys in to the enemy's See Range and Hear Range systems so armor may allow the actor to be either 'invisible','inaudible' or both.


Script
Code:
#==============================================================================
# ** Lycan Sneak Armor
#------------------------------------------------------------------------------
#    version 1.0
#    by DerVVulfman
#    10-25-2015
#    RGSS / RPGMaker XP
#==============================================================================
#
#  INTRODUCTION:
#
#  This script allows you to make armor  that can allow the wearer to be 100%
#  undetectable.   It keys in to the enemy's See Range and Hear Range systems
#  so armor may allow the actor to be either 'invisible','inaudible' or both.
#
#
#------------------------------------------------------------------------------
#
#  INSTALLATION
#
#  Place this script below  The Lycan ABS  and above Main.   You have three
#  configurables, these being set to the ID of an element in your database.
#  It is these elements which you tag your armors to give these benefits.
#
#
#------------------------------------------------------------------------------
#
#  USAGE:
#  
#  There are three configurables described below.  It is by tagging your
#  armor with these elements you set within your game's database is what
#  applies these conditions:
#
#  * INVISIBLE_ARMOR    Any armor with this tag is 100% invisible to the
#                       enemies on the map, just as long as the actor(s)
#                       are not already first discovered.
#
#  * MOTIONLESS_CAMO    This is an option  that forces  the actor(s)  to
#                       freeze when an enemy is facing. If you move when
#                       a map enemy is facing, the invisibility is lost.
#
#  * INAUDIBLE_ARMOR    Any armor with this tag is 100% inaudible to the
#                       enemies on the map, just as long as the actor(s)
#                       are not already first discovered.
#
#  >> Once spotted, even re-equipping invisible armor does no good until
#     the player leaves the map.   Once he does,  the enemy detection of
#     invisible/inaudible armor is reset.
#
#  >> The 'Motionless Camoflauge' armor option  depends upon  the use of
#     View Range Script v3 Eta,  an edited version  of Near Fantastica's
#     work altered  by DerVVulfman  to allow directed and blocked sight.
#
#==============================================================================
#
#  TERMS AND CONDITIONS:
#
#  Free for use, even in commercial games.
#
#==============================================================================



module Lycan
  
  INVISIBLE_ARMOR = 20    # Armors tagged with this element are invisible
  
  MOTIONLESS_CAMO = 21    # Invisible armors with this tag are seen if moving
  
  INAUDIBLE_ARMOR = 22    # Armors tagged with this element cannot be heard
  
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :armor_types              # weapon fix
end



#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :lsneak_tripped         # Lycan stealth armor tripped
  #--------------------------------------------------------------------------
  # * Setup
  #     map_id : map ID
  #--------------------------------------------------------------------------
  alias lsneak_setup setup
  def setup(map_id)
    lsneak_setup(map_id)
    @lsneak_tripped = false
  end
end



#==============================================================================
# ** Game_ABS
#------------------------------------------------------------------------------
#  This class deals with the Action Battle System and controls all Player,
#  Enemy and Companion Actions on the map.
#==============================================================================

class Game_ABS
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lsneak_update_enemy_see_target_central update_enemy_see_target_central
  alias lsneak_update_enemy_hear_target_central update_enemy_hear_target_central
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - detect enemies in visible range and engage )
  #    enemy     : enemy object
  #    target    : enemy target map object
  #    target_id : enemy target's ID
  #--------------------------------------------------------------------------
  def update_enemy_see_target_central(enemy, target, target_id)
    armor = lsneak_armor(target, 0)
    armor = nil if $game_map.lsneak_tripped == true
    armor = update_enemy_hide_target_moving?(enemy, target, armor)
    return nil  if armor == true
    effective = lsneak_update_enemy_see_target_central(enemy, target, target_id)
    $game_map.lsneak_tripped = true if effective == true
    return effective
  end
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - detect enemies in audible range and engage )
  #    enemy     : enemy object
  #    target    : enemy target map object
  #    target_id : enemy target's ID
  #--------------------------------------------------------------------------
  def update_enemy_hear_target_central(enemy, target, target_id, shout=nil)
    armor = lsneak_armor(target, 2)
    armor = nil if $game_map.lsneak_tripped == true
    return nil  if armor == true
    effective = lsneak_update_enemy_hear_target_central(enemy, target,
                                                        target_id, shout)
    $game_map.lsneak_tripped = true if effective == true
    return effective
  end
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - hide enemies at all times or only moving )
  #    enemy     : enemy object
  #    target    : enemy target map object
  #    armor     : initial armor invisible flag
  #--------------------------------------------------------------------------  
  def update_enemy_hide_target_moving?(enemy, target, armor)
    move_sneak  = lsneak_armor(target, 1)
    return armor  unless move_sneak == true
    if target.moving?
      if $game_system.lycan_view_range
        event = $game_map.events[enemy.event_id]
        test = $view_range.vr_in_range?(event, target, enemy.detection[1], true)
        return !test
      end
    end
    return armor  
  end
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - Check armor for sneak element(s) )
  #    target    : enemy target map object
  #    type      : audible or visible level (0/1)  
  #--------------------------------------------------------------------------
  def lsneak_armor(target, type)
    return nil                    if target.is_a?(Game_ABS_Enemy)
    tempval   = 0                 if target.is_a?(Game_Player)
    tempval   = target.actor_id   if target.is_a?(Game_ABS_Companion)
    tempactor = $game_party.actors[tempval]
    # Branch and return test by Equipment Script
    if $game_system.lycan_dvv_multislots
      return lsneak_armor_mslots_dvv_test?(tempactor, type)
    elsif $game_system.lycan_g7_multislots
      return lsneak_armor_mslots_g7_test?(tempactor, type)
    else
      return lsneak_armor_default_test?(tempactor, type)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - Check armor - default equipment system )
  #    actor     : armor wearing actor being tested
  #    type      : audible or visible level (0/1)  
  #--------------------------------------------------------------------------
  def lsneak_armor_default_test?(actor, type)
    return true   if lsneak_armor_element_test(actor.armor1_id, type) == true
    return true   if lsneak_armor_element_test(actor.armor2_id, type) == true
    return true   if lsneak_armor_element_test(actor.armor3_id, type) == true
    return true   if lsneak_armor_element_test(actor.armor4_id, type) == true
    return false
  end
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - Check armor - DVV MultiSlots )
  #    actor     : armor wearing actor being tested
  #    type      : audible or visible level (0/1)  
  #--------------------------------------------------------------------------
  def lsneak_armor_mslots_dvv_test?(actor, type)
    for i in actor.armor_types
      id = actor.armor_id[i]
      next          if id.nil?
      return true   if lsneak_armor_element_test(id, type) == true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - Check armor - G7 Multi Slot Equipment )
  #    actor     : armor wearing actor being tested
  #    type      : audible or visible level (0/1)  
  #--------------------------------------------------------------------------
  def lsneak_armor_mslots_g7_test?(actor, type)
    for id in actor.armor_ids
      return true if lsneak_armor_element_test(id, type) == true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Frame Update ( for enemy - Check armor - individual armor piece test )
  #    armor_id  : ID of armor piece tested
  #    type      : audible or visible level (0/1)  
  #--------------------------------------------------------------------------
  def lsneak_armor_element_test(armor_id, type)
    test_set = []
    test_set = $data_armors[armor_id].guard_element_set if armor_id != 0
    return true if test_set.include?(Lycan::INVISIBLE_ARMOR) && type == 0
    return true if test_set.include?(Lycan::MOTIONLESS_CAMO) && type == 1
    return true if test_set.include?(Lycan::INAUDIBLE_ARMOR) && type == 2
    return false
  end
end


Instructions
In the script.


Compatibility
Designed solely for the Lycan ABS.


Terms and Conditions
Free for use, even in commercial games.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   The Lycan ABS DerVVulfman 114 173,521 08-11-2023, 02:25 AM
Last Post: DerVVulfman
   Lycan Companion Icons DerVVulfman 0 1,211 08-09-2023, 08:23 PM
Last Post: DerVVulfman
   Lycan ABS / MGC Mode7 Edit Patch DerVVulfman 2 9,512 10-18-2015, 07:12 PM
Last Post: DerVVulfman
   The Lycan ABS Isometric Maps Patch DerVVulfman 1 6,744 06-25-2014, 03:54 AM
Last Post: DerVVulfman
   Lycan Enemy Bars / MGC Mode7 Edit Patch DerVVulfman 0 5,816 06-12-2014, 04:05 AM
Last Post: DerVVulfman
   Lycan Oversized Enemy Targeting DerVVulfman 0 5,032 06-05-2014, 03:42 AM
Last Post: DerVVulfman
   The Lycan ABS Isometric View Patch DerVVulfman 4 10,626 04-23-2014, 04:58 AM
Last Post: DerVVulfman
   Title Skip for Lycan ABS JayRay 3 7,634 04-21-2014, 01:55 PM
Last Post: MetalRenard
   Lycan Attack Fatigue DerVVulfman 0 5,281 03-04-2014, 05:03 AM
Last Post: DerVVulfman
   Meagan's Particles for the Lycan ABS DerVVulfman 0 5,066 06-07-2013, 04:21 AM
Last Post: DerVVulfman



Users browsing this thread: 1 Guest(s)