Getting the ID of "This common event".
#7
That's evil punk.
You should tell when you get a solution.

Here is an XP solution where I overwrite setup_starting_event rather than alias it because the other way will be computationally more intensive.
Yes, the structure is not set up to allow the id of the running common event to be retrieved easily >_<
Code:
class Game_CommonEvent
  alias :zeriab_interpreter_id_refresh :refresh
  def refresh
    zeriab_interpreter_id_refresh
    @interpreter.common_event_id = @common_event_id unless @interpreter.nil?
  end
end

class Interpreter
  attr_writer :common_event_id
  def common_event_id
    @common_event_id = 0 if @common_event_id.nil?
    @common_event_id
  end
  
  #--------------------------------------------------------------------------
  # * Call Common Event
  #--------------------------------------------------------------------------
  alias :zeriab_common_id_command_117 :command_117
  def command_117
    zeriab_common_id_command_117
    if $data_common_events[@parameters[0]] != nil
      @child_interpreter.common_event_id = @parameters[0]
    end
    true
  end
  
  #--------------------------------------------------------------------------
  # * Starting Event Setup
  #--------------------------------------------------------------------------
  def setup_starting_event
    # Refresh map if necessary
    if $game_map.need_refresh
      $game_map.refresh
    end
    # If common event call is reserved
    if $game_temp.common_event_id > 0
      # Set up event
      setup($data_common_events[$game_temp.common_event_id].list, 0)
      ## Added
      self.common_event_id = $game_temp.common_event_id
      # Release reservation
      $game_temp.common_event_id = 0
      return
    end
    # Loop (map events)
    for event in $game_map.events.values
      # If running event is found
      if event.starting
        # If not auto run
        if event.trigger < 3
          # Clear starting flag
          event.clear_starting
          # Lock
          event.lock
        end
        # Set up event
        setup(event.list, event.id)
        return
      end
    end
    # Loop (common events)
    for common_event in $data_common_events.compact
      # If trigger is auto run, and condition switch is ON
      if common_event.trigger == 1 and
         $game_switches[common_event.switch_id] == true
        # Set up event
        setup(common_event.list, 0)
        ## Added
        self.common_event_id = common_event.id
        return
      end
    end
  end
end

*hugs*
[Image: ZeriabSig.png]
Reply }


Messages In This Thread
Getting the ID of "This common event". - by PK8 - 09-16-2009, 12:30 PM
Getting the ID of "This common event". - by Yin - 09-16-2009, 08:26 PM
Getting the ID of "This common event". - by PK8 - 09-16-2009, 10:42 PM
Getting the ID of "This common event". - by Yin - 09-16-2009, 11:18 PM
Getting the ID of "This common event". - by PK8 - 09-16-2009, 11:48 PM
Getting the ID of "This common event". - by Zeriab - 09-17-2009, 12:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Change event graphic? Bennerdeben 2 5,068 11-15-2020, 10:13 AM
Last Post: Bennerdeben
   Event collision problem with FPLE script ThePrinceofMars 2 5,776 11-11-2014, 06:30 PM
Last Post: ThePrinceofMars
   checking event coordinates? shintashi 4 7,571 05-28-2010, 03:34 PM
Last Post: Jaberwocky
   Tagging a Common Event to an accessory Shiroiyuki 3 5,919 05-07-2010, 02:54 PM
Last Post: Shiroiyuki
    Level Up Event Script daojones 8 12,587 04-09-2010, 06:48 PM
Last Post: daojones
   make event unpassable even by jumping mangamaniacs2064 4 7,505 04-05-2010, 11:57 AM
Last Post: mangamaniacs2064
   Issue with RTAB and battle event systems... samsonite789 4 7,587 11-08-2009, 07:21 AM
Last Post: Jaberwocky
   VX Show Picture Event Command Code? PK8 2 6,364 02-27-2009, 11:30 PM
Last Post: PK8



Users browsing this thread: 1 Guest(s)