Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] how do you call a common event with script?

Started by shintashi, March 06, 2011, 05:38:01 AM

0 Members and 1 Guest are viewing this topic.

shintashi

this is probably a snippet request.

I'm currently testing

p $data_common_events[1].name


with success, but I haven't figured out how to actually trigger the event yet. Somehow I think the answer is in this mess,


  def command_117
    # Get common event
    common_event = $data_common_events[@parameters[0]]
    # If common event is valid
    if common_event != nil
      # Make child interpreter
      @child_interpreter = Interpreter.new(@depth + 1)
      @child_interpreter.setup(common_event.list, @event_id)
    end
    # Continue
    return true
  end


but I'm not sure which parts to keep and which parts to throw out.

shintashi

#1
$game_temp.common_event_id = 1

This works at least for script in regular events, but it does not do anything when called during the script editor from a class. I recognize the 'A" or "C" button is essentially activating it in events, so that the common even is activated by pushing space bar, talking to the event, etc., but I have yet to figure out the code that is connecting the snippet above to my keyboard actions. Literally, my "make it so" command is not working.

shintashi

so far I've able to determine the script that works inside a regular event, to call a common event, does not work inside something like

if Input.trigger?(32) #spacebar
$game_temp.common_event_id = 1
end


Although something like this


if Input.trigger?(32) #spacebar
    p $data_common_events[1].name
end


works fine, in determining the label of the common event. That's kind of odd because as I've said before, in eventing,

$game_temp.common_event_id = 1


Runs common event #1 efficiently and effectively, as if I had called it using stock eventing commands.

shintashi

I found this on the interwebs

   1. # If On Map : Replace id with common event id
   2. $game_temp.common_event_id = id
   3. # If in Battle : Replace id with common event id
   4. common_event = $data_common_events[id]
   5. $game_system.battle_interpreter.setup(common_event.list, 0)


line 2 definitely looks like what I came up with, and lines 4 & 5 look new, so i'll test those later today, but I've got classes in a few minutes so it will have to wait.  :-[

shintashi