Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Heretic86

XP Script - Heretic's Idiot Ruby / RGSS Questions...

Question

Am I getting annoying yet?

 

Okay, trying to create a new def that updates itself. Mostly for debug purposes, displaying variable values in a Sprite on the screen so I can watch them realtime. I got the graphics working so dont need to mess with that, just need to know how to run a continual update without hitting Stack Level Too Deep. It appears that an update cant self reference.

 

What is the best way to create a new anything that can self update?

 

(edit: Changed thread title to be more accurate)

Edited by Heretic86

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0

You forgot the "name" after "return data[@map_id]".

 

return data[@map_id].name

 

If you plan to use the name of maps more than once, it is good to store the variable, that eliminates the constant I/O access.

 

 

class Game_Map

 @@map_info = load_data("Data/MapInfos.rxdata")

 def name(id = @map_id)
   return @@map_info[id].name
 end
end

 

This method also lets you get the names of maps other than the current one. If no argument is supplied, it returns the current map name, but you can call it with a map ID to get the respective name.

 

string = $game_map.name       # The current map name
string = $game_map.name(4)  # The name of the map with ID of 4

Share this post


Link to post
Share on other sites
  • 0

You forgot the "name" after "return data[@map_id]".

You're absolutely right. This is a recurring mistake, I did it again while writing a script a few minutes after posting.shifty.gif

Share this post


Link to post
Share on other sites
  • 0

Lol, I always do the first time with MapInfos too for some reason, then have to go back and fix it after I get the error.

Share this post


Link to post
Share on other sites
  • 0

Well, if you guys are interested in seeing what you've been helping me with IN ACTION, I put a Demo of just about all those things up on the RGSS1 Scripts...

 

http://www.rmxpunlimited.net/forums/topic/8441-rmxp-heretics-caterpillar-extensive-features-and-add-ons/

 

@ForeverZer0 - The Demo includes your Pathfinding Script, and I believe I have acreddited you appropriately. If I havent, say so and I'll fix it to your liking, or remove it entirely, is that alright?

Share this post


Link to post
Share on other sites
  • 0

Its no problem.

I post the scripts up for the purpose of others to use. A simple name in the end credits of a game is sufficient for me.

Share this post


Link to post
Share on other sites
  • 0

Is there a way that I can "detect" if a Sound Effect is currently playing? More specifically, "actor_collapse" I believe is the SE I am trying to detect...

 

Also, is there any way to "lock" the Player from moving? Dont really care how, but looking for a One Liner. I tried the @lock, but it doesnt like me, kind of like girls...

 

Trying to write a "Die on Map from Slip Damage" script. Plz dont write it for me, but what Im hoping to understand is how to do this by just displaying a Window during the map (this part is working) that says "Your Party is Dead". Not sure if I should do it as a New Scene, or just a new window. What I am hoping to do is to allow the "Actor Collapse" sound (which already happens, part of default scripts) to finish playing, display a window "Your Party has died of Diptheria" or something, then when the player presses C button (input.trigger?(Input::C) (this works fine)) @party_dead_window.dispose, pause briefly, then display the Game Over scene using game_over.new (which also works).

 

So not sure how to "Lock" just the Player from moving around or turning, (allows other events to move around), wait for the Sound Effect assigned to the "Actor Collapse" sound to finish playing, display "youre all dead" window, wait for input, on input, get rid of window, pause for half a second or so while the window goes away, then display the Game_Over scene.new.

 

Any suggestions?

Edited by Heretic86

Share this post


Link to post
Share on other sites
  • 0

Actor Lock:

 

class Game_Player
 alias lock_player_upd update
 def update
   if SOME_CONDITION_I_MAKE && !@move_route_forcing
     return
   end
   lock_player_upd
 end
end

 

This could possibly cause problems with map scrolling, etc, but it can easily be refined if you need the map to scroll or anything.

 

Detect collapse sound:

 

class Game_System
 alias detect_collapse_se_play se_play
 def se_play(se)
   if se.name == 'FILENAME OF COLLAPSE SE'
     # DO SOME STUFF
   end
   detect_collapse_se_play(se)
   # Maybe have an else condition here, not sure exactly how you need it
 end
end

Share this post


Link to post
Share on other sites
  • 0

Edit: Locking the Player doesnt work at all apparently. Checked the property of @lock, it does come back as true once I added the attr_reader for it, so it sets, but apparently @lock is used for something else I guess.

 

So do you think it would be better to do as a Scene or as a Window? Just got back in so havent taken a crack at it yet, just wondering if it still shows the map and any events moving around, should I do it as a Window, or does focusing on the window prevent the player from moving around at all?

Edited by Heretic86

Share this post


Link to post
Share on other sites
  • 0

Please disregard the above questions, I've figured those ones out.

 

Next idiot question.

 

I created a new property for class Game_Character called @move_route_wait_exclude (bool: true or false) and set an attr_accessor :move_route_wait_exclude # notes, and am trying to access that property in "class Game_Event < Game_Character".

 

Why cant I access that property I set in class Game_Character in class Game_Event < Game_Character? Doesnt this mean that Game_Event is inheriting properties from Game_Character? Im totally stuck on this one. I saw that Game_Event < Game_Character is calling to super() during intialize, and Im trying to check for that property after that has been called, which I thought super() made the methods and properties of the super class available to the sub class?

Edited by Heretic86

Share this post


Link to post
Share on other sites
  • 0

Why cant I access that property I set in class Game_Character in class Game_Event < Game_Character? Doesnt this mean that Game_Event is inheriting properties from Game_Character? Im totally stuck on this one. I saw that Game_Event < Game_Character is calling to super() during intialize, and Im trying to check for that property after that has been called, which I thought super() made the methods and properties of the super class available to the sub class?

That's right, there's something you must be doing wrong.

Share this post


Link to post
Share on other sites
  • 0

I hope that's sarcasm, cuz now I feel that much just dumber...

 

If it isnt, I really hope I haven't offended you somehow, if I have offended you, feel free to call me out on it...

Share this post


Link to post
Share on other sites
  • 0

I hope that's sarcasm, cuz now I feel that much just dumber...

 

If it isnt, I really hope I haven't offended you somehow, if I have offended you, feel free to call me out on it...

No, nothing like that. I'm just stating facts. As you describe things, your Game_Event class should indeed inherit Game_Character's properties, so I have no idea why it doesn't work on your side. The "you must be doing something wrong" part was sort of a prompt for more info, since one can't help you unless you say some more. How are you even trying to access this new property you've given Game_Character? You say it doesn't work, but what does that mean precisely? Getting any errors? Unexpected behavior? Be specific when asking for help, just saying "I tried that and it didn't work" can only be answered by "too bad for you, try something else".

Share this post


Link to post
Share on other sites
  • 0

Ah, ok. Was having trouble with forums not loading the reply box last night. Anywho, source:

 

 

#==============================================================================
#
#	  HERETIC's CATERPILLAR SCRIPT
#	  V1.93
#	  March 17th, 2012
#
#  CORE code came from Zeriab, ver 1.0, but this is so heavily modified
#  I have no choice but to call it my own, excluding Zeriab's code of course
#  which I used as a Base.  I dont think Zeriab supports
#  his original Caterpillar Script any more.
#
#  Heretic's notes
#
#  SIDE NOTE:  Since I have added several Naming Options, you should know that
#  you can combine these options in the names.
#  For Example:  "EV003\z_flat\move_route_wait_exclude" will do both
#
#  Please let me know of any bugs on [url="http://www.rmxpunlimited.net"]http://www.rmxpunlimited.net[/url]
#
#  Version 1.93a - added new Event Move Script Commands:
#			    -  "move_route_wait_exclude"
#			    -  "move_route_wait_include"
#
#			    - Game wont factor in for an event with a Wait Duration
#			    -  which was set during a Set Move Route
#			    -  it just skips over that event to allow it to work on its move route
#			    - This allows an Event to behave a bit more like VX's "Wait for Completion"
#			    -  where Wait doesnt "Wait for ALL Events to complete moving",
#			    -  it only Waits for Events to complete WITHOUT this flag.
#
#			    - NOTE:  Default is to Include EVERYTHING for the Wait For Move's Completion Button Command
#
#			    - Once Excluded, it stays excluded until changed back with the "..include" command
#			    -  and is Reset if the map is relaoded, hence the following 2nd way to do this
#
#			    - Note:  Added 2nd way to do this by Naming an event "anything\move_route_wait_exclude"
#			    -  and there was no real point for adding something to Include by name since they are all
#			    -  included by default anyway
#
#  Version 1.93  - Added the ability to make Actors fade into Ghosts if they are Dead!
#			    - Added New Constants to provide Options for however you want to set up your game
#			    - Added new bugs that I will have to find and fix
#			    - Added Manual Commands to replace old ones
#			    - "force_dead_to_normal" now resets both Ghost Actors and Non Walking Actors
#			    -  it basically calls the force_walk and force_ghost_to_opaque (New) commands
#			    -  in one line instead of requiring each individual action to be called
#			    - Added fade_event_reset([optional] duration) to reset an event to its initial Opacity
#
#  Version 1.92  - Added several New Commands turn_toward / away and move_toward / away
#			    - These Commands work just like Turn Toward / Away from Player
#			    - turn_toward_event(event_id)
#			    - turn_away_from_event(event_id)
#			    - move_toward_event(event_id)
#			    - move_away_from_event(event_id)
#			    - turn_cat_toward_event(event_id, [optional]repeat= true / false) # Omit Optional for false
#			    - turn_cat_away_from_event(event_id, [optional]repeat= true / false) # Omit Optional for false
#  Version 1.92a - Fixed a bug in the new feature.  I forgot to change the Player Variables to Event Variables.
#
#  Version 1.91a - Fixed a minor error in Error Reporting not reporting Duplicates correctly
#			    - Tweaked some events with comments for better explanation of what is happening
#  Version 1.91b - I forgot to include the Font Directory for MMW Fonts.  Fixed.  No script changes
#
# Zeriab
# 1.0
# 2008-08-16
#------------------------------------------------------------------------------
# This script creates a caterpillar of the party members by using events.
#------------------------------------------------------------------------------
# Paste this script just above main.
#
# Put \cat_actor[3] in the name of an event and it will be considered the event
# for the actor with id 3. The name could for example be "Cyrus\cat_actor[3]"
#
# The switch number specified with CATERPILLAR_ACTIVE_SWITCH (default is 23) is
# used to determine whether the events should be positioned in the caterpillar
# or not. Then the switch is off they are just like any other event.
#
# Heretic V1.90
#
# This script also includes Flat Sprite Fix, Fade Events, and Interpreter Bugfix
#
# New Caterpillar Options:
#
#  - Dead Actors Dont Walk
#  - Pass Solid Actors  (Feature originally concepted by Modern Algebra at RMRK.net
#  - Auto Orient To Player
#  - Developer Error Reporting
# 
# New Caterpillar Functions (Run these from a Script Window)
#
#  - delete_last_move			    # Erases the very last step a player takes
#  - move_pop					    # Erases a move from the end of the move list
#  - force_walk					  # Forces ALL Cat Actors to have Walk Animations
#  - cat_to_player				   # Causes ALL Cat Actors to Walk to the Player's Position
#  - orient_to_player			    # Orients ALL Cat Actors to the Player's Direction
#
#   ---  NEW IN VERSION 1.92 ----
#
#  This Orients Cat Actors to face an Event's Direction
#  - turn_cat_to_event(event_id,repeat=false)
#
#  ThisOrients Cat Actors to face away from an Event's Direction
#  - turn_cat_away_from_event(event_id,repeat=false)
#
#  NOTE: Optional Repeat Parameter is useful for not continuously
#    eventing the movements so it only has to be called once
#  ADDITIONAL NOTE:
#    If Optional Repeat Parameter is used - CAT ACTORS WONT MOVE UNTIL RESET
#    * See command below
#   
#  - clear_cat_force_move_routes	 # Use if your Cat Actors are "stuck" because
#									  of a repeating a Move Command (Beta, might be a little buggy)
#  - turn_toward_event(event_id)	 # Works just like Turn Toward Player, needs (event_id) as an Argument
#  - turn_away_from_event(event_id)  # Same thing.  Pick an Event to Turn Away From.
#									   - Useful when used for Player's Move Route
#  - move_toward_event(event_id)	 # Works the same as Move Toward and Away From Player
#  - move_away_from_event(event_id)  # Now Events can move Toward or Away from each other
#
#
#  NOTE:  (event_id) is the Number that appears above Name in Event Editor, just omit the preceeding Zero's
#		  * If event_id is set to 0, the Player is targetted.  0 is included because you may want to turn
#			  the Caterpillar to watch the Player's Movements
#
# New Properties
#
#  - \off_map		   # Allows Events to go Off Map (not Off Screen) with Through Enabled
#					   #   -  Name an event "foo\off_map" and set Through
#					   #   -   to ON to allow them to go Off Map
#					   #   -  THROUGH MUST BE ENABLED TO GO OFF MAP!!!
#
#  - $walk_off_map	  # True or False - Allows PLAYER and Active Cat Actors OFF MAP
#					   #   -  Could be a switch, but Im lazy
#					   #   -  Use by setting it in a Script
#					   #   -  $walk_off_map = true  OR $walk_off_map = false
#					   #   -  THROUGH DOES NOT NEED TO BE ENABLED FOR PLAYER TO GO OFF MAP
#
# New Z-Index Features
#
#  def scren_z was Rewritten to fix numerous bugs and include new options
#
#  - Cat Actors stack so they are on top of Events not flagged as "ALWAYS ON TOP"
#  - Cat Actors Stack Correctly.  IE Player 1 has the highest Z-Index
#	 then Actor 2, Actor 3, and Actor 4
#    This means when all the Party Members are Stacked up, Player 1 is on top
#    followed by each sequential actor
#
#
#  Z-INDEX CONTROLS - Use Event Names or Run Scripts
#
#  (Thank You kellessdee!  This would not have been possible without
#   your help!)
#
#  - \z_flat [integer (optional)]
#  # Causes Events to render as Flat instead of "Standing Up"
#    -  Name an Event "foo\z_flat" to render "Flat On Ground"
#    -  Optional - Name an Event "foo\z_flat[32]" and Change the Number
#		 for more specific control over the Event's Z-Index
# 
#
#  - \z_add[integer]
#  # Allows for things like Shadows in Doorways
#    -  Name an Event "bar\z_add[32]" and Change the Number
#    -  It is pretty much the same as \z_flat but Auto Adds 32 to the Events Z-Index
#
#  ---  EVENT FADING ---
#
#  Now Events can Fade In and Out!
#
#  - Pretty easy.  Run a Script from the Event Editor Window
#  - Just put in "fade_event(opacity, duration)"
#  - Opacity is a Range from 0 to 255
#  - Duration is How Many Frames to take to get to that Opacity
#  - Example: fade_event(128,20) will fade to Half Opaque in One Second
#  - fade_event(0,40) will make an Event go Invisible in Two Seconds
#  - fade_event(255,10) will make an Event appear Solid in Half a Second
#  - RMXP Uses 20 Frames Per Second.
#
#  Additional Features:
#
#  Because there are TWO places you can enter Scripts, I tried to set up
#   a couple of Error Messages (optional) in case you call a Script
#   from the wrong window.  I also shortened up the names of Script Commands
#   so you dont have to put $game_thing.foo_bar.script, all you have to do
#   is just run "<script_name>" from the Script window.  Excluding
#   the extra characters there...
#
#==============================================================================
class Game_Caterpillar

 # You can change the Numbers to match what ever Game Switch you want...

 CATERPILLAR_PAUSE_SWITCH = 22	 # Use for Cutscenes and Interacting with Cat Actors
 CATERPILLAR_ACTIVE_SWITCH = 23    # Caterpillar is ON or OFF
 DEAD_ACTOR_EFFECTS = 24		   # Self Explanitory, only works with Caterpillar ON
 PASS_SOLID_ACTORS = true		  # Player can walk thru Cat Actor Events regardless of Through or not
 AUTO_ORIENT_TO_PLAYER = true	  # Changes Cat Actors to match Player Direction when sent to a New Map
 REMOVE_VISIBLE_ACTORS = false	 # Erases Events that are Removed from the Party
 # Array - Pick Any and separate with a Comma, 'GHOST','DONT_WALK','COFFIN'
 #  NOTE:  Coffin Graphic not implemented yet.  Expect in 1.94
 DEAD_EFFECT = ['GHOST','DONT_WALK']
 DEAD_GHOST_OPACITY = 140		  # Opacity of Ghost Characters
 DEAD_GHOST_DURATION = 30		  # Number of Frames to Transition to Ghost
 DISPLAY_DEVELOPER_ERRORS = true   # Shows Error Messages without Crashing (Doesnt appear in Release Games)

 # MAX_ACTORS Removed due to Incompatability with PASS_SOLID_ACTORS
 # @move_list was used to determine Moving Event Passability
 # Option was replaced by $game_party.actors.size - 1 for the current size
 # of the Caterpillar is the number of Active Party Members
 # Thus, this option is no longer needed, allows for UNLIMITED Cat Actors
 # (well, within reason, above 15, expect a ton of problems)
 #
 # MAX_ACTORS = 4				 

 #----------------------------------------------------------------------------
 # * Initialize the caterpillar
 #----------------------------------------------------------------------------
 def initialize
   @actors = []
   @actor_id_to_event = {}
   @move_list = []
 end

 #----------------------------------------------------------------------------
 # * Clear the caterpillar data
 #----------------------------------------------------------------------------
 def clear
   @actors.clear
   @actor_id_to_event.clear
   @move_list.clear
 end

 #----------------------------------------------------------------------------
 # * Clear the Move data, Leave the Actors
 #----------------------------------------------------------------------------
 def clear_moves
   @move_list.clear
 end

 #----------------------------------------------------------------------------
 #				    *** BEGIN MANUAL COMMANDS ***
 #----------------------------------------------------------------------------

 #----------------------------------------------------------------------------
 # * Deletes Players Last Recorded Movement for Caterpillar
 # ---------------------------------------------------------------------------

 # Call this command Manually - "delete_last_move"
 #
 #   - Useful for Backstepping All Actors
 #	  without making Caterpillar look "Unnatural"
 #	  ** See DEMO for Example - Demo still Under Construction

 def del_last_move
   @move_list.delete_at(0)
 end

 #----------------------------------------------------------------------------
 # * Remove the Last Move Event off of @move_list Array
 #----------------------------------------------------------------------------

 # Call this command Manually - "move_pop" in a Script
 #   - Useful when Player can swap Actors by talking to them - Prevents NPC Stacking
 def move_pop
   @move_list.pop
 end

 #----------------------------------------------------------------------------
 # * Use this to Reset a Single Cat Actor's Forced Move Route
 #----------------------------------------------------------------------------
 def clear_actor_force_move_route(actor)
   # Save original move route
   if actor.original_move_route == nil
  actor.original_move_route = actor.move_route
  actor.original_move_route_index = actor.move_route_index
   end		
   # Clears this Actors Move List
   actor.move_list.clear
   # Clears this Actor from Move Route Forcing
   actor.move_route_forcing = false
   # Reset Actors Move Index to 0
   actor.move_route_index = 0
 end


 #----------------------------------------------------------------------------
 # * Use This if your Cat Actors are stuck because of a Repeating Move Route
 #----------------------------------------------------------------------------
 # Call this command Manually - "clear_cat_force_move_routes" in a Script
 #   - Useful if your Caterpillar is set to Repeat a Move, like Turn Toward or Away From

 def clear_cat_force_move_routes
   for actor in @actors
  # Save original move route
  if actor.original_move_route == nil
    actor.original_move_route = actor.move_route
    actor.original_move_route_index = actor.move_route_index
  end	 

  # Clear the Move List	 
  actor.move_list.clear
  # Turn Off move_route_forcing
  actor.move_route_forcing = false
  # Reset the Index to 0
  actor.move_route_index = 0
   end
 end

 # There are MORE Manual Commands, such as "force_walk", see below

 #----------------------------------------------------------------------------
 #				    *** END MANUAL COMMANDS ***
 #----------------------------------------------------------------------------

 #----------------------------------------------------------------------------
 # * Checks of Target Location is occupied by a Caterpillar Actor
 #----------------------------------------------------------------------------

 # Used for Checking Passability of Moving Events into Caterpillar
 def in_move_list?(x, y, d)
   # Get new coordinates
   new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
   new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)

   # if Coordinates Event is trying to move to are ANYWHERE in the Move List
   for i in [email="0...@move_list.size"]0...@move_list.size[/email]
  move_command = @move_list[i].to_a
  # If the Target Coordinates are included in move_list
  if move_command[1].to_a.include? [new_x, new_y]
    return true
  end
   end
   # Return false since it is not found in the @move_list
   return false
 end

 #----------------------------------------------------------------------------
 # * Displays Error Messages to Developers for Missing Events
 #----------------------------------------------------------------------------

 def check_missing
   # Go through each actor that's possible present in the caterpillar
   #   1 is used instead of 0 to exclude the First Character
   #   First Character is handled by Game_Player, not Caterpillar
   #
   # I did it this way because I felt Game Makers care more about the Active Party
   #  rather than Every Chacracter in their Game.
   for i in 1...$game_party.actors.size
  # Set Event to its corresponding Actor, regardless of Event ID
  event = @actor_id_to_event[$game_party.actors[i].id]
  # If Event for that Cat Actor Exists
  if not event.nil?
    # If we have set ALL the Cat Actors correctly, then quit iterating (faster)
    if $check_missing_array.include? $game_party.actors[i].id and $check_missing_array.size == ($game_party.actors.size - 1)
	  $check_missing_needs_to_run = false
    else
	  # If we havent added that Character to the Array yet
	  if not $check_missing_array.include? $game_party.actors[i].id
	    # Add Actor so we can exclude them from Error Reporting
	    $check_missing_array.push($game_party.actors[i].id)
	  end
    end	 
  else
    # Messages for Game Development, Hidden During actual play
    # If playing from the Editor, not Game and DEVELOPER ERRORS are On
    if $DEBUG == true and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true and $missing_error_displayed != true
	  # Provide useful information to the person working on the Map

	  # Fixed to not require SDK
	  print "WARNING: Missing a Cat Actor Event for Character: ", $game_party.actors[i].name, " on\n",
		    "Map Name: ", $game_map.name, "  Map ID: ", $game_map.map_id
	  print "WARNING: To fix this, just create an event and name it \"Char_Name\\cat_actor[",$game_party.actors[i].id, "]\" on\n this Map.  Need Actor Events on EVERY MAP that Character can go."
	  $missing_error_displayed = true
    end
    # Resets Flags as if this completed without errors, expect buggy walking
    $check_missing_needs_to_run = false
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Resets on New Maps to Display Errors again
 #----------------------------------------------------------------------------

 def check_missing_reset
   # Reset the Array of Known Actors so they can be Re-Added on a Per Map Basis
   $check_missing_array.clear
   # Causes Check Missing to actually Run - Speeds up gameplay by not checking at all times
   $check_missing_needs_to_run = true
   # This prevents errors from being displayed multiple times on the same map
   $missing_error_displayed = false
 end

 #----------------------------------------------------------------------------
 #				    *** BEGIN DEAD WALK ANIMATION ***
 #----------------------------------------------------------------------------
 #----------------------------------------------------------------------------
 # * Resets the Actors Walk Flag to their original Event Flags, Player to True
 #----------------------------------------------------------------------------

 # Only changes ONCE so you can still use events to set Chars to Non Walking
 #   - Is called when Caterpillar Pause is turned ON, done once
 #   - Useful for Cutscenes where Characters MIGHT be Dead
 #   - If Events Original Walk Animation is set to False, that Actor Stops Walking

 def walk_reset
   # Sets Player Walk to True
   $game_player.walk_anime = true
   # Says we are open for checking again
   $walk_has_been_reset = true
   # Says we need to check for any Dead State to Animation Changes
   $walk_has_been_set = false

   for event in @actors
  # Resets each Event to Original Walk Animation Flags
  event.walk_anime = event.last_walk_anime
   end
 end

 #----------------------------------------------------------------------------
 # * Sets all actors to Walk Animation, regardless of Sprite or Dead
 #---------------------------------------------------------------------------- 
 # Call this command Manually - "force_walk"
 #
 #   - This Resets if the Caterpillar is Changed, moved to New Map,
 #	  Refreshed, or Teleported

 def force_walk
   # Sets the Player to have a Walk Animation
   $game_player.walk_anime = true

   # Loop thru @actors
   for event in @actors
  # Set that Event Walk Animation to True regardless of Original Event State
  event.walk_anime = true
   end
 end
 #----------------------------------------------------------------------------
 # * Resets the Actors Opacity to their original Event Flags, Player to Opaque 255
 #----------------------------------------------------------------------------

 # Only changes ONCE so you can still use events to set Chars to Non Walking
 #   - Is called when Caterpillar Pause is turned ON, done once
 #   - Useful for Cutscenes where Characters MIGHT be Dead
 #   - If Events Original Walk Animation is set to False, that Actor Stops Walking

 def ghost_reset
   # Reset the Opacity Ghost Flag
   $game_player.opacity_ghost = false   
   # Sets Player Opacity
   $game_player.fade_event_reset(DEAD_GHOST_DURATION)
   # Says we are open for checking again
   $walk_has_been_reset = true
   # Says we need to check for any Dead State to Animation Changes
   $walk_has_been_set = false

   for event in @actors
  # Set Flag that Actor is no longer a Ghost
  event.opacity_ghost = false
  # Resets each Event to Original Walk Animation Flags
  event.fade_event_reset(DEAD_GHOST_DURATION)
   end
 end

 #----------------------------------------------------------------------------
 # * Sets all actors to Fully Opaque, regardless of Sprite or Dead
 #---------------------------------------------------------------------------- 
 # Call this command Manually - "force_ghost_to_opaque"
 #
 #   - This Resets if the Caterpillar is Changed, moved to New Map,
 #	  Refreshed, or Teleported

 def force_ghost_to_opaque
   # Reset the Opacity Ghost Flag
   $game_player.opacity_ghost = false
   # Sets the Player to Opaque 255
   $game_player.fade_event(255, Game_Caterpillar::DEAD_GHOST_DURATION)

   # Loop thru @actors
   for event in @actors
  # Set Flag that Actor is no longer a Ghost
  event.opacity_ghost = false	 
  # Set that Event Walk Animation to True regardless of Original Event State
  event.fade_event(255, Game_Caterpillar::DEAD_GHOST_DURATION)
   end
 end

 def force_dead_to_normal
   # Forces Cat Actors and Player to have a Walk Animation regardless if Dead or Not
   force_walk
   # Forces Cat Actors and Player to be Opaque (Opacity 255) regardless if Dead or Not
   force_ghost_to_opaque
   # Forces Cat Actors and Player to Original Character Graphic #NOT COMPLETE
   #force_original_graphic
 end

 #----------------------------------------------------------------------------
 # * Sets the Walk Animation for Player and Cat Actors based on actor.dead?
 #----------------------------------------------------------------------------

 # The overly complex code here is done to speed things up.  Game tries to check
 # the Animation Each and Every Step, the extra code changes that so it is only
 # when the Player takes a Step that all the code is run, thus, speeding things up

 def dead_walk_animation
   # If the right switches are ON and OFF
   if $game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH] and
   $game_switches[Game_Caterpillar::DEAD_ACTOR_EFFECTS] #and
   #!$game_switches[Game_Caterpillar::CATERPILLAR_PAUSE_SWITCH]

  # Go through each actor that's possible present in the caterpillar
  #   1 is used instead of 0 to exclude the First Character
  #   First Character is handled by Game_Player, not Caterpillar
  for i in 1...$game_party.actors.size
    # Set Event to its corresponding Actor, regardless of Event ID
    event = @actor_id_to_event[$game_party.actors[i].id]
    # If Event for that Cat Actor Exists
    if not event.nil?
	  if Game_Caterpillar::DEAD_EFFECT.include? 'DONT_WALK'
	    # Set Walk Animation to True if Alive and False if Dead
	    event.walk_anime = $game_party.actors[i].dead? ? false : true
	  end

	  if Game_Caterpillar::DEAD_EFFECT.include? 'GHOST'
	    if event.opacity != Game_Caterpillar::DEAD_GHOST_OPACITY and
		  event.opacity_duration == 0 and
		  event.opacity_ghost == false and
		  $game_party.actors[i].dead?
		    # Fade Out the Cat Actor and Set Opacity Ghost Flag
		    event.opacity_ghost = true
		    event.fade_event(Game_Caterpillar::DEAD_GHOST_OPACITY,Game_Caterpillar::DEAD_GHOST_DURATION)
	    end
	  end

	  # If we have set ALL the Cat Actors correctly, then set flags to quit iterating (faster) until next player step
	  if $walk_reset_array.include? $game_party.actors[i].id and $walk_reset_array.size == ($game_party.actors.size - 1)
	    # DONT WALK for Player
	    if Game_Caterpillar::DEAD_EFFECT.include? 'DONT_WALK'
		  # Sets the Main Player Walk Animation
		  $game_player.walk_anime = $game_party.actors[0].dead? ? false : true
	    end
	    # Ghost for Player
	    if Game_Caterpillar::DEAD_EFFECT.include? 'GHOST'
		  if event.opacity != Game_Caterpillar::DEAD_GHOST_OPACITY and
		    event.opacity_duration == 0
		    if $game_party.actors[0].dead?
			  $game_player.opacity_ghost = true			   
			  $game_player.fade_event(Game_Caterpillar::DEAD_GHOST_OPACITY,Game_Caterpillar::DEAD_GHOST_DURATION)
		    else
			  $game_player.opacity_ghost = false
		    end
		  end
	    end

	    # Allows for resetting Actor Events back to original Walking State - but not actually Reset here
	    $walk_has_been_reset = false
	    # This prevents from continuing to iterate thru the array as it is done with screen update (faster), not per step
	    $walk_has_been_set = true
	  else
	    # If we havent added that Character to the Array yet
	    if not $walk_reset_array.include? $game_party.actors[i].id
		  # Add that Character to the Array
		  $walk_reset_array.push($game_party.actors[i].id)
	    end
	  end 
    # Else occurs when an Actor Event doesnt exist, this causes the feature to temproarily be disabled, but wont lag performance
    else
	  # Resets Flags as if this completed without errors
	  # Expect Walk Animations to not be in Sync with Actors Dead State...
	  $walk_has_been_reset = false
	  $walk_has_been_set = true
    end
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Orients Cat Actors to Player's Direction
 #----------------------------------------------------------------------------
 # Used when transported to a different Map or Location, or called manually

 def orient_to_player
   # For each Event in Actors, which holds ALL Caterpillar Actor Events
   for event in @actors
  # If that Event's Character is in the Party
  if cat_actor_in_party?(event)
    # Determine if we need to use the Player's Temp Direction instead of Direction
    if $game_temp.player_new_direction != 0 and ($game_temp.transition_processing == true or $use_player_temp_direction == true)
	  # If the Event doesn't have a Direction Fix Flag
	  unless event.direction_fix
	    # Set Direction to match the Player's TEMP Direction -  On Teleport
	    event.direction = $game_temp.player_new_direction
	  end
    else
	  # If the Event doesn't have a Direction Fix Flag
	  unless event.direction_fix
	    # Set Direction to match the Player's Direction
	    event.direction = $game_player.direction
	  end
    end
  end
   end
   # If the Player has been Transferred and Not Fade
   $use_player_temp_direction = false
 end

 #----------------------------------------------------------------------------
 # * Turn Cat Toward Event (Event ID of Target)
 #----------------------------------------------------------------------------

 # Turns all the Cat Actors to face an Event - Useful during cutscenes
 #  - Optional 2nd Command will allow the Cat Actors to Repeat
 #  - If Event_ID is 0 - Player will be used
 #
 # NOTE: Cat Actors are Passable here, so dont forget to Pause the Caterpillar!
 #  if the Player is allowed to move around during the Scene
 def turn_cat_toward_event(event_target_id, repeat = false)
   # For each Event in Actors, which holds ALL Caterpillar Actor Events
   for event in @actors
  # If that Event's Character is in the Party
  if cat_actor_in_party?(event)
    # Turn that Cat Actor (or Event) Toward the Target Event
    event.turn_toward_event(event_target_id)
    # If the Option to Repeat the Movement, make it a Move Route and Repeat it
    if repeat == true
	  # Make a New RPG::MoveRoute 
	  new_route = RPG::MoveRoute.new
	  # Required Parameters
	  new_route.repeat = true
	  new_route.skippable = true
	  # Create teh Command Parameter
	  parameter = "turn_toward_event(" + event_target_id.to_s + ")"
	  # Create a new RPG::MoveCommand, 45 indicates a Script will be run, [parameter] is the Script that WILL be run
	  # NOTE TO SELF: Parameter is part of an Array, use [parameter]
	  command = RPG::MoveCommand.new(45, [parameter])

	  # Put the Recorded Movement as the First Element of the Move Command
	  event.move_route.list.clear
	  new_route.list.unshift(command)
	  event.force_move_route(new_route)
    end
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Turn Cat Toward Event (Event ID of Target)
 #----------------------------------------------------------------------------

 # Turns all the Cat Actors Away From an Event - Useful during cutscenes
 #  - Optional 2nd Command will allow the Cat Actors to Repeat
 #  - If Event_ID is 0 - Player will be used
 #
 # NOTE: Cat Actors are Passable here, so dont forget to Pause the Caterpillar!
 #  if the Player is allowed to move around during the Scene
 def turn_cat_away_from_event(event_target_id, repeat = false)
   # For each Event in Actors, which holds ALL Caterpillar Actor Events
   for event in @actors
  # If that Event's Character is in the Party
  if cat_actor_in_party?(event)
    # Turn that Cat Actor (or Event) Toward the Target Event
    event.turn_away_from_event(event_target_id)
    if repeat == true
	  # Make a New RPG::MoveRoute 
	  new_route = RPG::MoveRoute.new
	  # Required Parameters
	  new_route.repeat = true
	  new_route.skippable = true
	  # Create teh Command Parameter
	  parameter = "turn_away_from_event(" + event_target_id.to_s + ")"
	  # Create a new RPG::MoveCommand, 45 indicates a Script will be run, [parameter] is the Script that WILL be run
	  command = RPG::MoveCommand.new(45, [parameter])

	  # Put the Recorded Movement as the First Element of the Move Command
	  event.move_route.list.clear
	  new_route.list.unshift(command)
	  event.force_move_route(new_route)
    end
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Determines whether or not an Event is in the Active Party
 #----------------------------------------------------------------------------

 def cat_actor_in_party?(event)
   # If that Event corresponding Actor is in the Game Party
   return @actors.include? (event)
 end

 #----------------------------------------------------------------------------
 # * Determines whether an Event is flagged as a Cat Actor, not Party Depeandant
 #----------------------------------------------------------------------------
 def is_cat_actor?(event)
   # If Event has a @caterpillar_actor property (Only Cat Actors get this...)
   return true if not event.caterpillar_actor.nil?
 end

 #----------------------------------------------------------------------------
 # * Determines whether or not the Corresponding Character for a Cat Actor is Dead
 #----------------------------------------------------------------------------

 def is_cat_actor_dead?(event)
   unless event.is_a?(Game_Player)
  # Party Leader is Actor 0 who is a Game_Player, not Event
  return true if $game_party.actors[0].dead?
   end
   # Return True if the Corresponding Party Member to the Events Character is Dead
   return true if not event.actor_index.nil? and $game_party.actors[event.actor_index].dead?
 end

 #----------------------------------------------------------------------------
 # * Add an actor event to the caterpillar
 #----------------------------------------------------------------------------
 def add_actor(event, actor_id)
   # Holds Actor IDs
   @actor_id_to_event[actor_id] = event
   # Clear any Recorded Move Events from the Player
   event.move_list.clear
   # If this Event (Cat Actor) is added (dont add twice)
   added = false
   # If the event has not had a last_walk_anime (used for resetting) recorded yet...
   if event.last_walk_anime.nil?
  # Record the Events Original Walk Anime Setting (Anime = Animation)
  event.last_walk_anime = event.walk_anime
   end
   # For each Actor in the active Game Party, excluding the First Actor - Doesnt need a Cat Actor, - 1 excludes Non Active Party Cat Actors
   for i in 1..$game_party.actors.size - 1
  # New Variable to hold data
  actor = $game_party.actors[i]
  # If Event's Cat Actor ID matches the Actor ID in the Database
  if actor.id == actor_id
    # Assigns the Game Party Index (0,1,2,3 etc) not the Actor ID
    event.set_actor_index(i)
    # Push on to @actors
    @actors << event
    # If the Caterpillar is not Paused (like Cutscenes, allows logical step progression)
    if !$game_switches[CATERPILLAR_PAUSE_SWITCH]
	  # Snap the Event to the Players Location - Looks sort of "unnatural"
	  event.moveto($game_player.x, $game_player.y)
    end
    # If Dead Effects are Turned On while Adding the Actors, set appropriate Effect	   
    if $game_switches[DEAD_ACTOR_EFFECTS]
	  # If the Effect is to Not Walk...
	  if DEAD_EFFECT.include? ('DONT_WALK')
	    # Set the Walk Animation to True or False depending on if Dead or Not..
	    event.walk_anime = ($game_party.actors[i].dead?) ? false : true
	  end
	  # If the Effect is to be a Ghost...
	  if DEAD_EFFECT.include? ('GHOST')
	    if $game_party.actors[i].dead?
		  # Set the Event to Ghost Opacity
		  event.fade_event(DEAD_GHOST_OPACITY, DEAD_GHOST_DURATION)
		  # Reset the Ghost Flag
		  event.opacity_ghost = true
	    end
	  end
    end
    # Record that this Actor has already been added - Used with Duplicates
    added = true
  end
   end
   # If the option is enabled to erase non Active Party Actors from the Caterpillar, and not Paused
   if remove_visible_actors? && !added && $game_switches[CATERPILLAR_ACTIVE_SWITCH]
  # Then erase the Event
  event.erase
   end

   # If we are kicking someone out of the party, they should be normal again, depending on script settings
   if !remove_visible_actors? and $game_switches[CATERPILLAR_ACTIVE_SWITCH] and $game_switches[DEAD_ACTOR_EFFECTS] and !added
  # If the Effect is to Not Walk...
  if DEAD_EFFECT.include? ('DONT_WALK') and event.walk_anime != event.last_walk_anime
    # Resets each Event to Original Walk Animation Flags
    event.walk_anime = event.last_walk_anime
  end
  # If the Effect is to be a Ghost...
  if DEAD_EFFECT.include? ('GHOST') and event.opacity_ghost == true and event.opacity * 1.0 != event.opacity_original * 1.0 and event.opacity_duration == 0
    # Reset the Event to its Original Opacity before being Faded Out
    event.fade_event_reset(DEAD_GHOST_DURATION)
    # Reset the Ghost Flag
    event.opacity_ghost = false
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Check if visible actors should be removed
 #----------------------------------------------------------------------------
 def remove_visible_actors?
   if REMOVE_VISIBLE_ACTORS.is_a?(Integer)
  return $game_switches[REMOVE_VISIBLE_ACTORS]
   else
  return REMOVE_VISIBLE_ACTORS
   end
 end

 #----------------------------------------------------------------------------
 # * If the game player has been "center". I.E. teleported somewhere.
 #----------------------------------------------------------------------------
 def center
   # Check if the caterpillar is active
   return unless $game_switches[CATERPILLAR_ACTIVE_SWITCH]
   # Clear the Player to Caterpillar move_llist
   @move_list.clear
   # updates the Actors in the caterpillar
   update
   # Move the actors to the new place
   for event in @actors
  # Teleport to Player's Position, Regardless if Paused or not.
  event.moveto($game_player.x, $game_player.y)
  # Clear that Actors Move List
  event.move_list.clear
   end
   # If the Script Option says Auto Orient is enabled
   if Game_Caterpillar::AUTO_ORIENT_TO_PLAYER == true
  # Sets a Flag that says we need to use the Player's TEMP Direction, not the Current Direction
  $use_player_temp_direction = true
  # Orients Cat Actors in Party to match the Player's Direction
  orient_to_player
   end

   # If Display Developer Errors is on
   if Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  # New Map - Check for Duplicates Again
  $duplicates_checked = false

  for event in $game_map.events.values
    # Excludes Player Event and Start Event, I think...
    if event.is_a?(Game_Event)
	  # used with Error Reporting
	  event.check_duplicates
    end
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Refresh the caterpillar. (Use sparingly)
 #----------------------------------------------------------------------------
 def refresh
   # Check if the caterpillar is active
   return unless $game_switches[CATERPILLAR_ACTIVE_SWITCH]
   if !$game_switches[CATERPILLAR_PAUSE_SWITCH]   
  # Clear the data
  clear
   end

   # Check each event if they are Cat Actor Events or not
   for event in $game_map.events.values
  # Excludes Non Game Event Events - Player and Start, I think...
  if event.is_a?(Game_Event)
    # Checks the Event Name for Caterpillar Name Denomination
    event.check_caterpillar
  end
   end
   # Allows for changing the Party without Snapping all Active Party Members to Players Position
   if !$game_switches[CATERPILLAR_PAUSE_SWITCH]
  # Center the events around the player
  center
  # Used for Z-Index Adjustments - Allows Player to be on Bottom of Stack for $game_party.size number of steps
  $cat_steps = 0
   end

   # Update the caterpillar, Graphics for Events changed to the Characters
   update
 end

 #----------------------------------------------------------------------------
 # * Register a player move
 #----------------------------------------------------------------------------
 def register_player_move(move_speed, *args)
   # Check if the caterpillar is active
   return unless $game_switches[CATERPILLAR_ACTIVE_SWITCH] && !$game_switches[CATERPILLAR_PAUSE_SWITCH]
   # Array holds Actors that have their Animations Set for that Step
   $walk_reset_array.clear
   # If Game Switch for DEAD_ACTOR_EFFECTS is On
   if $game_switches[DEAD_ACTOR_EFFECTS]
  # Sets flag to set the Actors Walk Animation
  $walk_has_been_set = false
   end

   # Add the new command
   @move_list.unshift([move_speed, args])
   # Append the new moves to the caterpillar events
   update_actor_movement
   # Check if the last command should be removed
   if @move_list.size > $game_party.actors.size
  # Remove the last move command
  @move_list.pop
   end

   # This is used with PASS_SOLID_ACTORS = false and cat_to_player
   #  to temporarily allow Active Cat Actors to move through the Player
   #  and becom a "Stack", this part resets their through state
   #  once the player steps off of the "Stack"
   if $cat_forced_to_through
  # Just for the Actors in the Active Party, not all Cat Actors
  for actor in @actors
    # Reset Cat Actors "Through" to Original State
    actor.reset_cat_through
  end
  # Turn this option off to prevent resetting every step
  $cat_forced_to_through = false
   end

   $cat_steps += 1
 end

 #----------------------------------------------------------------------------
 # * Updates the actors movement.
 #----------------------------------------------------------------------------
 def update_actor_movement
   # For each Actor in the Caterpillar
   for i in [email="0...@actors.size"]0...@actors.size[/email]
  # If there is a command in @move_list that hasnt been exectued
  if i + 1 < @move_list.size
    # Set the Command to the Command stored in @move_list, which was set by the Player's Movements
    command = @move_list[i + 1]
    # Sets Actor to an Iteration of Actors in @actors
    actor = @actors[i]
    # Prepends Command to that Events (Actors) @move_list - Prepend means Array = [2,3,4] - Array.unshift(foo) => Array [foo,2,3,4]
    actor.move_list.unshift(command[1])
    # Set Actor Move Speed to Players Recorded Move Speed at that spot
    actor.move_speed = command[0]
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Create a Forced Route to Player from @move_list
 #----------------------------------------------------------------------------

 def create_path_to_player(move_list, max)
   # Dont bother if nothing there   
   return if !move_list
   # Make a New RPG::MoveRoute 
   route_to_player = RPG::MoveRoute.new
   # Required Parameters - I guess these could be optional later
   route_to_player.repeat = false
   route_to_player.skippable = false
   # For every item in move_list
   for i in 0...move_list.size
  # Sets a Default - Not Returned if Code is 0
  code = 0
  # If the current iteration is less than that Actors Max Movements we want them to move
  if i <= max
    # Generate Codes based on move_list recorded action
    command = move_list[i].to_a[1].to_a[0]
    # See Game_Character 2 for Command Codes - Allow for 8 Direction Movement	 
    code = 1 if command == 'move_down'
    code = 2 if command == 'move_left'
    code = 3 if command == 'move_right'
    code = 4 if command == 'move_up'
    code = 5 if command == 'move_lower_left'
    code = 6 if command == 'move_lower_right'
    code = 7 if command == 'move_upper_left'
    code = 8 if command == 'move_upper_right'
    code = 14 if command == 'jump'
    code = 29 if command == 'speed' # Change speed
    # if code 14 (jumping), we need two more parameters for the Interpreter
    if code == 14 or code == 29
	  # Parameter is the Jump Target Array and Speed Parameters
	  parameter = move_list[i].to_a[1].to_a[1]
    end
  end
  # Put the Recorded Movement as the First Element of the Move Command
  route_to_player.list.unshift(RPG::MoveCommand.new(code, parameter)) if code != 0
   end
   # Returns a Valid RPG::MoveCommand to send to the Interpreter
   return route_to_player
 end


 #----------------------------------------------------------------------------
 # * Calls All Cat Actors to the Player's current Position
 #----------------------------------------------------------------------------

 # This call is useful for only moving the active Cat Actors to the Player
 # without trying to determine who is in the party and move via Eventing Movements
 # - Useful when trying to group up the entire party to one position
 #    such as beaming up, or riding up an elevator...

 # This allows use of "Wait for Move's Completion"

 def cat_to_player
   # For each Actor in the Caterpillar
   for i in [email="0...@actors.size"]0...@actors.size[/email]
  # Set the Command to the Command stored in @move_list, which was set by the Player's Movements
  command = @move_list[i]
  # Sets Actor to an Iteration of Actors in @actors
  actor = @actors[i]
  # Actors cant move Through Players - Turn Through On for this Actor (a.k.a. Event)
  actor.set_cat_through
  # Makes Actor complete the move_list and end up on the Player, Stacked
  actor.force_move_route (create_path_to_player(@move_list, i))
  # Set Actor Move Speed to Players Recorded Move Speed at that spot
  actor.move_speed = command[0] if @move_list[i]
   end

   # Clear the Move List since we just executed the whole thing.
   @move_list.clear
   $cat_steps = 0
 end

 #----------------------------------------------------------------------------
 # * Update the caterpillar.
 #----------------------------------------------------------------------------
 def update
   # Check if the caterpillar is active
   return unless $game_switches[CATERPILLAR_ACTIVE_SWITCH]
   # old_actors is used to Erase those Cat Actors with Option
   old_actors = @actors
   # Reset @actors to Empty Array
   @actors = []

   # Go through each actor that's possible present in the caterpillar, excluding the player...
   for i in 1...$game_party.actors.size
  # Figure out which Event corresponds to which Character
  event = @actor_id_to_event[$game_party.actors[i].id]
  # If the Event doesn't exist, or is not in the @actors Array
  unless event.nil? or @actors.include? event
    # Assigns the Game Party Index (0,1,2,3 etc) not the Actor ID
    event.set_actor_index(i)
    # Add that Event to the @actors Array for determining corresponding later
    @actors << event
    # Unerase Events if the OPTION is Enabled
    event.unerase if remove_visible_actors?
    # Changes the Events Graphic to that of the corresponding Actors
    event.character_name = $game_party.actors[i].character_name
  end
   end
   # If this OPTION is Enabled
   if remove_visible_actors?
  # Go through the old actors to see if any should be erased
  for actor in old_actors
    # if new @actors doesnt include that actor
    unless @actors.include?(actor)
	  # Erases the Event for that Cat Actor (can be undone with unerase)
	  actor.erase
    end
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Unerase all erased actor events
 #----------------------------------------------------------------------------
 def unerase_all
   for event in @actor_id_to_event.values
  event.unerase
   end
 end

 #----------------------------------------------------------------------------
 # * Erase actor events not in the party
 #----------------------------------------------------------------------------
 def erase_non_party_events
   for event in @actor_id_to_event.values
  event.erase unless @actors.include?(event)
   end
 end
end
module Fade_Events

 #--------------------------------------------------------------------------
 # * Fade Event - (Opacity 0 to 255, Duration in Frames)
 #--------------------------------------------------------------------------

 def fade_event(arg_opacity_target, arg_opacity_duration)

   # If Error Reporting is On and not a Release Game
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS
  if arg_opacity_target.nil? or arg_opacity_duration.nil?
    print "fade_event(opacity, duration) expects Two Arguments\n"
    return
  elsif not arg_opacity_target.is_a? Numeric
    print "\"", arg_opacity_target, "\" is not an Number!\n",
		  "Both Arguments should be Numbers!\n\n",
		  "I.E. fade_event(255,20)"
    return
  elsif not arg_opacity_duration.is_a? Numeric
    print "\"", arg_opacity_duration, "\" is not an Number!\n",
		  "Both Arguments should be Numbers!\n\n",
		  "I.E. fade_event(255,20)"
    return
  elsif arg_opacity_target < 0 or arg_opacity_target > 255
    print "\"", arg_opacity_target, "\" Opacity Out of Range\n",
		  "Valid Range: 0 - 255"
  elsif arg_opacity_duration < 0
    print "\"", arg_opacity_target, "\" Duration Out of Range\n",
		  "Valid Range: Any Positive Number or 0"
  end
   end
   # Store the Original Value
   self.opacity_original = self.opacity.to_i if self.opacity_original != self.opacity and self.opacity_forcing.nil?
   # Set the Opacity Forcing to True
   self.opacity_forcing = true
   # Set New Opacity To Fade To
   self.opacity_target = arg_opacity_target * 1.0
   # Set Opacity Change Duration
   self.opacity_duration = arg_opacity_duration
   # If End of Change Opacity Duration
   if self.opacity_duration == 0
  # Set Current Opacity to the Change To Opacity
  self.opacity = self.opacity_target.clone
   end
 end
 #-----------------------------------------------------------------------------
 #  * Change Event Opacity
 #-----------------------------------------------------------------------------

 def change_event_opacity
   # Manage change in Event Opacity Level
   if @opacity_duration >= 1
  # Create New Variable
  d = @opacity_duration
  # Calculate Opacity Change
  @opacity = (@opacity * (d - 1) + @opacity_target) / d
  # Count Down to 0 to end Opacity Change
  @opacity_duration -= 1
   end
 end

 #-----------------------------------------------------------------------------
 #  * Reset Event Opacity to Opacity Original
 #-----------------------------------------------------------------------------

 def fade_event_reset(arg_opacity_duration = nil)
   if not arg_opacity_duration.nil?
  # Set New Opacity To Fade To
  self.opacity_target = self.opacity_original * 1.0
  # Set Opacity Change Duration
  self.opacity_duration = arg_opacity_duration
  # If End of Change Opacity Duration
  if self.opacity_duration == 0
    # Set Current Opacity to the Change To Opacity
    self.opacity = self.opacity_target.clone
  end
   else
  # Just set the Opacity to the Original Opacity
  self.opacity = self.opacity_original * 1.0
  # Set the Duration to 0
  self.opacity_duration = 0
   end
 end

end # End Module Definition
class Game_Character

 attr_accessor	  :direction				   # Used for orienting Cat Actors to Player
 attr_accessor	  :move_route				  # Used for Interpreter Bugfix (built in)
 attr_accessor	  :opacity					 # Used with Fade Event and Ghost Option
 attr_accessor	  :opacity_original		    # Used with EVENT FADE Option
 attr_accessor	  :opacity_target			  # Used with EVENT FADE Option
 attr_accessor	  :opacity_duration		    # Used with EVENT FADE Option
 attr_accessor	  :opacity_forcing			 # Used with EVENT FADE Option
 attr_accessor	  :opacity_ghost			   # Used with Dead Ghost Option
 attr_accessor	  :original_move_route		 # In case of Resetting the Move Route, store it here
 attr_accessor	  :move_route_index		    # Allows access to Save It and Reset it
 attr_accessor	  :original_move_route_index   # In case of Resetting the Move Route, store Index here
 attr_accessor	  :move_route_wait_excluded    # Prevents Interpreter Hangs while an Animation is Playing
 attr_reader	    :caterpillar_actor		   # Used for quick checking is_cat_actor and is in the party
 attr_reader	    :actor_index				 # Actors Corresponding Index in the Game Party
 attr_reader	    :wait_count				  # Used with Interpreter Bugfix

 # Make the functions inside the Module available to this class
 include Fade_Events

 #----------------------------------------------------------------------------
 # * Event Fade Initialize
 #----------------------------------------------------------------------------
 unless self.method_defined?('fade_events_initialize')
   alias fade_events_initialize initialize
 end

 def initialize
   # Initilaize Original First
   fade_events_initialize
   # Added Properties for Fade
   @opacity_original = 255
   @opacity_target = 255
   @opacity_duration = 0
   @opacity_forcing = false
   @opacity_ghost = false
   # Game Player Only
   @actor_index = 0 if self.is_a?(Game_Player)
   # New Interpreter Bugfix
   @move_route_wait_excluded = false
 end

 #----------------------------------------------------------------------------
 # * Event Fade Update
 #----------------------------------------------------------------------------

 # IF the method hasn't been defined yet
 unless self.method_defined?('fade_events_update')
   alias fade_events_update update
 end

 # Redefine Updater for Game_Character (which includes Events and Player
 def update 
   # Run Original First
   fade_events_update
   if @opacity_duration >= 1
  # Manages the Events Current Opacity
  change_event_opacity
   end
   # Resets an Event to Non Ghost   
   if ($game_system.caterpillar.cat_actor_in_party?(self) or
   self.is_a?(Game_Player) ) and
   !$game_system.caterpillar.is_cat_actor_dead? (self) and
   Game_Caterpillar::DEAD_EFFECT.include? 'GHOST' and
   self.opacity_ghost == true

  # Reset the Event to its original non ghost opacity
  @opacity_ghost = false
  self.fade_event(@opacity_original, Game_Caterpillar::DEAD_GHOST_DURATION)
   end
 end

 #----------------------------------------------------------------------------
 #  * Sets the Actors Index in Game Party - IE 0,1,2,3 regardless of Event ID
 #----------------------------------------------------------------------------

 def set_actor_index(index)
   # New Property reflects the Actors Position in $game_party.actors
   @actor_index = index
 end

 #----------------------------------------------------------------------------
 # Event and Player Movement Passable
 #----------------------------------------------------------------------------

 # Check if alias for method already defined
 unless self.method_defined?('heretic_event_passable?')
   # Create Alias of Def for Def adjustment without full reDEFinition
   alias heretic_event_passable? passable?
 end

 def passable?(x, y, d)
   # If Global Variable $walk_off_map is turned on
   if $walk_off_map == true
  # If Player or Active Caterpillar Actor (in the party) trying to move Off Map
  if self.is_a?(Game_Player) or ($game_system.caterpillar.is_cat_actor?(self) and $game_system.caterpillar.cat_actor_in_party?(self))
    # Allows OFF MAP Player and Cat Actor Walking
    return true
  end
   end
   # If Event is NOT the Player - Player and Cat Actors are allowed to move In and Out of the @move_list, or where the Cat Actors will step next
   if not self.is_a?(Game_Player)
  # Returns FALSE if the Event is trying to move into Caterpillar
  if !$game_system.caterpillar.is_cat_actor?(self) or !$game_system.caterpillar.cat_actor_in_party?(self)
    # If the Event (including Player) has a @move_route (not the same as @move_list, that is for Cat Actors
    if not @move_route.nil?
	  # If Event is trying to move to a position occupied by the Cat Actors
	  if $game_system.caterpillar.in_move_list?(x, y, d) and not self.through
	    # That Movement is NOT Passable by the Event
	    return false
	  end
    end
  end
   end

   # If that event has Through Checked, and is allowed to go OFF MAP (Set by Name \off_map
   if @through and @allowed_off_map
  # Return Passability as True -  Acts like a "Super Through"
  return true
   end
   #--------------------------------------------------------------------------
   # * Determine if Passable
   #	 x : x-coordinate
   #	 y : y-coordinate
   #	 d : direction (0,2,4,6,8)
   #		 * 0 = Determines if all directions are impassable (for jumping)
   #--------------------------------------------------------------------------

   # Returns Cat Actor Modified Original Passability

   # This needed to be modified and the part that needed adjusting was
   #  too deeply buried in nesting so most of this is actually just
   #  the original code with a few lines changed to check for Cat Actors

   # Get new coordinates
   new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
   new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
   # If coordinates are outside of map
   unless $game_map.valid?(new_x, new_y)
  # impassable
  return false
   end
   # If through is ON
   if @through
  # passable
  return true
   end
   # If unable to leave first move tile in designated direction
   unless $game_map.passable?(x, y, d, self)
  # impassable
  return false
   end
   # If unable to enter move tile in designated direction
   unless $game_map.passable?(new_x, new_y, 10 - d)
  # impassable
  return false
   end
   # Loop all events
   for event in $game_map.events.values
  # If event coordinates are consistent with move destination
  if event.x == new_x and event.y == new_y
    # If through is OFF
    unless event.through
	  # If self is event not a Player
	  if self != $game_player
	    # impassable
	    return false
	  end
	  # With self as the player and partner graphic as character
	  if event.character_name != ""
	    # If Pass Solid Actors is on, and Not Paused, and Active
	    unless $game_system.caterpillar.cat_actor_in_party?(event) and
		  Game_Caterpillar::PASS_SOLID_ACTORS and
		  ((!$game_switches[Game_Caterpillar::CATERPILLAR_PAUSE_SWITCH] and
		  $game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH]) or
		  !$game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH])
		  # impassable
		  return false
	    end
	  end
    end
  end
   end
   # If player coordinates are consistent with move destination
   if $game_player.x == new_x and $game_player.y == new_y
  # If through is OFF
  unless $game_player.through
    # If your own graphic is the character
    if @character_name != ""
	  # impassable
	  return false
    end
  end
   end
   # passable
   return true
 end

 #--------------------------------------------------------------------------
 # * Turn Towards Event (Player or Event)
 #--------------------------------------------------------------------------
 def turn_toward_event(event_target_id)
   # Check if the Event ID is requesting Player
   #  - Player is used with turn_cat_toward_event in case you want the other Cat Actors to follow the Player
   #  -  instead of a specified event.  Otherwise, there is a button in Move Edit Window...
   if event_target_id == 0
  # Target is the Game Player - Do anyway even though there is a Button for it...
  event_target = $game_player
   # Make sure that event_target_id is Numeric
   elsif event_target_id.is_a?(Integer)
  # Set Variable to the corresponding Event
  event_target = $game_map.events[event_target_id]
   else
  # Set to Nil to prevent further processing
  event_target = nil
   end
   # Arg isnt usable or Event doesnt exist, return to stop processing
   if event_target.nil?
  # event_target_id isnt usable or Event doesnt exist, return if it is to stop processing
  return
   end
   # Get difference in Self and Target coordinates
   sx = @x - event_target.x
   sy = @y - event_target.y
   # If coordinates are equal
   if sx == 0 and sy == 0
  return
   end
   # If horizontal distance is longer
   if sx.abs > sy.abs
  # Turn to the right or left towards target event
  sx > 0 ? self.turn_left : self.turn_right
   # If vertical distance is longer
   else
  # Turn up or down towards target event
  sy > 0 ? self.turn_up : self.turn_down
   end
 end

 #--------------------------------------------------------------------------
 # * Turn Away From Event (Player or Event)
 #--------------------------------------------------------------------------
 def turn_away_from_event(event_target_id)
   # Check if the Event ID is requesting Player
   #  - Player is used with turn_cat_away_from_event in case you want the other Cat Actors to follow the Player
   #  -  instead of a specified event.  Otherwise, there is a button in Move Edit Window...
   if event_target_id == 0
  # Target is the Game Player - Do anyway even though there is a Button for it...
  event_target = $game_player
   # Make sure that event_target_id is Numeric
   elsif event_target_id.is_a?(Integer)
  # Set Variable to the corresponding Event
  event_target = $game_map.events[event_target_id]
   else
  # Set to Nil to prevent further processing
  event_target = nil
   end
   # Arg isnt usable or Event doesnt exist, return to stop processing
   if event_target.nil?
  # event_target_id isnt usable or Event doesnt exist, return if it is to stop processing
  return
   end
   # Get difference in Self and Target coordinates
   sx = @x - event_target.x
   sy = @y - event_target.y
   # If coordinates are equal
   if sx == 0 and sy == 0
  return
   end
   # If horizontal distance is longer
   if sx.abs > sy.abs
  # Turn to the right or left towards target event
  sx > 0 ? self.turn_right : self.turn_left
   # If vertical distance is longer
   else
  # Turn up or down towards target event
  sy > 0 ? self.turn_down : self.turn_up
   end
 end

 #--------------------------------------------------------------------------
 # * Move toward Event
 #--------------------------------------------------------------------------
 def move_toward_event(event_target_id)
   # Check if the Event ID is requesting Player, pointless but just in case...
   if event_target_id == 0
  # Target is the Game Player - Do anyway even though there is a Button for it...
  event_target = $game_player
   # Make sure that event_target_id is Numeric
   elsif event_target_id.is_a?(Integer)
  # Set Variable to the corresponding Event
  event_target = $game_map.events[event_target_id]
   else
  # Set to Nil to prevent further processing
  event_target = nil
   end
   # Arg isnt usable or Event doesnt exist, return to stop processing
   if event_target.nil?
  # event_target_id isnt usable or Event doesnt exist, return if it is to stop processing
  return
   end
   # Get difference in Self and Target coordinates
   sx = @x - event_target.x
   sy = @y - event_target.y
   # If coordinates are equal
   if sx == 0 and sy == 0
  return
   end
   # Get absolute value of difference
   abs_sx = sx.abs
   abs_sy = sy.abs
   # If horizontal and vertical distances are equal
   if abs_sx == abs_sy
  # Increase one of them randomly by 1
  rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
   end
   # If horizontal distance is longer
   if abs_sx > abs_sy
  # Move towards player, prioritize left and right directions
  sx > 0 ? move_left : move_right
  if not moving? and sy != 0
    sy > 0 ? move_up : move_down
  end
   # If vertical distance is longer
   else
  # Move towards player, prioritize up and down directions
  sy > 0 ? move_up : move_down
  if not moving? and sx != 0
    sx > 0 ? move_left : move_right
  end
   end
 end

 #--------------------------------------------------------------------------
 # * Move away from Event
 #--------------------------------------------------------------------------
 def move_away_from_event(event_target_id)
   # Check if the Event ID is requesting Player, pointless but just in case...
   if event_target_id == 0
  # Target is the Game Player - Do anyway even though there is a Button for it...
  event_target = $game_player
   # Make sure that event_target_id is Numeric
   elsif event_target_id.is_a?(Integer)
  # Set Variable to the corresponding Event
  event_target = $game_map.events[event_target_id]
   else
  # Set to Nil to prevent further processing
  event_target = nil
   end
   # Arg isnt usable or Event doesnt exist, return to stop processing
   if event_target.nil?
  # event_target_id isnt usable or Event doesnt exist, return if it is to stop processing
  return
   end
   # Get difference in Self and Target coordinates
   sx = @x - event_target.x
   sy = @y - event_target.y
   # If coordinates are equal
   if sx == 0 and sy == 0
  return
   end
   # Get absolute value of difference
   abs_sx = sx.abs
   abs_sy = sy.abs
   # If horizontal and vertical distances are equal
   if abs_sx == abs_sy
  # Increase one of them randomly by 1
  rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
   end
   # If horizontal distance is longer
   if abs_sx > abs_sy
  # Move away from player, prioritize left and right directions
  sx > 0 ? move_right : move_left
  if not moving? and sy != 0
    sy > 0 ? move_down : move_up
  end
   # If vertical distance is longer
   else
  # Move away from player, prioritize up and down directions
  sy > 0 ? move_down : move_up
  if not moving? and sx != 0
    sx > 0 ? move_right : move_left
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Exclude the Event or Player from "Wait for ALL Move's Completion"
 #----------------------------------------------------------------------------

 # NOTE:  Call this from Event Editor -> Set Move Route

 def move_route_wait_exclude
   self.move_route_wait_excluded = true
 end

 #----------------------------------------------------------------------------
 # * Re-Include the Event or Player from "Wait for ALL Move's Completion"
 #----------------------------------------------------------------------------
 # NOTE:  Call this from Event Editor -> Set Move Route
 def move_route_wait_include
   self.move_route_wait_excluded = false   
 end

end
class Game_Player < Game_Character

 attr_accessor	  :walk_anime	    # Walking Animation - Used for Dead Dont Walk

 unless self.method_defined?('zeriab_caterpillar_game_player_center')
   alias_method(:zeriab_caterpillar_game_player_center, :center)
 end
 # If Alias has already been defined, dont redefine, prevents STACK OVERFLOW
 unless self.method_defined?('heretic_player_passable?')
   alias heretic_player_passable? passable?
 end

 #----------------------------------------------------------------------------
 # * Redefines passable used by Player to allow going thru Cat Actors and OFF MAP
 #----------------------------------------------------------------------------

 def passable?(*args)
   # If Global Variable $walk_off_map is set
   if $walk_off_map == true
  # Return Passable as True when trying to move ANYWHERE, acts like "Super Through"
  # PLAYER ONLY
  return true
   end

   return heretic_player_passable?(*args)
 end
 #----------------------------------------------------------------------------
 # * When the player is centered (i.e. teleported somewhere)
 #----------------------------------------------------------------------------
 def center(*args)
   zeriab_caterpillar_game_player_center(*args)
   $game_system.caterpillar.center
   # Used for Z-Index Adjustments, Steps and Direction determine the Z-Index
   $cat_steps = 0

   if Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS
  # Enables Displaying Error Messages for Missing Caterpillar Actors
  $game_system.caterpillar.check_missing_reset
   end
 end
 # If Alias has already been defined, dont redefine, prevents STACK OVERFLOW
 unless self.method_defined?('heretic_player_refresh')
   alias heretic_player_refresh refresh
 end 
 #----------------------------------------------------------------------------
 # * This fixes a Bug where Adding or Removing an Actor made the Player reset to 255 Opacity
 #----------------------------------------------------------------------------

 def refresh
   # Call original Game_Player Refresh first...
   heretic_player_refresh

   if Game_Caterpillar::DEAD_ACTOR_EFFECTS and
   Game_Caterpillar::DEAD_EFFECT.include?('GHOST') and
   $game_player.opacity_ghost == true and
   $game_player.opacity != Game_Caterpillar::DEAD_GHOST_OPACITY
   $game_party.actors[0].dead?
  # Reset Player Opacity to Ghost Opacity before Screen Update
  @opacity = Game_Caterpillar::DEAD_GHOST_OPACITY
   end
 end

 #----------------------------------------------------------------------------
 # * Just Informational to not call "cat_to_player" from "Set Move Route"
 #----------------------------------------------------------------------------
 # NOTE:  Call this from Event Editor -> Set Move Route 

 def cat_to_player
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Call from Event Editor -> Scripts, instead of\nEvent Editor -> Set Move Route -> Scripts"
   end
 end
 #----------------------------------------------------------------------------
 # * Generate registration of player moves to the caterpillar code
 #----------------------------------------------------------------------------

 # Constants - DO NOT EDIT

 MOVE_METHODS = ['move_down', 'move_left', 'move_right', 'move_up',
			  'move_lower_left', 'move_lower_right', 'move_upper_left',
			  'move_upper_right', 'jump']

 # Go through each method
 for method in MOVE_METHODS
   # Create the script for the specific method
   PROG = <<_END_
 def #{method}(*args)
   x,y = self.x, self.y
   super(*args)
   unless self.x == x && self.y == y
  $game_system.caterpillar.register_player_move(@move_speed, '#{method}', args, [self.x, self.y])
   end
 end
_END_
   # Run the script
   eval(PROG)
 end
end
class Module
 # Prevent adding the method again should it already be present.
 unless self.method_defined?('attr_sec_accessor')
   def attr_sec_accessor(sym, default = 0)
  attr_writer sym
  attr_sec_reader sym, default
   end

   def attr_sec_reader(sym, default = 0)
  sym = sym.id2name
  string = "def #{sym};" +
		   "  @#{sym} = #{default}  if @#{sym}.nil?;" +
		   "  @#{sym};" +
		   "end;"
  module_eval(string)
   end
 end
end
class Game_System
 attr_sec_accessor :caterpillar, 'Game_Caterpillar.new'
end
class Game_Actor
 attr_reader  :actor_id   # Actor ID in the Database - Leave Open for Script Development
end
class Game_Event < Game_Character
 #----------------------------------------------------------------------------
 # * Attributes
 #----------------------------------------------------------------------------

 attr_sec_accessor  :move_list, '[]'    # Cat Actors Move List
 attr_accessor	  :move_speed		 # Player Move Speed
 attr_accessor	  :walk_anime		 # Walking Animation Bool
 attr_accessor	  :last_walk_anime    # Last Walking Animation Bool - Dead Dont Walk
 attr_accessor	  :through		    # Default Walk Through
 attr_writer	    :set_cat_through    # Turns Through On and saves Original State
 attr_writer	    :reset_cat_through  # Resets Through to Original State
 attr_writer	    :character_name	 # Used changing Event Graphics to the Actors
 attr_reader	    :allowed_off_map    # Event Propterty set by Event Name \off_map
 attr_reader	    :direction_fix	  # Fix means To Lock - Used with Auto Orient

 #----------------------------------------------------------------------------
 # * Aliases
 #----------------------------------------------------------------------------
 unless self.method_defined?('zeriab_caterpillar_game_event_passable?')
   alias zeriab_caterpillar_game_event_initialize :initialize
   alias zeriab_caterpillar_game_event_passable?  :passable?
   if Module.constants.include?('SDK')
  alias zeriab_caterpillar_game_event_update_movement  :update_movement
   else
  alias zeriab_caterpillar_game_event_update  :update
   end
 end

 #----------------------------------------------------------------------------
 # Object Initialization
 #----------------------------------------------------------------------------
 def initialize(map_id, event, *args)
   # Gives Events an @allowed_off_map Property to allow them to venture off the Map
   check_allowed_off_map(event)
   # Used with Party Members that need to have Walk Animation Reset to Event Original Settings
   $walk_reset_array = []
   # Used for Displaying Errors about Missing Cat Actors
   $check_missing_array = []
   # Used for checking for Duplicate Cat Actors
   $duplicates_array = []
   # Check for Events with \z_flat or \z_add[int] flags to render them correctly
   check_flat_sprites(event)
   # Run the original Initializer
   zeriab_caterpillar_game_event_initialize(map_id, event, *args)
   # Check for Events with \move_route_wait_exclude flag in Name of Event
   check_move_route_wait_exclude(event)
   # Return if the caterpillar isn't active
   return unless $game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH]
   # Check for caterpillar actor denomination
   check_caterpillar
 end

 #----------------------------------------------------------------------------
 # * Sets an Event to Temporarily have a Through Property - Dont Call Manually
 #----------------------------------------------------------------------------
 # This is used for PASS_SOLID_ACTORS = FALSE and cat_to_player to temporarily
 #  allow the Active Cat Actors to move through the Player
 #
 # It resets once the Player steps away from the Stack of Cat Actors
 # This shouldn't allow other Events (that arent marked as through themselves)
 #  to randomly step into the Caterpillar

 def set_cat_through
   # Store the Original Property so we can revert back to it later
   @original_through = self.through if @original_through.nil?
   # Set that event to a Through flag so can walk Through the Player
   # Player can walk thru events, but events cant walk thru the Player
   self.through = true
   # Allows a Reset to Original State if this is true, happens on Next Player Movement
   $cat_forced_to_through = true
 end
 #----------------------------------------------------------------------------
 # * Resets an Event back to its Original Through Property - Dont Call Manually
 #----------------------------------------------------------------------------

 def reset_cat_through
   # Resets the Event back to its Original Through State
   self.through = @original_through if not @original_through.nil?
 end

 #--------------------------------------------------------------------------
 # * Determine Coordinate Match
 #--------------------------------------------------------------------------
 def coordinate_match?(x, y)
   # Returns True if X and Y args match the @X and @Y properties
   return (@x == x and @y == y)
 end

 #--------------------------------------------------------------------------
 # * Sets the Cat Actor and Player Walk Animations ON and OFF for each step
 #--------------------------------------------------------------------------
 def set_dead_animation
   # Resets Caterpillar Actor Walk Animation to Default of Event
   if $game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH]
  # This is used to Reset Actors to Original States, Set Once then stays Off
  if $walk_has_been_reset != true and
    !$game_switches[Game_Caterpillar::DEAD_ACTOR_EFFECTS]
	  # If DEAD_EFFECT has DONT_WALK in the Array
	  if Game_Caterpillar::DEAD_EFFECT.include? 'DONT_WALK'
	    # Resets the Player and Caterpillar Actors to Default Walk Flags
	    $game_system.caterpillar.walk_reset
	  end
	  if Game_Caterpillar::DEAD_EFFECT.include? 'GHOST'
	    # Resets the Player and Caterpillar to Default Opacity with a Fade
	    $game_system.caterpillar.ghost_reset
	  end
  # This Sets Dead Effect States Every Step.  If not moving, Actors dont change.  Used with Slip Damage.
  elsif $walk_has_been_set != true and
    $game_switches[Game_Caterpillar::DEAD_ACTOR_EFFECTS]
	  # Checks for Dead Actors once for each Player Step
	  $game_system.caterpillar.dead_walk_animation
  end
   end 
 end

 #----------------------------------------------------------------------------
 # * Redefine screen_z for Caterpillar
 #----------------------------------------------------------------------------
 unless method_defined?(:caterpillar_screen_z)
   alias :caterpillar_screen_z :screen_z
 end   

 def screen_z (height = 0)

   if @always_on_top
  # Caterpillar Actors Z-Index based on their Index in the Party
  # 0 - on top, 3-on bottom, for Caterpillar Actors, still on top of everything else

  # If Event is tagged as being a Caterpillar Actor
  if @caterpillar_actor
    # Gets the Actors Position in the Game Party
    actor_index = $game_actors[@caterpillar_actor].index
    # If Cat Actor Event's Actor is in the Party, otherwise nil
    if actor_index
	  # Allows Events to be Above Always On Top Characters
	  return 998 - actor_index
    end
  else
    # 999, unconditional
    return 999
  end
   end

   # if Event has a @caterpillar Flag
   if @caterpillar_actor
  # Caterpillar Actors based on their Index in the Party
  # 0 - on top, 3-on bottom
  actor_index = $game_actors[@caterpillar_actor].index
    # If Cat Actor Events Actor is in the Party, otherwise nil
  if actor_index
    # if Up Directions (Up Left, Up, and Up Right)
    if [7, 8, 9].include? (@direction) and $cat_steps < $game_party.actors.size
	  # Original Screen Z + 32 (Cat Actors always Render as Tall Sprites) minus position in party
	  if $cat_steps <= actor_index
	    # Facing UP('ish) so Newer Actors on TOP of Older Actors
	    return caterpillar_screen_z + 32 + actor_index
	  else
	    # Original Screen Z + 32 (Cat Actors always Render as Tall Sprites) minus position in party
	    return caterpillar_screen_z + 32 - actor_index
	  end
    else
	  # Original Screen Z + 32 (Cat Actors always Render as Tall Sprites) minus position in party
	  return caterpillar_screen_z + 32 - actor_index
    end
  end
   end
   # This adds the feature of adjusting an events Z-Index on the fly

   # \z_flat[int]
   if not @z_flat.nil? and [email="!@always_on_top"]!@always_on_top[/email]
  return (@real_y - $game_map.display_y + 3) / 4 + @z_flat
   end
   # \z_add[int]
   if not @z_add.nil? and [email="!@always_on_top"]!@always_on_top[/email]
  return (@real_y - $game_map.display_y + 3) / 4 + 32 + @z_add
   end

   # If tile - Dont Adjust again!
   if @tile_id > 0
  # Add tile priority * 32
  return (@real_y - $game_map.display_y + 3) / 4 + 32 + $game_map.priorities[@tile_id] * 32
   # If character
   else
  # Calculates Original Screen-Z adjusted for Party Size so Party is Always On Top
  return (@real_y - $game_map.display_y + 3) / 4 + 32 + (height > 32 ? 31 - $game_party.actors.size : 0)
   end
 end

 #----------------------------------------------------------------------------
 #  * Check for caterpillar actor denomination
 #----------------------------------------------------------------------------
 def check_caterpillar
   # Check for caterpillar actor denomination (Last is used if more present)
   @event.name.gsub(/\\cat_actor\[([0-9]+)\]/i) [email="{@caterpillar_actor"]{@caterpillar_actor[/email] = $1 }
   # Check if an valid denomination is found.
   if @caterpillar_actor.is_a?(String)
  @caterpillar_actor = @caterpillar_actor.to_i
  if $data_actors[@caterpillar_actor].nil?
    @caterpillar_actor = nil
  else
    $game_system.caterpillar.add_actor(self, @caterpillar_actor)
  end
   end
 end
 #----------------------------------------------------------------------------
 #  * Check Each Event for a \z_flat  or \z_add flag
 #----------------------------------------------------------------------------

 def check_flat_sprites(event)
   # Options
   #
   # "Name\z_flat"
   # "Name\z_flat[32]" for characters manual adjustments, for whatever reason
   # "Name\z_add[32]" for characters higher than 32 pixels high
   event.name.gsub(/\\z_flat\[([-]?[0-9]+)\]|\\z_flat/i) [email="{@z_flat"]{@z_flat[/email] = $1.to_i }
   return if @z_flat   

   event.name.gsub(/\\z_add\[([-]?[0-9]+)\]/i) [email="{@z_add"]{@z_add[/email] = $1.to_i }
   return if @z_add
 end

 #----------------------------------------------------------------------------
 #  * Check Each Event for a \move_route_wait_excluded flag
 #----------------------------------------------------------------------------

 def check_move_route_wait_exclude(event)
   # Name an Event "anything\move_route_wait_excluded
   #  it means "Wait for Move's Completion" doesnt consider events with this in the Name...
   #  Not sure why I cant access an Initialized Property here, but can set the value, oh hell, just run with that
   event.name.gsub(/\\move_route_wait_exclude/i) [email="{@move_route_wait_excluded"]{@move_route_wait_excluded[/email] = true}
 end 

 #----------------------------------------------------------------------------
 #  * Check for Duplicate Cat Actors which causes Problems with the Caterpillar
 #----------------------------------------------------------------------------

 def check_duplicates
   if $duplicates_checked != true and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS

  # Initialize - Resets to Uninitialized at end of check
  #  - Else, Increment
  $check_caterpillar_events_checked = ($check_caterpillar_events_checked.nil?) ? 1 : $check_caterpillar_events_checked + 1
  # If Just initialized, reset the Arrays used
  if $check_caterpillar_events_checked == 1
    # Holds ONLY Duplicated Events for Error Display
    $duplicated_events = []
    # Holds ALL Cat Actors - Duplicates Not Added, used for checking if Duplicates Exist
    $duplicates_array = []
    # Advises of Multiple Duplicates - Integer for Cat Actor
    error_displayed = nil
  end

  # If the Event is a Cat Actor
  if @caterpillar_actor
    # Iterate thru the Array for checking Subarrays
    for i in 0...$duplicates_array.size
	  # If the Array that holds ALL Cat Actors already has that Cat Actor in it
	  if $duplicates_array[i].include? (@caterpillar_actor)
	    # If the Array that holds ONLY Duplicates doesnt have this in it yet
	    if not $duplicated_events.include? ([@caterpillar_actor, @event])
		  # Then Add it to the Array for Error Display
		  $duplicated_events.push($duplicates_array[i])
	    end
	    # If the Array that holds ONLY Duplicates doesnt have this in it yet
	    #   We want to provide the person using this script with information
	    #   on which two events are duplicates
	    #   so Original AND Duplicate are Needed for Displaying Useful Errors
	    #   this is for the ORIGINAL
	    if not $duplicated_events.include? ([@caterpillar_actor, @event])
		  # Then Add it to the Array also for Error Display
		  $duplicated_events.push([@caterpillar_actor, @event])
	    end
	  end
    end
    # Even if it is a Duplicate Event, push that on to the All Cat Actors array that is checked against
    $duplicates_array.push([@caterpillar_actor, @event])
  end
  # If the Increment Counter is the same as the Total of Game Events
  # Then all Events have been checked for Duplicates, then display the Duplicates
  if $check_caterpillar_events_checked == $game_map.events.size
    # If there were any Duplicates (shows minimum of TWO)
    if not $duplicated_events.empty?
	  # Iterate thru EVERY Duplicate Cat Actor
	  for i in 0...$duplicated_events.size
	    # Just easier to type - Temporary Variable
	    dup_event = $duplicated_events[i].to_a[1]
	    dup_actor_id = $duplicated_events[i].to_a[0].to_i
	    dup_name = $game_actors[dup_actor_id].name
	    # If Initial Warning for that Cat Actor Duplicate hasnt been displayed yet
	    if error_displayed.nil? or error_displayed != $duplicated_events[i].to_a[0] # to_a[0] is the Cat Actors ID
		  # Advise there are Duplicates for THIS Cat Actor
		  print "WARNING: Caterpillar has detected\nDuplicate Cat Actors\nfor Cat Actor: ", $duplicated_events[i].to_a[0], " Name: ", dup_name, "\n\n",
			    "Duplicates move to the Players Position, but\nare NOT a part of the Caterpillar.\nThey Might cause your game to Freeze\nunder certain circumstances.\n\n",
			    "Map Name: ", $game_map.name, "   Map ID: ", $game_map.map_id
		  error_displayed = $duplicated_events[i].to_a[0]
	    end
	    # Display the Useful Data to the Mapper / Developer about which Two Events are Cat Duplicates
	    print "Duplicate Cat Actor: ", $duplicated_events[i].to_a[0], "\n",
			  "Event ID: ", dup_event.id, "\n",
			  " - MAP Name: ", $game_map.name, "\n",
			  " - Actor Name: ", dup_name, "\n",
			  " - Event Name: ", dup_event.name, "\n",
			  " - X: ", dup_event.x, "\n",
			  " - Y: ", dup_event.y

	  end
    end 
    # Reset the Global Arrays and Variables (Global so not Event Properties, and can be run outside this Class)
    $duplicated_events = []
    $duplicates_array = []	  
    $check_caterpillar_events_checked = nil
    # Everything in this Def runs when this is set to False, Reset in "center"
    $duplicates_checked = true
  end
   end
 end

 #----------------------------------------------------------------------------
 # * Set Events with \off_map in Name to go OFF MAP with THROUGH
 #----------------------------------------------------------------------------
 def check_allowed_off_map(event)
   # Check ALL Events if that Event should be allowed to go Off the Map
   # Enable by adding \off_map to Event Name.  IE "Bird\off_map"
   # Not Dependant on Caterpillar
   #
   # NOTE: "THROUGH" MUST BE ENABLED TO ALLOW OFF MAP!!!
   event.name.gsub (/\\Off_Map/i) [email="{@allowed_off_map"]{@allowed_off_map[/email] = true}
 end

 #---------------------------------------------------------------------------
 # Check passability
 #---------------------------------------------------------------------------
 def passable?(*args)
   if @caterpillar_actor.nil? || move_list.empty? ||
   !$game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH]
  return zeriab_caterpillar_game_event_passable?(*args)
   else
  return true
   end
   return result
 end

 #---------------------------------------------------------------------------
 #
 #    SDK and Non-SDK stuff
 #
 #---------------------------------------------------------------------------

 if Module.constants.include?('SDK')
   #-------------------------------------------------------------------------
   # * Update Movement - SDK Version
   #-------------------------------------------------------------------------
   def update_movement
  # If the Caterpillar is Active
  if $game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH]
    # Sets the Animation for Cat Actors EVERY STEP (Due to Poison on Map)
    set_dead_animation
  end	 

  # Return if Conditions Not Met
  if @caterpillar_actor.nil? || move_list.empty? ||
	 !$game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH]
    return zeriab_caterpillar_game_event_update_movement
  end
  # Interrupt if not stopping
  if jumping? or moving?
    return
  end

  # If the Developer Display Errors Option is enabled
  if Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS and $check_missing_needs_to_run == true
    # Sets the Animation for Cat Actors
    $game_system.caterpillar.check_missing
  end

  # Retrive the command
  command = move_list[0]
  # Call the command
  method(command[0]).call(*command[1])
  # Make sure the x and y are right in the end
  @x, @y = *command[2]
  # Remove the command
  move_list.pop
   end
 else # Non-SDK version
   #-------------------------------------------------------------------------
   # * Update Movement - Non SDK Version
   #-------------------------------------------------------------------------
   def update
  # Interrupt if not stopping
  no_move = jumping? or moving?

  # If the Caterpillar is Active
  if $game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH]
    # Sets the Animation for Cat Actors EVERY STEP (Due to Poison on Map)
    set_dead_animation
  end

  # If the Developer Display Errors Option is enabled
  if Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS and $check_missing_needs_to_run == true
    # Sets the Animation for Cat Actors
    $game_system.caterpillar.check_missing
  end	 
  # Update
  zeriab_caterpillar_game_event_update
  # Check if it should return
  if $game_switches[Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH] &&
	 @caterpillar_actor != nil && !move_list.empty? && !no_move
    # Retrive the command
    command = move_list[0]
    # Call the command
    method(command[0]).call(*command[1])
    # Make sure the x and y are right in the end
    @x, @y = *command[2]
    # Remove the command
    move_list.pop
  end
   end
 end

 #---------------------------------------------------------------------------
 # * Bring back an erased event
 #---------------------------------------------------------------------------
 def unerase
   @erased = false
   refresh
 end
end
class Game_Map
 #-----------------
 #    Aliases
 #----------------
 unless self.method_defined?('zeriab_caterpillar_game_map_setup')
   alias zeriab_caterpillar_game_map_setup :setup
 end

 # Removes the need for SDK...

 #----------------
 # * Name
 #----------------
 @@map_info = load_data("Data/MapInfos.rxdata")
 # Defines $game_map.name for Debugging - Thank you Moonpearl and ForeverZer0!
 def name(id = @map_id)
   return @@map_info[id].name
 end

 #---------------------------------------------------------------------------
 # * Transfer Player
 #---------------------------------------------------------------------------
 def setup(*args)
   $game_system.caterpillar.clear
   zeriab_caterpillar_game_map_setup(*args)
   if Game_Caterpillar::AUTO_ORIENT_TO_PLAYER == true
  $game_system.caterpillar.orient_to_player
   end
 end
 # Call outside of class, on Initial Game Start or Reset
 # Just in case the game was Reset while one of the settings was active
 $walk_off_map = false

end # End Class
class Game_Switches
 #------------------
 #    Aliases
 #------------------
 unless self.method_defined?('zeriab_caterpillar_game_switches_setter')
   alias zeriab_caterpillar_game_switches_setter :[]=
 end
 #------------------
 #    Setter
 #------------------
 def []=(switch_id, value, *args)
   zeriab_caterpillar_game_switches_setter(switch_id, value, *args)
   if switch_id == Game_Caterpillar::CATERPILLAR_ACTIVE_SWITCH
  $game_system.caterpillar.refresh
   elsif switch_id == Game_Caterpillar::REMOVE_VISIBLE_ACTORS
  if value
    $game_system.caterpillar.erase_non_party_events
  else
    $game_system.caterpillar.unerase_all
  end
   end
 end
end
class Interpreter
 #------------------
 #	 Aliases
 #------------------
 unless self.method_defined?('zeriab_caterpillar_interpreter_command_129')
   alias zeriab_caterpillar_interpreter_command_129 :command_129
   alias zeriab_caterpillar_interpreter_command_322 :command_322
   alias heretic_caterpillar_interpreter_command_201 :command_201
 end

 #----------------------------------------------------------------------------
 # * Change Party Member
 #----------------------------------------------------------------------------
 def command_129
   result = zeriab_caterpillar_interpreter_command_129
   $game_system.caterpillar.refresh
   return result
 end

 #----------------------------------------------------------------------------
 # * Change Actor Graphic
 #----------------------------------------------------------------------------
 def command_322
   result = zeriab_caterpillar_interpreter_command_322
   $game_system.caterpillar.update
   return result
 end
 #--------------------------------------------------------------------------
 # * INTERPRETER BUGFIX
 #--------------------------------------------------------------------------

 #--------------------------------------------------------------------------
 # * Wait for Move's Completion
 #--------------------------------------------------------------------------
 def command_210
   # If not in battle
   unless $game_temp.in_battle
  # Set move route completion waiting flag
  @move_route_waiting = true
   end
   # Continue
   return true
 end 
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 # Full Redefinition - Bugfix! Not Aliased!!!
 def update
   # Initialize loop count
   @loop_count = 0
   # Loop
   loop do
  # Add 1 to loop count
  @loop_count += 1
  # If 100 event commands ran
  if @loop_count > 100
    # Call Graphics.update for freeze prevention
    Graphics.update
    @loop_count = 0
  end
  # If map is different than event startup time
  if $game_map.map_id != @map_id
    # Change event ID to 0
    @event_id = 0
  end
  # If a child interpreter exists
  if @child_interpreter != nil
    # Update child interpreter
    @child_interpreter.update
    # If child interpreter is finished running
    unless @child_interpreter.running?
	  # Delete child interpreter
	  @child_interpreter = nil
    end
    # If child interpreter still exists
    if @child_interpreter != nil
	  return
    end
  end
  # If waiting for message to end
  if @message_waiting
    return
  end
  # If waiting for ANY move to end
  if @move_route_waiting
    # If player is forcing move route and not repeating (BUGFIX)
    if $game_player.move_route_forcing and
	  not $game_player.move_route.repeat and
	  not ($game_player.move_route_wait_excluded and $game_player.wait_count > 0)
	  return
    end
    # Loop (map events)
    for event in $game_map.events.values
	  # Interpreter Bugfix - Allows Events to be Ignored with move_route_wait_excluded flag
	  if event.move_route_forcing and
		 event.move_route_wait_excluded
	    # Just skip this event because it is excluded, look at next event
	    next
	  end
	  # If this event is forcing but not repeating move route (BUGFIX)
	  #One Line of Code needed to be fixed.  Added "and not event.move_route.repeat"
	  if event.move_route_forcing and not event.move_route.repeat
	    # don't do anything else
	    return
	  end
    end
    # Clear move end waiting flag
    @move_route_waiting = false
  end
  # If waiting for button input
  if @button_input_variable_id > 0
    # Run button input processing
    input_button
    return
  end
  # If waiting
  if @wait_count > 0
    # Decrease wait count
    @wait_count -= 1
    return
  end
  # If an action forcing battler exists
  if $game_temp.forcing_battler != nil
    return
  end
  # If a call flag is set for each type of screen
  if $game_temp.battle_calling or
	 $game_temp.shop_calling or
	 $game_temp.name_calling or
	 $game_temp.menu_calling or
	 $game_temp.save_calling or
	 $game_temp.gameover
    return
  end
  # If list of event commands is empty
  if @list == nil
    # If main map event
    if @main
	  # Set up starting event
	  setup_starting_event
    end
    # If nothing was set up
    if @list == nil
	  return
    end
  end
  # If return value is false when trying to execute event command
  if execute_command == false
    return
  end
  # Advance index
  @index += 1
   end
 end
end

 #----------------------------------------------------------------------------
 # * Game Event
 #----------------------------------------------------------------------------
class Game_Event

 if Interpreter.method_defined? ('pathfind')
   # Adds same definition of pathfind to Interpreter to Game_Event, simpler for non coders
   def pathfind(x, y, *args)
  args[0] = @event.id if args[0] == nil
  args[1] = 0 if args[1] == nil
  # Add a simpler call for using as a script call
  Pathfind.new(Node.new(x, y), *args)
   end
 else
   def pathfind(*args)
  if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
    print "Pathfind Script Not Installed"
  end
   end
 end
 # Tell Mappers this script call isnt available here
 def cat_to_player
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Call from Event Editor -> Scripts, instead of\nEvent Editor -> Set Move Route -> Scripts"
   end
 end
end
class Interpreter
 # Executed in Game_Caterpillar - Including here allows cmd to be run from
 # Event Editor -> Scripts and fit on the same line

 # --- THESE WORK LIKE ALIASES - NOT DEFINED HERE - JUST REDIRECTED TO APPROPRIATE SCRIPT ---
 # SET MOVE ROUTE Windows can also be Custom Move Route, both will work

 def fade_event(opacity, duration)
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Please call \"fade_event\" from\n",
	    "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
	    "instead of \n\"Edit Event\" -> Scripts Window"
   end
 end
 # Allows an Event to toward another Event, like Turn Toward Player, just with events
 # DEBUG Msg here indicates Mapper needs to call from the right window, however...
 def turn_toward_event(*args)
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Please call \"turn_toward_event(event_id)\" from\n",
	    "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
	    "instead of \n\"Edit Event\" -> Scripts Window"
   end
 end
 # Allows an Event to Turn Away From another Event, like Turn Away From Player, just with events
 # DEBUG Msg here indicates Mapper needs to call from the right window, however...
 def turn_away_from_event(*args)
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Please call \"turn_away_from_event(event_id)\" from\n",
	    "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
	    "instead of \n\"Edit Event\" -> Scripts Window"
   end
 end

 # Allows an Event to MOVE Toward another Event, like Move Toward Player, just with events
 # DEBUG Msg here indicates Mapper needs to call from the right window, however...
 def turn_away_from_event(*args)
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Please call \"move_toward_event(event_id)\" from\n",
	    "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
	    "instead of \n\"Edit Event\" -> Scripts Window"
   end
 end
 # Allows an Event to MOVE Away From another Event, like Move Away From Player, just with events
 # DEBUG Msg here indicates Mapper needs to call from the right window, however...
 def turn_away_from_event(*args)
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Please call \"move_away_from_event(event_id)\" from\n",
	    "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
	    "instead of \n\"Edit Event\" -> Scripts Window"
   end
 end
 # DEBUG Msg here indicates Mapper needs to call from the right window, however...
 def move_route_wait_exclude
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Please call \"move_route_wait_exclude\" from\n",
	    "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
	    "instead of \n\"Edit Event\" -> Scripts Window"
   end
 end

 # DEBUG Msg here indicates Mapper needs to call from the right window, however...
 def move_route_wait_include
   if $DEBUG and Game_Caterpillar::DISPLAY_DEVELOPER_ERRORS == true
  print "Please call \"move_route_wait_include\" from\n",
	    "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
	    "instead of \n\"Edit Event\" -> Scripts Window"
   end
 end 

 # Moves the whole Caterpillar to the Players position, then Clears Move Route
 def cat_to_player
   $game_system.caterpillar.cat_to_player
 end

 # Clears all Cat Actors Moves - Caterpillar can be Emulated with Events for several steps.
 def clear_moves
   $game_system.caterpillar.clear_moves
 end
 # Pops the last Move off, use for preventing Character Overlap
 def move_pop
   $game_system.caterpillar.move_pop
 end
 # Turns all Cat Actors to the same direction as the Player - Useful during Transport
 def orient_to_player
   $game_system.caterpillar.orient_to_player
 end
 # Turns all Cat Actors to face an Event.  Works like Turn Toward Player, but for All Cat Actors
 def turn_cat_toward_event(event_id, repeat = false)
   # Pass data straight thru to the right method with right args
   $game_system.caterpillar.turn_cat_toward_event(event_id, repeat)
 end

 # Turns all Cat Actors to face an Event.  Works like Turn Toward Player, but for All Cat Actors
 def turn_cat_away_from_event(event_id, repeat = false)
   # Pass data straight thru to the right method with right args
   $game_system.caterpillar.turn_cat_away_from_event(event_id, repeat)
 end

 # Forces all Cat Actors to have a Walk Animation, regardless if Dead or Not
 #  - Use with Dead_Dont_Walk GAME SWITCH OFF
 def force_walk
   # Pass data straight thru to the right method
   $game_system.caterpillar.force_walk
 end

 # Forces all Cat Actors to be Opaque (255), regardless if Dead or Not
 #  - Use with Dead_Dont_Walk GAME SWITCH OFF
 def force_ghost_to_opaque
   # Pass data straight thru to the right method
   $game_system.caterpillar.force_opaque
 end

 # Executes force_walk and force_ghost_to_opaque in one line of Script
 def force_dead_to_normal
   # Pass data straight thru to the right method
   $game_system.caterpillar.force_dead_to_normal
 end
 # Deletes a move you dont want the rest of the Caterpillar to Follow
 def delete_last_move
   # Pass data straight thru to the right method with right args
   $game_system.caterpillar.del_last_move
 end

 # Single - Deletes any Forced Move Routes (where you use an Event to Set a Move Route)
 def clear_actor_force_move_route(actor)
   $game_system.caterpillar.clear_actor_force_move_route(actor)
 end
 # Party - Deletes any Forced Move Routes (where you use an Event to Set a Move Route)
 def clear_cat_force_move_routes
   $game_system.caterpillar.clear_cat_force_move_routes
 end

end

 

 

I know I overran on many lines in commenting. Problem is at line 1990 or so inside def "check_move_route_wait_exclude(event)" and I believe the property should be initiialized so not sure why I am not able to read it, although it appears I can assign a new property at that point like it doesnt exist at all. The property is initialized before that (and script works fine) and I set to always be false unless event.name.gsub includes \move_route_wait_exclude in the name, but can never read that just initialized property... Why is that?

 

I'll explain more on what it does in the Demo, but got to head to work...

Share this post


Link to post
Share on other sites
  • 0

@foreverZero

 

Ran into a problem (im sure I caused) in pathfinding, where running into something in your way, then transferring seems to cause "Stack Level Too Deep" if pathfind is called again. However, for anyone that might be able to answer, did I do anything obvious that might cause the stack to crash?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...