Help - Search - Members - Calendar
Full Version: Event Touch
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
lildot
Is it possible to run an event when a specific event touches another? For example Event 1 touches Event 2 and runs the event, however when Event 3 touches Event 2 the event does not run
jimmyly
This is where Variables, Parallel Procress, and Conditional Branch Plays. Like When Event is on Map X.24 Y.33 Switch ON #23 to trigger the next event.


Note that "Event Touch" Means when the Event Touches the Player while "Player Touch" is when the Player touches the Event.
Night_Runner
Event Touch also runs if the player touches the event.... I've never really liked the options available under the trigger.... or the wording of "Event Touch"

Anyways, if lildot is still interested, I've made a script that makes "Event Touch" activate even if the touch is against another event.

CODE
#==============================================================================
# ** Night_Runner's Event Activating Event Script.
#------------------------------------------------------------------------------
# History:
#  Date Created: 12/Aug/10
#  Created for: lildot
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=44198
#
# Description:
#  This script is designed to allow events to run if they touch an event,
#   if the trigger scenario is 'Event Touch'.
#  The event that is touched will also have its ID recorded and stored
#   in a variable.
#
# How to install:
#  In your game, select Tools >> Script Editor. Along the left, scroll down to
#   Main, right click and insert a new area, and paste this on the right.
#
# Customization:
#  Line 51 defines which variable stores the ID of the event that is
#   being run into by the current event. By default, in-game variable
#   10 is set to the events ID.
#
#==============================================================================



#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  Edited to run events if they touch events and have Event Touch triggered.
#==============================================================================

class Game_Event
  #--------------------------------------------------------------------------
  # * Touch Event Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    # If event is running
    if $game_system.map_interpreter.running?
      return
    end
    # Check to see if a event is at (x, y)
    event_id = $game_map.check_event(x, y)
    # If trigger is [touch from event] and consistent with player coordinates
    if @trigger == 2 and ((x == $game_player.x and y == $game_player.y) or
                          event_id)
      # If starting determinant other than jumping is front event
      if not jumping? and not over_trigger?
        # Set the variable
        $game_variables[10] = event_id if not event_id.nil?
        # Start the event
        start
      end
    end
  end
end



#==============================================================================
# ** End of Script.
#==============================================================================


If Event 1 runs into Event 2, Variable 10 (10 can be changed on line 51) will have the value 2 stored into it, which can be checked by a conditional branch to see if it should do anything smile.gif
lildot
Thanks for the help. It will help things along nicely. I'll try giving the script ago later tonight.

smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.