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 common events/events in script in RMVX

ok i guess i'm asking something very basic,but thats because i dont know much about scripting.the only thing i understand about ruby is that its an OOP and is similar to java.i'm familiar with java.

coming back to the context,i wanted to know what is the code to call a common event or event in a script.let me show a screenshot-



in the red box,i want to put a code that would call a common event using its id.what would be the code to do that?what would be the code if i call an event?
 
Whenever you are wanting to run a code based off an event command, always check the Interpreter (or Game_Interpreter in VX) class. In this case, you would find this block:
Code:
  #--------------------------------------------------------------------------

  # * Call Common Event

  #--------------------------------------------------------------------------

  def command_117

    common_event = $data_common_events[@params[0]]

    if common_event != nil

      @child_interpreter = Game_Interpreter.new(@depth + 1)

      @child_interpreter.setup(common_event.list, @event_id)

    end

    return true

  end

Now this may not be exactly what you need, but you can kinda figure out what you need to do from here.

Step 1: Get the common event data
Code:
common_event = $data_common_events[common_event_id]

Step 2: Create Game_Interpreter objet
Code:
@interpreter = Game_Interpreter.new

Step 3: Setup common event list into interpreter object
Code:
@interpreter.setup(common_event.list)

You will have to update your interpreter object however (Since you are making a custom scene to hold this data vs. using the map/battle/event interpreter).

So in your update method, make sure you have @interpreter.update.

However, it all depends on the commands in your common event though and exactly what you are trying to do.
 
actually i wanted a ready made code which would call the common event as i'm not familiar with ruby.if u take a closer look at the screenshot,the script is a definition of what would happen if i select a particular option.the common event that i've planned is that of changing party members.so when i select that particular option(the script) it would redirect to the common event.your help is appreciated.
 

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