Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How to call a common event on the Script Editor (RMXP)

I have a Common-Event-based Quest system. I used to called the Quest from a particular Skill or Item. But now I want to call the Quest from the Menu. But I couldn't figure out how to call the common event from the script editor. In short, what script lines are use to call the Common Event? Please help me thank you very much. :biggrin:
 
It'll be tricky.
Events only work on the map- even if you call the common event, it cannot start until you exit the menu.
I can think of 2 ways to solve this:
1. Make a menu using events (don't use Scene_Menu)
2. Close the menu after calling the common event.
You can always re-open the menu, by adding 'call menu screen' in the common event.

Script:
[rgss]class Interpreter
  def call_common_event(id)
    @parameters = [id]
    command_117
  end
end
 
class Game_System
  def call_common_event(id)
    @map_interpreter.call_common_event(id)
  end
end
[/rgss]

To call common event 1, use
[rgss]$game_system.call_common_event(1)
[/rgss]
 
I used the script below in Scene_Menu but it doesn't seem to work. I try to use 001 (the event ID number) and add the line "$scene = Scene_Map.new" after it but it still doesn't work.

I try put all of your first codes in there too but it doesn't work either. I'm a newbie at Ruby script, it's so confusing. :?:

Code:
when 3  # status

        # Play decision SE

        $game_system.se_play($data_system.decision_se)

        # Make status window active

        @command_window.active = false

        @status_window.active = true

        @status_window.index = 0

      

when 4  # QUEST

  $game_system.call_common_event(1)

 

      when 5  # end game

        # Play decision SE

        $game_system.se_play($data_system.decision_se)

        # Switch to end game screen

        $scene = Scene_End.new

      end

      return

    end

  end
 
Interesting. I tested it in scene_menu too, and it worked.


It works no matter what I do though. :huh:
first, it's 1 not 001, but it works either way.
I tested what happens if your common event is set to autorun/parallel + switch. Even when the switch is OFF it still calls the event (in parallel it'll only happen once).

Let's see..
Did you place the code in a new page above main?
A second, but unlikely, option is that one of your scripts has defined a call_common_event method and my code is above it.
try changing it to call_common_event2, and $game_system.call_common_event2(1)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top