RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RESOLVED] how do you call a common event with script?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 82
We learn by living...
this is probably a snippet request.

I'm currently testing
Code: [Select]
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,

Code: [Select]
  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.
« Last Edit: March 09, 2011, 02:12:11 AM by shintashi »

***
Rep:
Level 82
We learn by living...
Code: [Select]
$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.
« Last Edit: March 06, 2011, 05:28:44 PM by shintashi »

***
Rep:
Level 82
We learn by living...
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

Code: [Select]
if Input.trigger?(32) #spacebar
$game_temp.common_event_id = 1
end

Although something like this

Code: [Select]
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,
Code: [Select]
$game_temp.common_event_id = 1

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

***
Rep:
Level 82
We learn by living...
I found this on the interwebs

Code: [Select]
   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.  :-[

***
Rep:
Level 82
We learn by living...
ive checked it and it appears lines 4 and 5 work