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.

[Resolved] New event

It's very complicated so I made a module to do this without having to code everything manually: http://www.owainc.net/scripts/macl_modu ... pawner.txt

This script requires the MACL 2.0 or greater to work, or getting methods from RGSS.Map out of the MACL to make it work.

It is a very complicated process. Without using this, you'll need to look into the help file under the data structure under RPG::Event and all sub-classes.

If you need help, ask and I'll do my best to help you.
 

Caesum

Member

Sorry for doublepost, but I'm reading instruction, good, fine, but I am too stupid to understand XD Where I must put def self. and the rest of script, in event, in this script?
Is there any demo? ;<
 
Ok. Start off with creating a new script section below the Event_Spawner. Just call it Event Spawner::Events

Put this in your code in that section:
Code:
module Event_Spawner::Events

 

 

 

 

end

Now first you need to figure out the setup for your events. Something like:
  • Character Graphic Name: 002-Fighter02
  • Event will spawn at 10,11
  • Event name will be: Spawned Event
  • We'll have a simple message: Hello \N[1]!

So we will add a new method to our new section. Let's just call this method sample_event_a.
Code:
module Event_Spawner::Events

  def self.sample_event_a

    # Event_Spawner codes will go in here

  end

end

Let's look at our process for creating events:
Code:
#   **** Basic Event Creation Procedure ****

#

#   1) Create Event

#   2) Set Page Graphics & Conditions

#   3) Set Page Conditions

#   4) Add New Page (If Needed)

#   5) Repeat Steps 2-4 as needed

#   6) End Event

#

#

#   **** Syntax Instructions *****

#

#   Creating Event

#    - Event_Spawner.create_event(x = 0, y = 0, name = '')

#

#   Adding Event Command

#    - Event_Spawner.add_event_command(code, parameters = [], indent = 0)

#

#   Setting Page Condition

#    - Event_Spawner.set_page_condition({<parameters>})

#      'switch1'    => switch_id

#      'switch2'    => switch_id

#      'selfswitch' => 'A', 'B', 'C' or 'D'

#      'variable'   => [variable_id, value]

#

#   Setting Page Graphic

#    - Event_Spawner.set_page_graphic(

#      'tileid'  => id

#      'c_name'  => 'character_filename'

#      'c_hue'   => 0..360

#      'dir'     => 2 : Down, 4 : Left, 6 : Right, 8 : Up

#      'pattern' => 0..3

#      'opacity' => 0..255

#      'blend'   => 0 : Normal, 1 : Addition, 2 : Subtraction

#

#   Setting Page Trigger

#    - Event_Spawner.set_page_trigger(trigger)

#      0 : Action Button, 1 : Contact With Player, 2 - Contact With Event

#      3 : Autorun,       4 : Parallel Processing

#

#   Set Page Move Settings

#    - Event_Spawner.set_page_move_settings({<parameters>})

#      'type'  => 0 : fixed, 1 : random, 2 : approach, 3 : custom).

#      'speed' => 1 : slowest ... 6 : fastest

#      'freq'  => 1 : lowest  ... 6 : highest

#      'route' => RPG::MoveRoute (See Generate Move Route)

#

#   Generate Move Route

#    - Event_Spawner.generate_move_route(list = [], repeat, skippable)

#      See Method Heading For List Parameters

So first, create our event. We add the create line in our method we made. The create command requires the events x, y and name of the new event. So our code now looks like:
Code:
module Event_Spawner::Events

  def self.sample_event_a

    Event_Spawner.create_event(10, 11, 'Spawned Event')

 

  end

end

Next we add our page graphics, conditions, trigger, etc. We have only need to set the page graphic, so we use the set page graphic command. Our code now looks like this:
Code:
module Event_Spawner::Events

  def self.sample_event_a

    Event_Spawner.create_event(10, 11, 'Spawned Event')

    Event_Spawner.set_page_graphic({'c_name' => '002-Fighter02'})

 

  end

end

Now we can add our event commands for this page. Take a look through the list * Event Command Code & Parameters.
Code:
#  ~~ Show Text

#    - Code       : 101 (Lines After First Line : 401)

#    - Parameters : ['Text Line']

Now that we have the code and parameter setup, we can add our event command to our method.
Code:
module Event_Spawner::Events

  def self.sample_event_a

    Event_Spawner.create_event(10, 11, 'Spawned Event')

    Event_Spawner.set_page_graphic({'c_name' => '002-Fighter02'})

    Event_Spawner.add_event_command(101, [''Hello \N[1]"])

 

  end

end

Our final step (if we aren't adding a new page(s)) is to end the event. Here you can decide if the event is going to be saved to the map. So our final code for this event is:
Code:
module Event_Spawner::Events

  def self.sample_event_a

    Event_Spawner.create_event(10, 11, 'Spawned Event')

    Event_Spawner.set_page_graphic({'c_name' => '002-Fighter02'})

    Event_Spawner.add_event_command(101, [''Hello \N[1]"])

    Event_Spawner.end_event

    # Or if you want to save the event: Event_Spawner.end_event(true)

  end

end

Now whenever you want to spawn this event on the map, make an event with the script command and just call:
Code:
Event_Spawner::Events.sample_event_a

If everything is setup correctly, you new event should be created. :thumb:
 

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