[XP] Heretics Movement Enhancements - Turn or Move Toward or Away From Events

Started by Heretic86, August 21, 2012, 11:53:06 pm

Previous topic - Next topic

Heretic86

Movement Enhancements - Turn or Move Toward or Away From Events
Authors: Heretic
Version: 1.0
Type: Custom Movement System
Key Term: Custom Movement System



Introduction

The Default Scripts include buttons to make an Event both Turn and Move Toward or Away From the Player, but lacked the ability to have Events have the same level of interactivity with each other.  This script will allow you to do these things without the need for complex eventing to accomplish the same thing.


Features


  • Turn or Move an Event (or Player) either Toward or Away From another Event

  • 100% Compatability with other scripts.

  • Error Messages will be provided in case an Event doesn't exist instead of Crashing your game.




Screenshots

No Screenshots


Demo

http://www.775.net/~heretic/downloads/rmxp/MovementEnhancements.exe


Script

Spoiler: ShowHide

# ---------------------------------------------
# ----                                     ----
# ----  Heretics Movement Enhancements     ----
# ----  Version 1.0                        ----
# ----  Release Date: August 22nd, 2012    ----
# ----                                     ----
# ------------------------------------------------

# ---   Purpose  ---
#
# This script will allow you to have either the Player or an Event to interact
# with other Events.  The Default Scripts were only set up to have Events
# react to the Player, which is somewhat limiting.
#
# This script will be most useful during Cutscenes.  It is intended to help
# save you a lot of time from the complexity of trying to accomplish the same
# effects by using Events and Conditional Branches.
#
# The usefulness of this script becomes apparent if you have a Dynamic Cutscene
# where the Direction and Position of the Player and / or Events has not been
# predetermined.
#
#
# ---  Installation  ----
#
# Put it anywhere in between Main and Scene_Debug
#
#
# ---  Compatability  ----
# This script should be 100% with every script out there.  If you do run into
# a situation that this script isnt compatible, you probably dont even need it.
#
# Note:  Heretic's Caterpillar already has these features included.
#
#
# --- Usage  ---
#
# To use this script, you'll need to call the commands from the Correct Window.
# There are a couple of places in the Event Editor where you can call one of
# the Script Commands from.  The Script Commands need to be called from the
# Event Editor -> Set Move Route -> Scripts window.  The other Script Windows
# execute differently, so it needs to be done in a Move Route Script.
#
# - turn_toward_event(event_target_id)
# - turn_away_from_event(event_target_id)
# - move_toward_event(event_target_id)
# - move_away_from_event(event_target_id)
#
# The 'event_target_id' should be the Number of the Event that you are using
# the script to Turn or Move Toward or Away From.  You can use 0 to target
# the Player, but there is already a Button for that.  Examine the Events
# in the Demo for Examples.


class Game_Character
   #--------------------------------------------------------------------------
 # * Turn Towards Event (Player or Event)
 #--------------------------------------------------------------------------
 def turn_toward_event(event_target_id)
   # Check if the Event ID is requesting Player
   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]
   elsif not event_target_id.is_a?(Integer)
     if $DEBUG
       print "Warning: Problem in turn_toward_event(", event_target_id, ")\n",
             "\"", event_target_id, "\" should be an Event ID\n",
             "which is a Number!"
     end
     return
   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?
     if $DEBUG
       print "Warning: Problem in turn_toward_event(", event_target_id, ")\n",
             "The Event \"", event_target_id, "\" does not exist!"
     end
     # event_target_id isnt usable or Event doesnt exist, return if it is to
     # stop processing and prevent Game Crash
     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
   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]
   elsif not event_target_id.is_a?(Integer)
     if $DEBUG
       print "Warning: ",
             "Problem in turn_away_from_event(", event_target_id, ")\n",
             "\"", event_target_id, "\" should be an Event ID\n",
             "which is a Number!"
     end
     return      
   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?
     if $DEBUG
       print "Warning: ",
             "Problem in turn_away_from_event(", event_target_id, ")\n",
             "The Event \"", event_target_id, "\" does not exist!"
     end
     # event_target_id isnt usable or Event doesnt exist, return if it is to
     # stop processing and prevent Game Crash
     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]
   elsif not event_target_id.is_a?(Integer)
     if $DEBUG
       print "Warning: Problem in move_toward_event(", event_target_id, ")\n",
             "\"", event_target_id, "\" should be an Event ID\n",
             "which is a Number!"
     end
     return      
   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?
     if $DEBUG
       print "Warning: ",
             "Problem in move_toward_event(", event_target_id, ")\n",
             "The Event \"", event_target_id, "\" does not exist!"
     end        
     # event_target_id isnt usable or Event doesnt exist, return if it is to
     # stop processing and prevent Game Crash
     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]
   elsif not event_target_id.is_a?(Integer)
     if $DEBUG
       print "Warning: ",
             "Problem in move_away_from_event(", event_target_id, ")\n",
             "\"", event_target_id, "\" should be an Event ID\n",
             "which is a Number!"
     end
     return        
   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?
     if $DEBUG
       print "Warning: ",
             "Problem in move_away_from_event(", event_target_id, ")\n",
             "The Event \"", event_target_id, "\" does not exist!"
     end        
     # event_target_id isnt usable or Event doesnt exist, return if it is to
     # stop processing and prevent Game Crash
     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 event or 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
end

# This section isnt necessary, but it is useful for someone that doesn't call
# the script from the right window.  The other problem is that using something
# like $game_map.events[@event_id].turn_toward_event(event_target_id) from the
# Interpreter class will cause the event to return to its @original_direction
# at the end of script execution, so the direction is not maintained, hence
# the need of a Move Route to run the script.  That and I am just too lazy
# to write in anything to change @original_direction


class Interpreter
 
 # Allows an Event to TURN 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_toward_event(*args)
   if $DEBUG
     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 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
     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 move_toward_event(*args)
   if $DEBUG
     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 move_away_from_event(*args)
   if $DEBUG
     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
end



Instructions

Put anywhere in between Scene_Debug and Main.


Compatibility

If you use Heretic's Caterpillar, these features are already built in.  Other than that, this script should be 100% compatible with every script out there.


Author's Notes

Legalese:  This software may not, in whole or in any part, be copied, reproduced, transmitted, translated (into any language, natural or computer), stored in a retrieval system, reduced to any electronic medium or machine readable format, or by any other form or means without prior consent, in writing, from, oh who am I kidding?  Besides, these legal threats are empty.  You can do what ever you want to with this script.  



I dont have a copy of VX or VXA to test this script out on, but I believe it will run on those as well.  If someone wouldnt mind letting me know if they work or not, it would be appreciated.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Heretic86

If anyone has the opportunity, would you mind testing this script out on VX and VXA?  I believe it will be compatible, but cant verify since I dont have either VX or VXA...

PS - Thanks Blizzard!
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

karrade

Quote from: Heretic86 on August 24, 2012, 07:46:24 am
If anyone has the opportunity, would you mind testing this script out on VX and VXA?  I believe it will be compatible, but cant verify since I dont have either VX or VXA...

PS - Thanks Blizzard!


Just to confirm, using Ace, I receive the error:

Script 'Game_Character' line 180: NoMethodError occurred.
Undefined method 'turn_right' for #<Game_Event:0x9bd94a4>

I am using it as a move route script, on its own. The ID is correct, its on the same map. I've tried autorun and parallel process.

This is what the two lines of script look like in the move route.

turn_toward_event(046)
move_toward_event(046)

Thank you for any help.

LiTTleDRAgo

edited: ShowHide
# ---------------------------------------------
# ----                                     ----
# ----  Heretics Movement Enhancements     ----
# ----  Version 1.0                        ----
# ----  Release Date: August 22nd, 2012    ----
# ----                                     ----
# ------------------------------------------------

# ---   Purpose  ---
#
# This script will allow you to have either the Player or an Event to interact
# with other Events.  The Default Scripts were only set up to have Events
# react to the Player, which is somewhat limiting.
#
# This script will be most useful during Cutscenes.  It is intended to help
# save you a lot of time from the complexity of trying to accomplish the same
# effects by using Events and Conditional Branches.
#
# The usefulness of this script becomes apparent if you have a Dynamic Cutscene
# where the Direction and Position of the Player and / or Events has not been
# predetermined.
#
#
# ---  Installation  ----
#
# Put it anywhere in between Main and Scene_Debug
#
#
# ---  Compatability  ----
# This script should be 100% with every script out there.  If you do run into
# a situation that this script isnt compatible, you probably dont even need it.
#
# Note:  Heretic's Caterpillar already has these features included.
#
#
# --- Usage  ---
#
# To use this script, you'll need to call the commands from the Correct Window.
# There are a couple of places in the Event Editor where you can call one of
# the Script Commands from.  The Script Commands need to be called from the
# Event Editor -> Set Move Route -> Scripts window.  The other Script Windows
# execute differently, so it needs to be done in a Move Route Script.
#
# - turn_toward_event(event_target_id)
# - turn_away_from_event(event_target_id)
# - move_toward_event(event_target_id)
# - move_away_from_event(event_target_id)
#
# The 'event_target_id' should be the Number of the Event that you are using
# the script to Turn or Move Toward or Away From.  You can use 0 to target
# the Player, but there is already a Button for that.  Examine the Events
# in the Demo for Examples.
VX = defined?(Window_ActorCommand)
VXA = defined?(Window_BattleActor)
class Game_Character
    #--------------------------------------------------------------------------
  # * Turn Towards Event (Player or Event)
  #--------------------------------------------------------------------------
  def turn_toward_event(event_target_id)
    # Check if the Event ID is requesting Player
    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]
    elsif event_target_id.is_a?(Game_Character)
      event_target = event_target_id
    elsif not event_target_id.is_a?(Integer)
      if $DEBUG || $TEST
        print "Warning: Problem in turn_toward_event(", event_target_id, ")\n",
              "\"", event_target_id, "\" should be an Event ID\n",
              "which is a Number!"
      end
      return
    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?
      if $DEBUG || $TEST
        print "Warning: Problem in turn_toward_event(", event_target_id, ")\n",
              "The Event \"", event_target_id, "\" does not exist!"
      end
      # event_target_id isnt usable or Event doesnt exist, return if it is to
      # stop processing and prevent Game Crash
      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
    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]
    elsif event_target_id.is_a?(Game_Character)
      event_target = event_target_id
    elsif not event_target_id.is_a?(Integer)
      if $DEBUG || $TEST
        print "Warning: ",
              "Problem in turn_away_from_event(", event_target_id, ")\n",
              "\"", event_target_id, "\" should be an Event ID\n",
              "which is a Number!"
      end
      return     
    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?
      if $DEBUG || $TEST
        print "Warning: ",
              "Problem in turn_away_from_event(", event_target_id, ")\n",
              "The Event \"", event_target_id, "\" does not exist!"
      end
      # event_target_id isnt usable or Event doesnt exist, return if it is to
      # stop processing and prevent Game Crash
      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]
    elsif event_target_id.is_a?(Game_Character)
      event_target = event_target_id
    elsif not event_target_id.is_a?(Integer)
      if $DEBUG || $TEST
        print "Warning: Problem in move_toward_event(", event_target_id, ")\n",
              "\"", event_target_id, "\" should be an Event ID\n",
              "which is a Number!"
      end
      return     
    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?
      if $DEBUG || $TEST
        print "Warning: ",
              "Problem in move_toward_event(", event_target_id, ")\n",
              "The Event \"", event_target_id, "\" does not exist!"
      end       
      # event_target_id isnt usable or Event doesnt exist, return if it is to
      # stop processing and prevent Game Crash
      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]
    elsif event_target_id.is_a?(Game_Character)
      event_target = event_target_id
    elsif not event_target_id.is_a?(Integer)
      if $DEBUG || $TEST
        print "Warning: ",
              "Problem in move_away_from_event(", event_target_id, ")\n",
              "\"", event_target_id, "\" should be an Event ID\n",
              "which is a Number!"
      end
      return       
    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?
      if $DEBUG || $TEST
        print "Warning: ",
              "Problem in move_away_from_event(", event_target_id, ")\n",
              "The Event \"", event_target_id, "\" does not exist!"
      end       
      # event_target_id isnt usable or Event doesnt exist, return if it is to
      # stop processing and prevent Game Crash
      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 event or 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
 
  if VXA
    def move_up(*args)    move_straight(8) end
    def move_down(*args)  move_straight(2) end
    def move_left(*args)  move_straight(4) end
    def move_right(*args) move_straight(6) end
    def print(*args)      msgbox(*args)    end
  end
 
end

# This section isnt necessary, but it is useful for someone that doesn't call
# the script from the right window.  The other problem is that using something
# like $game_map.events[@event_id].turn_toward_event(event_target_id) from the
# Interpreter class will cause the event to return to its @original_direction
# at the end of script execution, so the direction is not maintained, hence
# the need of a Move Route to run the script.  That and I am just too lazy
# to write in anything to change @original_direction

KLASS = (VX ? Game_Interpreter : Interpreter)
class KLASS
 
 
  def print(*args) msgbox(*args) end if VXA
  # Allows an Event to TURN 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_toward_event(*args)
    if $DEBUG || $TEST
      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"
    else
      get_character(0).turn_toward_event(*args)
    end
  end

  # Allows an Event to TURN 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 || $TEST
      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"
    else
      get_character(0).turn_away_from_event(*args)
    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 move_toward_event(*args)
    if $DEBUG || $TEST
      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"
    else
      get_character(0).move_toward_event(*args)
    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 move_away_from_event(*args)
    if $DEBUG || $TEST
      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"
    else
      get_character(0).move_away_from_event(*args)
    end
  end
end


by the way, 46 != 046

print 46 #=> 46
print 046 #=> 38