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.

NON-SDK Event Spawner?

Hey people, I've been looking for a Non-SDK event spawner script. I really like Sephirothspawn's but in my project it's impossible to use SDK due to incompatibility. So I wonder if there's another one which I could use here.

I found this one, Sephiroth's as well, it's an old one. I took off all the SDK's things and it worked smoothly (I think xD)
Code:
#==============================================================================

# ** Event Spawner

#==============================================================================

# SephirothSpawn

# Version 1

# 2006-03-11

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

# ~ Instructions

#   - Create a call script with 

#       create_new_event(x, y, name)

#   - Set Page Commands *See Page Commands

#   - Set Event Commands *See Event Commands

#   - If needed, add pages with

#       create_new_page

#   - Repeat

#   - Finish Event With

#       finish_event

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

# * Basic Event Commands

# create_new_event(x, y, name)

# create_new_page

# finish_event

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

# * Page Commands

# set_event_graphic(character_name, character_hue, direction = 2, pattern = 0, opacity = 255, blend_type = 0, tile_id = 0) 

# set_event_move_type(type)

# set_event_move_speed(speed)

# set_event_move_frequency(frequency)

# set_event_walk_animation(truth)

# set_event_step_animation(truth)

# set_event_direction_fix(truth)

# set_event_phasing(truth)

# set_event_always_on_top(truth)

# set_event_trigger(trigger)

# set_event_condition_switch1_id(switch_id)

# set_event_condition_switch2_id(switch_id)

# set_event_condition_variable_id(variable_id)

# set_event_condition_variable_value(variable_value)

# set_event_condition_self_switch(switch_letter)

# set_event_move_route(list, repeate, skippble)

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

# * Event Commands

# set_event_command_show_message(message)

# set_event_command_input_number(variable_id, max_digits)

# set_event_command_message_options(position, showing)

# set_event_command_key_input_proc(variable_id)

# set_event_command_wait(frames)

# set_event_command_comment(comment)

# set_event_command_end_event_proc

# set_event_command_erase_event

# set_event_command_common_event(common_event_id)

# set_event_command_switch_opp(start_swith, end_switch, opp)

# set_event_command_variable_opp(lower, upper, opperation, opperand, *params)

# set_event_command_local_switch_opp(l_switch, opp)

# set_event_command_timer_opp(opp, mins, secs)

# set_event_command_change_money(add, constant, param)

# set_event_command_change_items(item_id, add, constant, par)

# set_event_command_change_weapons(w_id, add, constant, par)

# set_event_command_change_armors(a_id, add, constant, par)

# set_event_command_change_party(actor_id, add, initial)

# set_event_command_change_windowskin(skin_name)

# set_event_command_change_battle_bgm(bgm_filename)

# set_event_command_change_victory_me(me_filename)

# set_event_command_dis_allow_saving(opp)

# set_event_command_dis_allow_menu(opp)

# set_event_command_dis_allow_encounters(opp)

# set_event_command_teleport(type, map_id, x, y, face, fade)

# set_event_command_change_event_location(event_id, direct, x, y, facing)

# set_event_command_scroll_map(dir, tiles, speed)

# set_event_command_change_map_settings(setting, file_name, hue, op, blend_type, mag, s_x, s_y)

# set_event_command_tint_fog(r, g, b, gr, frames)

# set_event_command_change_fog_opacity(opacity, frames)

# set_event_command_show_animation(target, animation_id)

# set_event_command_change_hero_trans(opp)

# set_event_command_move_event(target, move_array)

# set_event_command_porceed_mvmt

# set_event_command_prepare_transition

# set_event_command_execute_transition(transition_file)

# set_event_command_tint_screen(r, g, b, gr, frames)

# set_event_command_flash_screen(r, g, b, gr, frames)

# set_event_command_shake_screen(strength, speed, duration)

# set_event_command_show_picture(pid_id, pic_file, location, constant, x, y, x_mag, y_mag, opacity, blend_type)

# set_event_command_move_picture(pid_id, frames5, location, constant, x, y, x_mag, y_mag, opacity, blend_type)

# set_event_command_rotate_picture(picture_id, speed)

# set_event_command_tint_picture(pict_id, r, g, b, gr, frames)

# set_event_command_erase_picture(picture_id)

# set_event_command_weather_effects(effect, strength, frames)

# set_event_command_play_bgm(bgm_filename)

# set_event_command_fade_bgm(frames)

# set_event_command_play_bgs(bgs_filename)

# set_event_command_fade_bgs(frames)

# set_event_command_memorize_bgm_bgs

# set_event_command_play_memorize_bgm_bgs

# set_event_command_play_me(me_filename)

# set_event_command_play_se(se_filename)

# set_event_command_stop_se

# set_event_command_enemy_encounter(troop_id, can_escape, can_lose)

# set_event_command_open_shop_window(inventory)

# set_event_command_enter_hero_name(hero_id, max_charas)

# set_event_command_change_hp(actor_id, added, constant, par, can_kill)

# set_event_command_change_sp(a_id, added, constant, par)

# set_event_command_change_status(actor_id, added, state_id)

# set_event_command_complete_healing(target)

# set_event_command_change_experience(target, added, constant, param)

# set_event_command_change_level(target, added, constant, param)

# set_event_command_change_base_stats(actor_id, stat, added, constant, param)

# set_event_command_change_skills(actor_id, learn, skill_id)

# set_event_command_change_equipped_items(actor_id, equipment_type, equip_id)

# set_event_command_change_hero_name(actor_id, name_text)

# set_event_command_change_hero_class(actor_id, class_id)

# set_event_command_change_hero_graphic(actor_id, character_file, character_hue, battler_file, battler_hue)

# set_event_command_open_main_menu

# set_event_command_open_save_menu

# set_event_command_gameover

# set_event_command_return_to_title

# set_event_command_call_script(script_string)

#==============================================================================

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

# * SDK Log Script

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

#SDK.log('Event Spawner', 'SephirothSpawn', 1, '03.11.06')

 

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

# * Begin SDK Enable Test

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

#if SDK.state('Event Spawner') == true

 

#==============================================================================

# ** Game_Map

#==============================================================================

 

class Game_Map

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

  # * Add Event

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

  def add_event(id, event)

    unless @events.has_key?(id)

      @events[id] = Game_Event.new(@map_id, event)

    end

  end

end

 

#==============================================================================

# ** Spriteset_Map

#==============================================================================

 

class Spriteset_Map

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

  # * Add Event

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

  def add_event(event_id)

    sprite = Sprite_Character.new(@viewport1, $game_map.events[event_id])

    @character_sprites.push(sprite)

  end

end

 

#==============================================================================

# ** Scene_Map

#==============================================================================

 

class Scene_Map

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

  # * Public Instance Variables

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

  attr_accessor :spriteset

end

 

#=============================================================================

# ** Interpreter

#=============================================================================

 

class Interpreter

  

  #===========================================================================

  # *** Basic Event Commands

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

  # Commands are for creating, adding pages, & finishing an event

  #===========================================================================

  

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

  # * Create New Event

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

  def create_new_event(x, y, name)

    # Creates New Event Variable

    @event_spawner = RPG::Event.new(x, y)

    # Sets Event Id

    id = 1

    while $game_map.events.has_key?(id)

      id += 1

    end

    @event_spawner.id = id

    # Sets Events Name

    @event_spawner.name = name

  end

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

  # * Create New Page

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

  def create_new_page

    # Adds Event Page

    @event_spawner.pages << RPG::Event::Page.new

  end

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

  # * Finish Event

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

  def finish_event

    # Adds Into Game_Map # Events

    $game_map.add_event(@event_spawner.id, @event_spawner)

    # Adds Into Spriteset_Map

    $scene.spriteset.add_event(@event_spawner.id)

    # Deletes Event Spawner Information

    @event_spawner = nil

  end

  

  #===========================================================================

  # *** Event Page Options

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

  # Commands are for options you control on the main page in the event wizard

  #===========================================================================

  

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

  # * Set Event Graphic

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

  def set_event_graphic(character_name, character_hue, direction = 2, pattern = 0, opacity = 255, blend_type = 0, tile_id = 0) 

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Creates New Graphic Setup

    graphic = RPG::Event::Page::Graphic.new

    # Sets Graphic Character File

    graphic.character_name, graphic.character_hue = character_name, character_hue

    # Sets Character File Properties

    graphic.direction, graphic.pattern = direction, pattern 

    # Sets Graphic Pic Properties

    graphic.opacity, graphic.blend_type = opacity, blend_type

    # Sets Tile ID

    graphic.tile_id = tile_id

    # Sets Last page Graphic

    last_page.graphic = graphic

  end

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

  # * Set Event Move Type

  #     (0: None, 1: Random, 2: Follow Hero, 3: Custom)

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

  def set_event_move_type(type = 0)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.move_type = type

  end

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

  # * Set Event Move Speed

  #     (1: Slowest, 6: Fastest)

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

  def set_event_move_speed(speed = 1)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.move_speed = speed

  end

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

  # * Set Event Move Frequency

  #     (1: Lowest, 6: Highest)

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

  def set_event_move_frequency(frequency = 1)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.move_frequency = frequency

  end

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

  # * Set Event Walk Animation

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

  def set_event_walk_animation(truth = true)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.walk_anime = truth

  end

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

  # * Set Event Step Animation

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

  def set_event_step_animation(truth = false)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.step_anime = truth

  end

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

  # * Set Event Direction Fix

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

  def set_event_direction_fix(truth = false)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.direction_fix = truth

  end

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

  # * Set Event Phasing

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

  def set_event_phasing(truth = false)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.through = truth

  end

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

  # * Set Event Always on Top

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

  def set_event_always_on_top(truth = false)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.always_on_top  = truth

  end

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

  # * Set Event Trigger

  #     (0: action button, 1: contact with player, 2: contact with event,

  #      3: autorun, 4: parallel processing)

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

  def set_event_trigger(trigger = 0)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.trigger  = trigger

  end

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

  # * Set Event Condition: Switch 1 ID

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

  def set_event_condition_switch1_id(switch_id = 1)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.condition.switch1_id  = switch_id

  end

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

  # * Set Event Condition: Switch 2 ID

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

  def set_event_condition_switch2_id(switch_id = 1)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.condition.switch2_id  = switch_id

  end

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

  # * Set Event Condition: Variable ID

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

  def set_event_condition_variable_id(variable_id = 1)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.condition.variable_id  = variable_id

  end

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

  # * Set Event Condition: Variable Value

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

  def set_event_condition_variable_value(variable_value = 1)

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.condition.variable_value  = variable_value

  end

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

  # * Set Event Condition: Self Switch

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

  def set_event_condition_self_switch(switch_letter = 'A')

    # Gets Events Last Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Move Type

    last_page.condition.self_switch_ch  = switch_letter

  end

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

  # * Set Event Move Route

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

  def set_event_move_route(list = [], repeat = true, skippble = false)

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Sets Event Repeat And Skip Funcions

    last_page.move_route.repeat = repeat

    last_page.move_route.repeat = skippble

    # Sets Event Move Route

    for move_command in list

      # Splits

      parameters = []

      case move_command

      when 'Down'        ; code = 1

      when 'Left'        ; code = 2

      when 'Right'       ; code = 3

      when 'Up'          ; code = 4

      when 'Down-Left'   ; code = 5

      when 'Down-Right'  ; code = 6

      when 'Up-Left'     ; code = 7

      when 'Up-Right'    ; code = 8

      when 'Random'      ; code = 9

      when 'Toward Hero' ; code = 10

      when 'Away Hero'   ; code = 11

      when 'Forward'     ; code = 12

      when 'Backward'    ; code = 13

      when 'Face Down'   ; code = 16

      when 'Face Left'   ; code = 17

      when 'Face Right'  ; code = 18

      when 'Face up'     ; code = 19

      when 'Turn 90 Right'  ; code = 20

      when 'Turn 90 Left'   ; code = 21

      when '180 Turn'       ; code = 22

      when 'R/L 90 Turn'    ; code = 23

      when 'Face Random'    ; code = 24

      when 'Face Hero'      ; code = 25

      when 'Face Away Hero' ; code = 26

      else

        if move_command.include? 'Jump'

          x = move_command.slice(move_command.index('(')..move_command.index(',')).delete('(').delete(',').to_i

          y = move_command.slice(move_command.index(',')..move_command.index(')')).delete(')').delete(',').to_i

          code, parameters = 14, [x, y]

        elsif move_command.include? 'Wait' ||

          move_command.sub(/(\d+)/, '')

          code, parameters = 15, [$1]

        elsif move_command.include? 'Switch On'

          move_command.sub(/(\d+)/, '')

          code, parameters = 27, [$1]

        elsif move_command.include? 'Switch Off'

          move_command.sub(/(\d+)/, '')

          code, parameters = 28, [$1]

        elsif move_command.include? 'Change Speed'

          move_command.sub(/(\d+)/, '')

          code, parameters = 29, [$1]

        elsif move_command.include? 'Chagne Frequency'

          move_command.sub(/(\d+)/, '')

          code, parameters = 30, [$1]

        elsif move_command.include? 'Play SE'

          move_command.sub(/(\d+)/, '')

          code, parameters = 44, [$1]

        elsif move_command.include? 'Call Script'

          move_command.sub(/\((\w+)\)/, '')

          code, parameters = 45, [$1]

        end

      end

      # Crates New MoveCommand

      move_command = RPG::MoveCommand.new

      # Sets MoveCommand Properties

      move_command.parameters = parameters

      move_command.code = code

      # Adds MoveCommand to List

      last_page.move_route.list << move_command

    end

  end

  

  #===========================================================================

  # *** Event Commands

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

  # These Commands are for adding event commands to your event

  #===========================================================================

  

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

  # * Clear Empty Event Commands

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

  def clear_empty_event_commands

    # Gets Events List Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Deletes Blank Event Commands

    for command in last_page.list

      if command.code == 0 || command.parameters == []

        last_page.list.delete(command)

      end

    end

  end

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

  # * Set Basic Event Commands

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

  def set_basic_event_commands(code, parameters = [])

    # Gets Events List Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Deletes Blank Event Commands

    clear_empty_event_commands

    # Creates Event Command

    command = RPG::EventCommand.new

    command.code = code

    command.parameters = parameters

    # Adds Event Command

    last_page.list << command

    # Adds Blank Command

    last_page.list << RPG::EventCommand.new

  end

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

  # * Set Event Command : Show Message

  #   ~ message = ['Line 1', 'Line 2', 'Line 3', 'Line 4']

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

  def set_event_command_show_message(message = [])

    # Gets Events List Page

    last_page = @event_spawner.pages[@event_spawner.pages.size - 1]

    # Deletes Blank Event Commands

    clear_empty_event_commands

    # Adds Message Commands

    for i in 0...message.size

      # Creates Event Command

      command = RPG::EventCommand.new

      command.code = (i == 0 ? 101 : 401)

      command.parameters = [message[i]]

      # Adds Event Command

      last_page.list << command

    end

    # Adds Blank Command

    last_page.list << RPG::EventCommand.new

  end

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

  # * Set Event Command : Input Number

  #   ~ variable_id = $game_variable

  #   ~ max_digits = maxium number of digits

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

  def set_event_command_input_number(variable_id = 1, max_digits = 1)

    set_basic_event_commands(103, [variable_id, max_digits])

  end

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

  # * Set Event Command : Message Display Options

  #   ~ position = (0: Top, 1: Middle, 2: Bottom)

  #   ~ showing = (0: Show Window Background, 1: Dont Show)

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

  def set_event_command_message_options(position = 2, showing = 0)

    set_basic_event_commands(104, [position, showing])

  end

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

  # * Set Event Command : Key Input Processing

  #   ~ variable_id = $game_variable

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

  def set_event_command_key_input_proc(variable_id = 1)

    set_basic_event_commands(105, [variable_id])

  end

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

  # * Set Event Command : Wait

  #   ~ frames = number of frames ( Approx. 20 / sec)

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

  def set_event_command_wait(frames = 20)

    set_basic_event_commands(106, [frames])

  end

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

  # * Set Event Command : Comment

  #   ~ comment = comment for event

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

  def set_event_command_comment(comment = '')

    set_basic_event_commands(108, [comment])

  end

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

  # * Set Event Command : End Event Processing

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

  def set_event_command_end_event_proc

    set_basic_event_commands(115)

  end

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

  # * Set Event Command : Erase Event

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

  def set_event_command_erase_event

    set_basic_event_commands(116)

  end

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

  # * Set Event Command : Erase Event

  #   ~ common_event_id = Command Event ID

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

  def set_event_command_common_event(common_event_id)

    set_basic_event_commands(117, [common_event_id])

  end

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

  # * Set Event Command : Switch Opperation

  #   ~ start_swith = Starting Switch

  #   ~ end_switch = End Switch

  #   ~ opp = (0: true, 1: false)

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

  def set_event_command_switch_opp(start_swith = 1, end_switch = 1, opp = 0)

    set_basic_event_commands(121, [start_swith, end_switch, opp])

  end

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

  # * Set Event Command : Variable Opperation

  #   ~ lower : lower boundary of variables

  #   ~ upper : upper boundary of variables

  #   ~ opperation : (0: Set, 1: +, 2: -, 3: *, 4: /, 5: %)

  #   ~ opperand : (0: Constant, 1: Variable, 2: Random Number, 3: Item,

  #                 4: Hero, 5: Monster, 6: Sprite, 7: Other)

  #   ~ opperand_params

  #       - Constant : #

  #       - Variable : Variable ID

  #       - Random Number : X..Y

  #       - Item : Item ID

  #       - Hero : Hero ID, Stat (0: HP, 1: SP, 2: Max HP, 3: Max SP, 4: Str,

  #                               5: Dex, 6: Agi, 7: Int, 8: Atk, 9: PDef,

  #                               10: MDef, 11: Eva)

  #       - Monster : Monster ID, Stat (As Above))

  #       - Event Sprite : Event ID (-1: Self, 0: This Event, 1-X: Event ID),

  #                        Tile (0: X Tile, 1: Y Tile, 2: Face, 3: Screen X,

  #                              4: Screen Y, 5:Terrain)

  #       - Other : (0: Map ID, 1: Party Size, 2: Money, 3: # of Steps,

  #                  4: Timer in Secs, 5: # of Saves)

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

  def set_event_command_variable_opp(lower = 1, upper = 1, opperation = 0,

      opperand = 0, *params)

    # Sets up Parameters

    params =  [lower, upper, opperation, opperand]

    params.each {|x| p << x}

    set_basic_event_commands(122, params)

  end

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

  # * Set Event Command : Local Switch Opperation

  #   ~ l_switch = ('A', 'B', 'C', 'D')

  #   ~ opp = (0: true, 1: false)

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

  def set_event_command_local_switch_opp(l_switch = 'A', opp = 0)

    set_basic_event_commands(123, [l_switch, opp])

  end

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

  # * Set Event Command : Timer Opperation

  #   ~ opp = (0: start, 1: stop)

  #   ~ mins = Total minutes

  #   ~ secs = Total Seconds

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

  def set_event_command_timer_opp(opp = 0, mins = 0, secs = 0)

    set_basic_event_commands(124, (opp == 0 ? [0, mins * 60 + secs] : [1]))

  end

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

  # * Set Event Command : Change Money

  #   ~ add : (0: Add, 1: Subtract)

  #   ~ constant : (0: Constant, 1: variaible_id)

  #   ~ param : number or variable_id

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

  def set_event_command_change_money(add = 0, constant = 0, param = 0)

    set_basic_event_commands(125, [add, constant, param])

  end

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

  # * Set Event Command : Change Items

  #   ~ item_id : item id in database

  #   ~ add : (0: Add, 1: Subtract)

  #   ~ constant : (0: Constant, 1: variaible_id)

  #   ~ par : number or variable_id

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

  def set_event_command_change_items(item_id, add = 0, constant = 0, par = 0)

    set_basic_event_commands(126, [item_id, add, constant, par])

  end

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

  # * Set Event Command : Change Weapons

  #   ~ w_id : weapon id in database

  #   ~ add : (0: Add, 1: Subtract)

  #   ~ constant : (0: Constant, 1: variaible_id)

  #   ~ par : number or variable_id

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

  def set_event_command_change_weapons(w_id, add = 0, constant = 0, par = 0)

    set_basic_event_commands(127, [w_id, add, constant, par])

  end

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

  # * Set Event Command : Change Armors

  #   ~ a_id : armor id in database

  #   ~ add : (0: Add, 1: Subtract)

  #   ~ constant : (0: Constant, 1: variaible_id)

  #   ~ par : number or variable_id

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

  def set_event_command_change_armors(a_id, add = 0, constant = 0, par = 0)

    set_basic_event_commands(128, [a_id, add, constant, par])

  end

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

  # * Set Event Command : Change Party

  #   ~ actor_id : actor id in database

  #   ~ add : (0: Add, 1: Subtract)

  #   ~ initial : (1:initial state, 0:current state)

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

  def set_event_command_change_party(actor_id = 1, add = 0, initial = 0)

    set_basic_event_commands(129, [actor_id, add, initial])

  end

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

  # * Set Event Command : Change WindowSkin

  #   ~ skin_name : skin file name

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

  def set_event_command_change_windowskin(skin_name = '')

    set_basic_event_commands(131, [skin_name])

  end

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

  # * Set Event Command : Change Battle BGM

  #   ~ bgm_filename : BGM file name

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

  def set_event_command_change_battle_bgm(bgm_filename = '')

    # Creates Audio File

    a_file = RPG::AudioFile.new

    a_file.name = bgm_filename

    set_basic_event_commands(132, [name])

  end

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

  # * Set Event Command : Change Victory Me

  #   ~ me_filename : ME file name

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

  def set_event_command_change_victory_me(me_filename = '')

    # Creates Audio File

    a_file = RPG::AudioFile.new

    a_file.name = me_filename

    set_basic_event_commands(133, [a_file])

  end

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

  # * Set Event Command : Disallow / Allow Saving

  #   ~ opp = (0: true, 1: false)

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

  def set_event_command_dis_allow_saving(opp = 0)

    set_basic_event_commands(134, [opp])

  end

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

  # * Set Event Command : Disallow / Allow Menu

  #   ~ opp = (0: true, 1: false)

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

  def set_event_command_dis_allow_menu(opp = 0)

    set_basic_event_commands(135, [opp])

  end

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

  # * Set Event Command : Disallow / Allow Encounters

  #   ~ opp = (0: true, 1: false)

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

  def set_event_command_dis_allow_encounters(opp = 0)

    set_basic_event_commands(136, [opp])

  end

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

  # * Set Event Command : Teleport

  #   ~ location_type : (0: Specific Location, 1: Stored in Variables)

  #   ~ map_id : (Map ID or Variable ID)

  #   ~ X : (X or Variable ID)

  #   ~ Y : (X or Variable ID)

  #   ~ Face : (0: Retain Facing, 2: Down, 4: Left, 6: Right, 8: Up) 

  #   ~ fade : (0: Yes, 1: No). 

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

  def set_event_command_teleport(type, map_id, x, y, face, fade)

    set_basic_event_commands(201, [type, map_id, x, y, face, fade])

  end

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

  # * Set Event Command : Change Event Location

  #   ~ event_id : (0: This Event)

  #   ~ direct : (0: Direct, 1: Variables, 2: Another Event

  #   ~ x : (Constant X, Variable ID, or Event ID)

  #   ~ y : (Constant Y, Variable ID)

  #   ~ facing (0: Retain, 2: Down, 4: Left, 6: Right, 8: Up) 

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

  def set_event_command_change_event_location(event_id = 0, direct = 0,

                                                    x = 1, y = 1, facing = 0)

    set_basic_event_commands(202, [event_id, direct, x, y, facing])

  end

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

  # * Set Event Command : Scroll Map

  #   ~ dir : direction (2: Down, 4: Left, 6: Right, 8: Up)

  #   ~ tiles : number of tiles

  #   ~ speed : speed (1: Slowest, 6: Fastest)

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

  def set_event_command_scroll_map(dir = 2, tiles = 0, speed = 1)

    set_basic_event_commands(203, [dir, tiles, speed])

  end

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

  # * Set Event Command : Change Map Settings

  #   ~ setting : (0:Panorama, 1: Fog, 2: Battle Background)

  #   ~ file_name

  #   ~ hue : (0..360)

  # * For Fog Only

  #   ~ opacity : 0.255

  #   ~ blend_type : (0, 1, 2)

  #   ~ maginification

  #   ~ start_x

  #   ~ start_y

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

  def set_event_command_change_map_settings(setting = 0, file_name = '', 

                hue = 0, op = 255, blend_type = 0, mag = 1, s_x = 0, s_y = 0)

    params = [setting, file_name]

    params << hue if [0, 1].include?(setting)

    params.push(hue, op, blend_type, mag, s_x, s_y) if setting == 1

    set_basic_event_commands(204, params)

  end

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

  # * Set Event Command : Tint Fog

  #   ~ r, g, b = -255..255

  #   ~ gr = 0..255

  #   ~ frames = frames for transition

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

  def set_event_command_tint_fog(r = 0, g = 0, b = 0, gr = 0, frames = 20)

    set_basic_event_commands(205, [Tone.new(r, g, b, gr), frames])

  end

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

  # * Set Event Command : Change Fog Opacity

  #   ~ opacity = next opacity

  #   ~ frames = frames for transition

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

  def set_event_command_change_fog_opacity(opacity = 64, frames = 20)

    set_basic_event_commands(206, [opacity, frames])

  end

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

  # * Set Event Command : Show Animation

  #   ~ target = (-1: Player, 0: This event, 1-X: Event ID #'s)

  #   ~ animation_id = animation from database

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

  def set_event_command_show_animation(target = -1, animation_id = 0)

    set_basic_event_commands(207, [target, animation_id])

  end

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

  # * Set Event Command : Change Hero transparency

  #   ~ opp = (0: transparent, 1: opaque)

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

  def set_event_command_change_hero_trans(opp = 0)

    set_basic_event_commands(208, [opp])

  end

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

  # * Set Event Command : Move Event

  #   ~ target : (0: This Event, 1-X: Event ID)

  #   ~ Move Array

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

  def set_event_command_move_event(target = 0, move_array = [])

    m_a = []

    for move_command in move_array

      parameters = []

      case move_command

      when 'Down'        ; code = 1

      when 'Left'        ; code = 2

      when 'Right'       ; code = 3

      when 'Up'          ; code = 4

      when 'Down-Left'   ; code = 5

      when 'Down-Right'  ; code = 6

      when 'Up-Left'     ; code = 7

      when 'Up-Right'    ; code = 8

      when 'Random'      ; code = 9

      when 'Toward Hero' ; code = 10

      when 'Away Hero'   ; code = 11

      when 'Forward'     ; code = 12

      when 'Backward'    ; code = 13

      when 'Face Down'   ; code = 16

      when 'Face Left'   ; code = 17

      when 'Face Right'  ; code = 18

      when 'Face up'     ; code = 19

      when 'Turn 90 Right'  ; code = 20

      when 'Turn 90 Left'   ; code = 21

      when '180 Turn'       ; code = 22

      when 'R/L 90 Turn'    ; code = 23

      when 'Face Random'    ; code = 24

      when 'Face Hero'      ; code = 25

      when 'Face Away Hero' ; code = 26

      else

        if move_command.include? 'Jump'

          x = move_command.slice(move_command.index('(')..move_command.index(',')).delete('(').delete(',').to_i

          y = move_command.slice(move_command.index(',')..move_command.index(')')).delete(')').delete(',').to_i

          code, parameters = 14, [x, y]

        elsif move_command.include? 'Wait' ||

          move_command.sub(/(\d+)/, '')

          code, parameters = 15, [$1]

        elsif move_command.include? 'Switch On'

          move_command.sub(/(\d+)/, '')

          code, parameters = 27, [$1]

        elsif move_command.include? 'Switch Off'

          move_command.sub(/(\d+)/, '')

          code, parameters = 28, [$1]

        elsif move_command.include? 'Change Speed'

          move_command.sub(/(\d+)/, '')

          code, parameters = 29, [$1]

        elsif move_command.include? 'Chagne Frequency'

          move_command.sub(/(\d+)/, '')

          code, parameters = 30, [$1]

        elsif move_command.include? 'Play SE'

          move_command.sub(/(\d+)/, '')

          code, parameters = 44, [$1]

        elsif move_command.include? 'Call Script'

          move_command.sub(/\((\w+)\)/, '')

          code, parameters = 45, [$1]

        end

      end

      # Crates New MoveCommand

      move_command = RPG::MoveCommand.new

      # Sets MoveCommand Properties

      move_command.parameters = parameters

      move_command.code = code

      # Adds MoveCommand to List

      m_a << move_command

    end

    set_basic_event_commands(209, [target, m_a])

  end

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

  # * Set Event Command : Proceed With Movement

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

  def set_event_command_porceed_mvmt

    set_basic_event_commands(210)

  end

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

  # * Set Event Command : Prepare Transition

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

  def set_event_command_prepare_transition

    set_basic_event_commands(221)

  end

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

  # * Set Event Command : Execute Transition

  #   ~ transition_file = transition file name

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

  def set_event_command_execute_transition(transition_file = '')

    set_basic_event_commands(222, [transition_file])

  end

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

  # * Set Event Command : Tint Screen

  #   ~ r, g, b = -255..255

  #   ~ gr = 0..255

  #   ~ frames = frames for transition

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

  def set_event_command_tint_screen(r = 0, g = 0, b = 0, gr = 0, frames = 10)

    set_basic_event_commands(223, [Tonew.new(r, g, b, gr), frames])

  end

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

  # * Set Event Command : Flash Screen

  #   ~ r, g, b = -255..255

  #   ~ gr = 0..255

  #   ~ frames = frames for transition

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

  def set_event_command_flash_screen(r = 0, g = 0, b = 0, gr = 0, frames= 10)

    set_basic_event_commands(224, [Tonew.new(r, g, b, gr), frames])

  end

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

  # * Set Event Command : Shake Screen

  #   ~ strength = 1..9

  #   ~ speed = 1..9

  #   ~ duration = frames of shake

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

  def set_event_command_shake_screen(strength = 5, speed = 5, duration = 10)

    set_basic_event_commands(225, [strength, speed, duration])

  end

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

  # * Set Event Command : Show Picture

  #   ~ pic_id

  #   ~ pic_file

  #   ~ location : (0: Top-Left, 1: Center)

  #   ~ constant : (0: Constant, 1: Variable)

  #   ~ x : # or Variable ID

  #   ~ y : # or Variable ID

  #   ~ x_mag

  #   ~ y_mag

  #   ~ opacity : 0..255

  #   ~ blend_type : 0..2

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

  def set_event_command_show_picture(pid_id = 1, pic_file = '', location = 1,

                            constant = 0, x = 0, y = 0, x_mag = 1, y_mag = 1,

                                               opacity = 255, blend_type = 0)

    set_basic_event_commands(231, [pid_id, pic_file, location, constant, x,

                                       y, x_mag, y_mag, opacity, blend_type])

  end

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

  # * Set Event Command : Move Picture

  #   ~ pic_id

  #   ~ frames

  #   ~ location : (0: Top-Left, 1: Center)

  #   ~ x : # or Variable ID

  #   ~ y : # or Variable ID

  #   ~ x_mag

  #   ~ y_mag

  #   ~ opacity : 0..255

  #   ~ blend_type : 0..2

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

  def set_event_command_move_picture(pid_id = 1, frames = 25, location = 1,

                            constant = 0, x = 0, y = 0, x_mag = 1, y_mag = 1,

                                               opacity = 255, blend_type = 0)

    set_basic_event_commands(232, [pid_id, frames, location, constant, x, y,

                                          x_mag, y_mag, opacity, blend_type])

  end

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

  # * Set Event Command : Rotate Picture

  #   ~ picture_id = 1..9

  #   ~ speed = speed of rotation

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

  def set_event_command_rotate_picture(picture_id = 1, speed = 0)

    set_basic_event_commands(233, [picture_id, speed])

  end

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

  # * Set Event Command : Tint Picture

  #   ~ pict_id = 1..9

  #   ~ r, g, b = -255.255

  #   ~ gr = 0..255

  #   ~ frames = frames of transition

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

  def set_event_command_tint_picture(pict_id = 1, r = 0, g = 0, b = 0,

                                                         gr = 0, frames = 20)

    set_basic_event_commands(234, [pict_id, Tone.new(r, g, b, gr), frames])

  end

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

  # * Set Event Command : Erase Picture

  #   ~ picture_id = Picture ID

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

  def set_event_command_erase_picture(picture_id = 1)

    set_basic_event_commands(235, [picture_id])

  end

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

  # * Set Event Command : Weather Effects

  #   ~ effect = (0: None, 1: Rain, 2: Storm, 3: Snow

  #   ~ strength = 1..9

  #   ~ frames = frames of transition

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

  def set_event_command_weather_effects(effect = 0, strength = 5, frames= 25)

    set_basic_event_commands(236, [effect, strength, frames])

  end

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

  # * Set Event Command : Play BGM

  #   ~ bgm_filename = name of bgm file

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

  def set_event_command_play_bgm(bgm_filename = '')

    # Creates Audio File

    a_file = RPG::AudioFile.new

    a_file.name = bgm_filename

    set_basic_event_commands(241, [a_file])

  end

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

  # * Set Event Command : Fade BGM

  #   ~ frames = frames of transition

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

  def set_event_command_fade_bgm(frames = 25)

    set_basic_event_commands(242, [frames])

  end

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

  # * Set Event Command : Play BGS

  #   ~ bgs_filename = name of bgs file

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

  def set_event_command_play_bgs(bgs_filename = '')

    # Creates Audio File

    a_file = RPG::AudioFile.new

    a_file.name = bgs_filename

    set_basic_event_commands(245, [a_file])

  end

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

  # * Set Event Command : Fade BGS

  #   ~ frames = frames of transition

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

  def set_event_command_fade_bgs(frames = 25)

    set_basic_event_commands(246, [frames])

  end

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

  # * Set Event Command : Memorize BGM / BGS

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

  def set_event_command_memorize_bgm_bgs

    set_basic_event_commands(247)

  end

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

  # * Set Event Command : Play Memorize BGM / BGS

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

  def set_event_command_play_memorize_bgm_bgs

    set_basic_event_commands(248)

  end

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

  # * Set Event Command : Play ME

  #   ~ me_filename = name of me file

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

  def set_event_command_play_me(me_filename = '')

    # Creates Audio File

    a_file = RPG::AudioFile.new

    a_file.name = me_filename

    set_basic_event_commands(249, [a_file])

  end

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

  # * Set Event Command : Play SE

  #   ~ se_filename = name of se file

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

  def set_event_command_play_se(se_filename = '')

    # Creates Audio File

    a_file = RPG::AudioFile.new

    a_file.name = me_filename

    set_basic_event_commands(250, [a_file])

  end

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

  # * Set Event Command : Stop Sound Effect

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

  def set_event_command_stop_se

    set_basic_event_commands(251)

  end

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

  # * Set Event Command : Enemy Encounter

  #   ~ troop_id

  #   ~ can_escape : true or false

  #   ~ can_lose : true or false

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

  def set_event_command_enemy_encounter(troop_id = 1, can_escape = true,

                                                             can_lose = true)

    set_basic_event_commands(301, [troop_id, can_escape, can_lose])

  end

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

  # * Set Event Command : Open Shop Window

  #   ~ inventory list :[ ]

  #     - [type, id]

  #       - type : (0: Item, 1: Weapon, 2: Armor)

  #       - id : item, weapon or armor id

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

  def set_event_command_open_shop_window(inventory = [])

    params = []

    for item in inventory

      command = RPG::EventCommand.new

      command.code = 605

      command.parameters = item

      params << command

    end

    set_basic_event_commands(302, params)

  end

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

  # * Set Event Command : Enter Hero name

  #   ~ hero_id = ID of hero in database

  #   ~ max_charas = maxium characters in name

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

  def set_event_command_enter_hero_name(hero_id = 1, max_charas = 6)

    set_basic_event_commands(303, [hero_id, max_charas])

  end

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

  # * Set Event Command : Change HP

  #   ~ actor_id

  #   ~ added : (0: Added, 1: Subtracted)

  #   ~ constant : (0: constant, 1: Variable)

  #   ~ par : (Constant # or Variable ID)

  #   ~ can_kill : true or false

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

  def set_event_command_change_hp(actor_id = 1, added = 0, constant = 0,

                                                   par = 0, can_kill = false)

    set_basic_event_commands(311, [actor_id, added, constant, par, can_kill])

  end

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

  # * Set Event Command : Change SP

  #   ~ actor_id

  #   ~ added : (0: Added, 1: Subtracted)

  #   ~ constant : (0: constant, 1: Variable)

  #   ~ param : (Constant # or Variable ID)

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

  def set_event_command_change_sp(a_id = 1, added = 0, constant = 0, par = 0)

    set_basic_event_commands(312, [a_id, added, constant, param])

  end

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

  # * Set Event Command : Change Status

  #   ~ actor_id

  #   ~ added : (0: Added, 1: Subtracted)

  #   ~ state_id

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

  def set_event_command_change_status(actor_id = 1, added = 0, state_id = 1)

    set_basic_event_commands(313, [actor_id, added, state_id])

  end

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

  # * Set Event Command : Complete Healing

  #   ~ target = (0: Compelte Party, 1-X: Hero from database)

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

  def set_event_command_complete_healing(target= 0)

    set_basic_event_commands(314, [target])

  end

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

  # * Set Event Command : Change Experience

  #   ~ target : (0: Entire Party, 1-X: Actor ID)

  #   ~ added : (0: Added, 1: Subtracted)

  #   ~ constant : (0: Constatnt, 1: Variable)

  #   ~ param : (Constant # or Variable ID)

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

  def set_event_command_change_experience(target = 0, added = 0,

                                                     constant = 0, param = 0)

    set_basic_event_commands(315, [target, added, constant, param])

  end

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

  # * Set Event Command : Change Level

  #   ~ target : (0: Entire Party, 1-X: Actor ID)

  #   ~ added : (0: Added, 1: Subtracted)

  #   ~ constant : (0: Constatnt, 1: Variable)

  #   ~ param : (Constant # or Variable ID)

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

  def set_event_command_change_level(target = 0, added = 0,

                                                     constant = 0, param = 0)

    set_basic_event_commands(316, [target, added, constant, param])

  end

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

  # * Set Event Command : Change Base Stats

  #   ~ actor_id

  #   ~ stat : (0: Max HP, 1: Max SP, 2: Str, 3: Dex, 4: Agi, 5: Int) 

  #   ~ added : (0: Added, 1: Subtracted)

  #   ~ constant : (0: Constatnt, 1: Variable)

  #   ~ param : (Constant # or Variable ID)

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

  def set_event_command_change_base_stats(actor_id = 1, stat = 0, added = 0,

                                                     constant = 0, param = 0)

    set_basic_event_commands(317, [target, stat, added, constant, param])

  end

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

  # * Set Event Command : Change Skills

  #   ~ actor_id

  #   ~ learn : (0: learn, 1: forget)

  #   ~ skill_id

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

  def set_event_command_change_skills(actor_id = 1, learn = 0, skill_id = 1)

    set_basic_event_commands(318, [actor_id, learn, skill_id])

  end

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

  # * Set Event Command : Change Equipped Items

  #   ~ actor_id

  #   ~ equipment_type : (0: W, 1: S, 2: H, 3: Armor, 4: Acc)

  #   ~ equip_id

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

  def set_event_command_change_equipped_items(actor_id = 1,

                                            equipment_type = 0, equip_id = 0)

    set_basic_event_commands(319, [actor_id, equipment_type, equip_id])

  end

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

  # * Set Event Command : Change Hero Name

  #   ~ actor_id

  #   ~ name_text

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

  def set_event_command_change_hero_name(actor_id = 1, name_text = '')

    set_basic_event_commands(320, [actor_id, name_text])

  end

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

  # * Set Event Command : Change Hero Class

  #   ~ actor_id

  #   ~ class_id

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

  def set_event_command_change_hero_class(actor_id = 1, class_id = 1)

    set_basic_event_commands(321, [actor_id, class_id])

  end

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

  # * Set Event Command : Change Hero Graphic

  #   ~ actor_id

  #   ~ character_file

  #   ~ character_hue

  #   ~ battler_file

  #   ~ battler_hue

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

  def set_event_command_change_hero_graphic(actor_id = 1,

                                      character_file = '', character_hue = 0,

                                          battler_file = '', battler_hue = 0)

    set_basic_event_commands(322, [actor_id, character_file, character_hue,

                                                  battler_file, battler_hue])

  end

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

  # * Set Event Command : Open Main Menu

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

  def set_event_command_open_main_menu

    set_basic_event_commands(351)

  end

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

  # * Set Event Command : Open Save Menu

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

  def set_event_command_open_save_menu

    set_basic_event_commands(352)

  end

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

  # * Set Event Command : Gameover

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

  def set_event_command_gameover

    set_basic_event_commands(353)

  end

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

  # * Set Event Command : Return to Title

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

  def set_event_command_return_to_title

    set_basic_event_commands(354)

  end

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

  # * Set Event Command : Call Script

  #   ~ script_string = string of script

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

  def set_event_command_call_script(script_string = '')

    set_basic_event_commands(355, [script_string])

  end

  

  #===========================================================================

  # *** Move Codes

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

  # This table is for the coding for the move commands

  #===========================================================================

 

  # ~ Name        -  Parameters  -  Code

  # Down          -  []          -  1

  # Left          -  []          -  2

  # Right         -  []          -  3

  # Up                -  []          -  4

  # Down-Left         -  []          -  5

  # Down-Right        -  []          -  6

  # Up-Left           -  []          -  7

  # Up-Right          -  []          -  8

  # Random            -  []          -  9

  # Toward Hero       -  []          -  10

  # Away Hero         -  []          -  11

  # Forward           -  []          -  12

  # Backward          -  []          -  13

  # Jump(x, y)        -  [x, y]      -  14

  # Wait(sec)         -  [seconds]   -  15

  # Face Down         -  []      -  16

  # Face Left         -  []          -  17

  # Face Right        -  []          -  18

  # Face up           -  []          -  19

  # Turn 90 Right     -  []          -  20

  # Turn 90 Left      -  []          -  21

  # 180 Turn          -  []          -  22

  # R/L 90 Turn       -  []          -  23

  # Face Random       -  []          -  24

  # Face Hero         -  []          -  25

  # Face Away Hero    -  []          -  26

  # Switch On(s_id)   -  [switch_id] -  27

  # Switch Off(s_id)  -  [switch_id] -  28

  # Change Speed(spd) -  [speed]     -  29

  # Chagne Frequency(freq)  -  [frequency] -  30

  # Play SE           -  RPG::Audio File  -  44

  # Call Script       -  Script String    -  45

end

 

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

# * End SDK Enable Test

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

#end

And there's another one, ver 2.1 that I really liked its functions but it's also SDK and needs MACL...
Code:
#==============================================================================

# ** Modules.Event Spawner (2.1)                              By SephirothSpawn

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

# * Description :

#

#   This script was designed to allow you to create events via scripts. It

#   will create events immeditately, and can save created events perm. on the

#   map after creation, or appear once. You can also clone events, performing

#   modifications via Event Spawner module, or immeditely end the clone

#   event process and move the new event to a position.

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

# * Instructions :

#

#   THIS SCRIPT IS COMPLEX!!! I TOOK HOURS OF COMMENTING, RUNNING THROUGH

#   ALL EVENT CODES & PARAMETERS (600+ LINES), AND MAKING THIS SCRIPT EASIER 

#   TO USE. PLEASE READ THE CREATION & EVENT COMMAND CODES & PARAMETERS 

#   BEFORE ASKING FOR SUPPORT!

#

#   If you are ever unsure of a event layout, insert this at the top of event

#   commands

#

#   Call Script : 

#

#     for event_command in $game_map.events[event_id].list

#       p [event_command.code, event_command.parameters, event_command.indent]

#     end

#

#   Write down the code, parameters & indention, and use the add event command

#   function to create event commands.

#

#   To see instructions on creating events, refer to creation instrucitons.

#   To see event command codes & parameters, refer to event command c & p.

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

# * Making Events Without Huge Call Scripts :

#

#   This script has a built-in sub-module that will create events with a 

#   simple 1-line call script, rather than creating a 15 line call script.

#

#   To create a simple event spawn, search for the Presets module, directly

#   below the Event_Spawner module heading.

#

#   Create a method name, which should match the event you are creating. For

#   example; if you were creating a event on your map that will show a simple

#   text message, you can use a name such as

#

#   def self.sample_event_text

#

#   Make sure to put the self. in from of your method name, or it will not

#   read the method and you will have an error.

#

#   Basic Syntax For Method Naming

#

#     def self.<event_name>

#

#   Feel free to use method arguments as well (If you don't understand this,

#   do not worry about it)

#

#

#   Once your method is defined, you can now put what you would put in your

#   call script here in the method name.

#

#   Finish you method by adding a end and you are finished.

#

#

#   Example Preset Event:

#

#    def self.sample_event_a

#      Event_Spawner.create_event(3, 5, 'Sample Event A')

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

#      Event_Spawner.add_event_command(101, ['I am a spawned event'])

#      Event_Spawner.end_event

#    end

#

#   ~ Creates an event at 3, 5 named Sample Event A

#   ~ Sets 1st Page Graphic Character Name to 002-Fighter02

#   ~ Creates Event Command : Show Message (Code 101)

#   ~ Ends Event

#

#   To call your event preset, use

#

#   Event_Spawner.Presets.<method_name>

#

#   (This Basically Serves as nothing more than call scripts in the script

#    itself, rather than the events.)

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

# * Event Creation Instructions :

#

#

#   **** 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

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

# * Event Command Code & Parameters

#

#  ~~ Show Text

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

#    - Parameters : ['Text Line']

#

#  ~~ Show Choices

#    - Code       : 102

#    - Parameters : Did not comment on yet

#

#  ~~ When [**]

#    - Code       : 402

#    - Parameters : Did not comment on yet

#

#  ~~ When Cancel

#    - Code       : 403

#    - Parameters : Did not comment on yet

#

#  ~~ Input Number

#    - Code       : 103

#    - Parameters : Did not comment on yet

#  ~~ Change Text Options

#    - Code       : 104

#    - Parameters : [ <message_position>, <message_frame> ]

#

#      <message_position> - (0 : Up, 1 : Middle, 2 : Down)

#      <message_frame>    - (0 : Visible, 1 : Invisible)

#

#  ~~ Button Input Processing

#    - Code       : 105

#    - Parameters : [ variable_id ]

#

#  ~~ Wait

#    - Code       : 106

#    - Parameters : [ frames ]

#

#  ~~ Comment :

#    - Code       : 108 (Lines After First Line - 408)

#    - Parameters : [ 'Comment Text' ]

#

#  ~~ Conditional Branch

#    - Code       : 111

#    - Parameters : Did not comment on yet

#

#  ~~ Else

#    - Code       : 411

#    - Parameters : Did not comment on yet

#

#  ~~ Loop

#    - Code       : 112

#    - Parameters : Did not comment on yet

#

#  ~~ Repeat Above

#    - Code       : 413

#    - Parameters : Did not comment on yet

#

#  ~~ Break Loop

#    - Code       : 113

#    - Parameters : Did not comment on yet

#

#  ~~ Exit Event Processing

#    - Code       : 115

#    - Parameters : []

#

#  ~~ Erase Event

#    - Code       : 116

#    - Parameters : []

#

#  ~~ Call Common Event

#    - Code       : 117

#    - Parameters : [ common_event_id ]

#

#  ~~ Label

#    - Code       : 118

#    - Parameters : [ 'label_name' ]

#

#  ~~ Jump to Label

#    - Code       : 119

#    - Parameters : [ 'label_name' ]

#

#  ~~ Control Switches

#    - Code       : 121

#    - Parameters : [ start_variable, end_variable, <boolean> ]

#

#    <boolean> - (0 : On, 1 : Off)

#

#  ~~ Control Variables

#    - Code       : 122

#    - Parameters : [ start_var_id, end_var_id, <opperation>, <opperand>, <p> ]

#

#    <opperation> - (0: Set, 1: +, 2: -, 3: *, 4: /, 5: %)

#    <opperand> - (0: Constant, 1: Variable, 2: Random Number, 3: Item,

#                  4: Hero, 5: Monster, 6: Sprite, 7: Other)

#    <p>

#       When <opperand> is Constant (0)

#        - n

#       When <opperand> is Variable (1)

#        - variable_id

#       When <opperand> is Random Number (2)

#        - lower, higher

#       When <opperand> is Item (3)

#        - item_id

#       When <opperand> is Hero (4)

#        - hero_id, <stat> (See <stat> Below)

#       When <opperand> is Monster (5)

#        - monster_id, <stat> (See <stat> Below)

#       When <opperand> is Sprite (6)

#        - <event_id>, <tile>

#

#        <event_id> - (-1: Player, 0: This Event, 1-X: Event ID)

#        <tile> - (0: X Tile, 1: Y Tile, 2: Face, 3: Screen X, 4: Screen Y, 

#                  5:Terrain)

#       When <opperand> is Other (7)

#        - (0: Map ID, 1: Party Size, 2: Money, 3: # of Steps, 

#           4: Timer in Secs, 5: # of Saves)

#

#        <stat> - (0: HP, 1: SP, 2: Max HP, 3: Max SP, 4: Str,

#                  5: Dex, 6: Agi, 7: Int, 8: Atk, 9: PDef, 10: MDef, 11: Eva)

#  ~~ Control Self Switch

#    - Code       : 123

#    - Parameters : [ 'switch_letter', <boolean> ]

#

#    <boolean> - (0 : On, 1 : Off)

#

#  ~~ Control Timer

#    - Code       : 124

#    - Parameters : [ <boolean>, seconds ]

#

#    <boolean> - (0 : On, 1 : Off)

#

#  ~~ Change Gold

#    - Code       : 125

#    - Parameters : [ <operation>, <type>, <operand> ]

#

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Items

#    - Code       : 126

#    - Parameters : [ item_id, <operation>, <type>, <operand> ]

#

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Weapons

#    - Code       : 127

#    - Parameters :[ weapon_id, <operation>, <type>, <operand> ]

#

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Armor

#    - Code       : 128

#    - Parameters :[ armor_id, <operation>, <type>, <operand> ]

#

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Party Member

#    - Code       : 129

#    - Parameters : [ actor_id, <operation>, <reset> ]

#

#    <operation> - (0 : Add, 1 : Remove)

#    <reset> - (0 : Leave As Is, 1 : Reset Actor Information)

#

#  ~~ Change Windowskin

#    - Code       : 131

#    - Parameters : [ 'windowskin_name' ]

#

#  ~~ Change Battle BGM

#    - Code       : 132

#    - Parameters : [ 'battle_bgm' ]

#

#  ~~ Change Battle End ME

#    - Code       : 133

#    - Parameters : [ 'battle_me' ]

#

#  ~~ Change Save Access

#    - Code       : 134

#    - Parameters : [ <boolean> ]

#

#    <boolean> - (0 : On, 1 : Off)

#

#  ~~ Change Menu Access

#    - Code       : 135

#    - Parameters : [ <boolean> ]

#

#    <boolean> - (0 : On, 1 : Off)

#

#  ~~ Change Encounter

#    - Code       : 136

#    - Parameters : [ <boolean> ]

#

#    <boolean> - (0 : On, 1 : Off)

#

#  ~~ Transfer Player

#    - Code       : 201

#    - Parameters : [ <type>, <map_id>, <x>, <y>, <direction> ]

#

#    <type> - (0 : Constant, 1 : Game Variable)

#    <map_id> - number or variable_id

#    <x> - number or variable_id

#    <x> - number or variable_id

#    <direction> - (2 : Down, 4 : Left, 6 : Right, 8 : Up)

#

#  ~~ Set Event Location

#    - Code       : 202

#    - Parameters : [ <target_event>, <type>, <params>, <direction> ]

#

#    <target_event> - (-1 : Player, 0 : Current Event, N : Event ID)

#    <type> - (0 : Constant, 1 : Variables, 2 : Switch With Event)

#    <params>

#     When type is Constant (0) - target_x, target_y

#     When type is Variables (1) - x_variable, y_variable

#     When type is Switch Event (2) - event_id

#    <direction> - (2 : Down, 4 : Left, 6 : Right, 8 : Up)

#

#  ~~ Scroll Map

#    - Code       : 203

#    - Parameters : [ <direction>, distance, speed ]

#

#    <direction> - (2 : Down, 4 : Left, 6 : Right, 8 : Up)

#

#  ~~ Change Map Settings

#    - Code       : 204

#    - Parameters : [ <type>, <params> ]

#

#    <type> - (0 : Panorama, 1 : Fog, 2 : Battleback)

#    <params>

#     When type is Panorama (0) - name, hue

#     When type is Fog (1) - name, hue, opacity, blend_type, zoom, sx, sy

#     When type is Battleback (2) - name

#

#  ~~ Change Fog Color Tone

#    - Code       : 205

#    - Parameters : [ tone, duration ]

#

#  ~~ Change Fog Opacity

#    - Code       : 206

#    - Parameters : [ opacity, duration ]

#

#  ~~ Show Animation

#    - Code       : 207

#    - Parameters : [ <target_event>, animation_id ]

#

#    <target_event> - (-1 : Player, 0 : Current Event, N : Event ID)

#

#  ~~ Change Transparent Flag

#    - Code       : 208

#    - Parameters : [ <boolean> ]

#

#    <boolean> - (0 : Transparent, 1 : Non-Transparent)

#

#  ~~ Set Move Route

#    - Code       : 209

#    - Parameters : [ <target_event>, RPG::MoveRoute ]

#

#    <target_event> - (-1 : Player, 0 : Current Event, N : Event ID)

#

#  ~~ Wait for Move's Completion

#    - Code       : 210

#    - Parameters : []

#

#  ~~ Prepare for Transition

#    - Code       : 221

#    - Parameters : []

#

#  ~~ Execute Transition

#    - Code       : 222

#    - Parameters : [ transition_name ]

#

#  ~~ Change Screen Color Tone

#    - Code       : 223

#    - Parameters : [ tone, duration ]

#

#  ~~ Screen Flash

#    - Code       : 224

#    - Parameters : [ color, duration ]

#

#  ~~ Screen Shake

#    - Code       : 225

#    - Parameters : [ power, speed, duration ]

#

#  ~~ Show Picture

#    - Code       : 231

#    - Parameters : [ pic_id, name orgin, <type>, <x>, <y>, 

#                     zoom_x, zoom_y, opacity, blend_type ]

#

#    <type> - (0 : Constant, 1 : Variables)

#    <x> - number or variable_id

#    <y> - number or variable_id

#

#  ~~ Move Picture

#    - Code       : 232

#    - Parameters : [ pic_id, name orgin, <type>, <x>, <y>, 

#                     zoom_x, zoom_y, opacity, blend_type ]

#

#    <type> - (0 : Constant, 1 : Variables)

#    <x> - number or variable_id

#    <y> - number or variable_id

#

#  ~~ Rotate Picture

#    - Code       : 233

#    - Parameters : [ pic_id, angel ]

#

#  ~~ Change Picture Color Tone

#    - Code       : 234

#    - Parameters : [ pic_id, tone, duration ]

#

#  ~~ Erase Picture

#    - Code       : 235

#    - Parameters : [ pic_id ]

#

#  ~~ Set Weather Effects

#    - Code       : 236

#    - Parameters : [ <type>, power, duration ]

#

#    <type> - (0 : None, 1 : Rain, 2: Storm; 3: Snow)

#

#  ~~ Play BGM

#    - Code       : 241

#    - Parameters : [ RPG::AudioFile ]

#

#  ~~ Fade Out BGM

#    - Code       : 242

#    - Parameters : [ time ]

#

#  ~~ Play BGS

#    - Code       : 245

#    - Parameters : [ RPG::AudioFile ]

#

#  ~~ Fade Out BGS

#    - Code       : 246

#    - Parameters : [ time ]

#

#  ~~ Memorize BGM/BGS

#    - Code       : 247

#    - Parameters : []

#

#  ~~ Restore BGM/BGS

#    - Code       : 248

#    - Parameters : []

#

#  ~~ Play ME

#    - Code       : 249

#    - Parameters : [ RPG::AudioFile ]

#

#  ~~ Play SE

#    - Code       : 250

#    - Parameters : [ RPG::AudioFile ]

#

#  ~~ Stop SE

#    - Code       : 251

#    - Parameters : []

#

#  ~~ Battle Processing

#    - Code       : 301

#    - Parameters : [ troop_id, can_escape_boolean, can_lose_boolean ]

#

#  ~~ If Win

#    - Code       : 601

#    - Parameters : []

#

#  ~~ If Escape

#    - Code       : 602

#    - Parameters : []

#

#  ~~ If Lose

#    - Code       : 603

#    - Parameters : []

#

#  ~~ Shop Processing

#    - Code       : 302 (For Additional Shop Item Setup - 605)

#    - Parameters : [ [ <item_type>, item_id] ]

#

#    <item_type> - (0 : Item, 1 : Weapon, 2 : Armor)

#

#  ~~ Name Input Processing

#    - Code       : 303

#    - Parameters : [ actor_id, max_characters ]

#

#  ~~ Change HP

#    - Code       : 311

#    - Parameters : [ <actors>, <operation>, <type>, <operand> ]

#

#    <actors> - (0 : All Party Actors, N : Actor ID)

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change SP

#    - Code       : 312

#    - Parameters : [ <actors>, <operation>, <type>, <operand> ]

#

#    <actors> - (0 : All Party Actors, N : Actor ID)

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change State

#    - Code       : 313

#    - Parameters : [ <actors>, <operation>, state_id ]

#

#    <actors> - (0 : All Party Actors, N : Actor ID)

#    <operation> - (0 : Add State, 1 : Remove State)

#

#  ~~ Recover All

#    - Code       : 314

#    - Parameters :[ <actors> ]

#

#    <actors> - (0 : All Party Actors, N : Actor ID)

#

#  ~~ Change EXP

#    - Code       : 315

#    - Parameters : [ <actors>, <operation>, <type>, <operand> ]

#

#    <actors> - (0 : All Party Actors, N : Actor ID)

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Level

#    - Code       : 316

#    - Parameters : [ <actors>, <operation>, <type>, <operand> ]

#

#    <actors> - (0 : All Party Actors, N : Actor ID)

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Parameters

#    - Code       : 317

#    - Parameters : [ <actors>, <parameter>, <operation>, <type>, <operand> ]

#

#    <actors> - (0 : All Party Actors, N : Actor ID)

#    <parameter> - (0 : MaxHP, 1 : MaxSP, 2 : Str, 3 : Dex, 4 : Agi, 4 : Int)

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Skills

#    - Code       : 318

#    - Parameters : [ actor_id, <operation>, skill_id ]

#

#    <operation> - (0 : Learn Skill, 1 : Forget Skill)

#

#  ~~ Change Equipment

#    - Code       : 319

#    - Parameters : [ actor_id, <equip_type>, equipment_id ]

#

#    <equip_type> : (0 : Weapon, 1 : Shield, 2 : Head, 3 : Body, 4 : Acc)

#

#  ~~ Change Actor Name

#    - Code       : 320

#    - Parameters : [ actor_id, 'name' ]

#

#  ~~ Change Actor Class

#    - Code       : 321

#    - Parameters : [ actor_id, class_id ]

#

#  ~~ Change Actor Graphic

#    - Code       : 322

#    - Parameters : [ actor_id, character_name, character_hue,

#                               battler_name, battler_hue ]

#

#  ~~ Change Enemy HP

#    - Code       : 331

#    - Parameters : [ <enemies>, <operation>, <type>, <operand> ]

#

#    <enemies> - (0 : All Enemies, N : Enemy Index)

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Enemy SP

#    - Code       : 332

#    - Parameters : [ <enemies>, <operation>, <type>, <operand> ]

#

#    <enemies> - (0 : All Enemies, N : Enemy Index)

#    <operation> - (0 : Increase, 1 : Decrease)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id

#

#  ~~ Change Enemy State

#    - Code       : 333

#    - Parameters : [ <enemies>, <operation>, state_id ]

#

#    <enemies> - (0 : All Enemies, N : Enemy Index)

#    <operation> - (0 : Add State, 1 : Remove State)

#

#  ~~ Enemy Recover All

#    - Code       : 334

#    - Parameters : [ <enemies> ]

#

#    <enemies> - (0 : All Enemies, N : Enemy Index)

#

#  ~~ Enemy Appearance

#    - Code       : 335

#    - Parameters : [ <enemies> ]

#

#    <enemies> - (0 : All Enemies, N : Enemy Index)

#

#  ~~ Enemy Transform

#    - Code       : 336

#    - Parameters : [ enemy_index, target_enemy_id ]

#

#  ~~ Show Battle Animation

#    - Code       : 337

#    - Parameters : [ <target_troop>, <battlers>, animation_id ]

#

#    <target_troop> - (0 : Enemies, 1 : Actors)

#    <battlers> - (0 : Entire Troop, N : Index)

#

#  ~~ Deal Damage

#    - Code       : 338

#    - Parameters : [ <target_troop>, <battlers>, <type>, <operand> ]

#

#    <target_troop> - (0 : Enemies, 1 : Actors)

#    <battlers> - (0 : Entire Troop, N : Index)

#    <type> - (0: Constant 1: Variable)

#    <operand> - number or variable_id]

#

#  ~~ Force Action

#    - Code       : 339

#    - Parameters : [ <target_group>, <battlers>, <kind>, <basic>,

#                     <target>, <forcing> ]

#

#    <target_troop> - (0 : Enemies, 1 : Actors)

#    <battlers> - (0 : Entire Troop, N : Index)

#    <kind> - (0 : Attack/Guard, 1: Skill)

#    <basic>

#      When Kind is 0 - (0 : Attack, 1 : Guard)

#      When Kind is 1 - skill_id

#    <target> - (-2 : Last Target, -1 : Random Target, N : Target Index)

#    <forcing> - (0 : Execute Instead Of Next Move, 1 : Force Now)

#

#  ~~ Abort Battle

#    - Code       : 340

#    - Parameters : []

#

#  ~~ Call Menu Screen

#    - Code       : 351

#    - Parameters : []

#

#  ~~ Call Save Screen

#    - Code       : 352

#    - Parameters : []

#

#  ~~ Game Over

#    - Code       : 353

#    - Parameters : []

#

#  ~~ Return to Title Screen

#    - Code       : 354

#    - Parameters : []

#

#  ~~ Script

#    - Code       : 355 (Lines After First line - 655)

#    - Parameters : [ 'script text' ]

#==============================================================================

 

MACL::Loaded << 'Modules.Event Spawner'

 

#==============================================================================

# ** Event_Spawner

#==============================================================================

 

module Event_Spawner

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

  # * Event

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

  def self.event

    return @event

  end

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

  # * Create Event

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

  def self.create_event(x = 0, y = 0, name = '')

    # Creates New Event

    @event = RPG::Event.new(x, y)

    @event.name = name

    # Generates ID

    @event.id = $game_map.events.empty? ? 1 : $game_map.events.keys.max + 1

  end

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

  # * Add Event Command (See Script Heading for Event Command Details)

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

  def self.add_event_command(code, parameters = [], indent = 0)

    # Creates New Event Command

    event_command = RPG::EventCommand.new

    # Sets Code, Parameters & Indent

    event_command.code = code

    event_command.parameters = parameters

    event_command.indent = indent

    # Adds Event Command To Page List

    self.get_current_page.list.insert(-2, event_command)

  end

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

  # * Set Page Condition

  #

  #   'switch1'    => switch_id

  #   'switch2'    => switch_id

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

  #   'variable'   => [variable_id, value]

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

  def self.set_page_condition(parameters = {})

    # Gets Last Page Condition Settings

    page_c = self.get_current_page.condition

    # If 'switch1' Found

    if parameters.has_key?('switch1')

      # Turns Switch 1 On & Sets ID

      page_c.switch1_valid = true

      page_c.switch1_id    = parameters['switch1']

    end

    # If 'switch2' Found

    if parameters.has_key?('switch2')

      # Turns Switch 2 On & Sets ID

      page_c.switch2_valid = true

      page_c.switch2_id    = parameters['switch1']

    end

    # If 'selfswitch' Found

    if parameters.has_key?('selfswitch')

      # Turns Self Switch ON & Sets Switch Variable

      page_c.self_switch_valid = true

      page_c.self_switch_ch    = parameters['selfswitch']

    end

    # If 'variable' Found

    if parameters.has_key?('variable')

      # Turns Variable On, Sets Variable ID & Sets Value

      page_c.variable_valid = true

      page_c.variable_id    = parameters['variable'][0]

      page_c.variable_value = parameters['variable'][1]

    end

  end

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

  # * 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

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

  def self.set_page_graphic(parameters = {})

    # Gets Last Page Graphic Settings

    page_g = self.get_current_page.graphic

    # Tile ID

    if parameters.has_key?('tileid')

      page_g.tile_id = parameters['tileid']

    end

    # Character Name

    if parameters.has_key?('c_name')

      page_g.character_name = parameters['c_name']

    end

    # Character Hue

    if parameters.has_key?('c_hue')

      page_g.character_hue = parameters['c_hue']

    end

    # Direction

    if parameters.has_key?('dir')

      page_g.direction = parameters['dir']

    end

    # Pattern

    if parameters.has_key?('pattern')

      page_g.pattern = parameters['pattern']

    end

    # Opacity

    if parameters.has_key?('opacity')

      page_g.opacity = parameters['opacity']

    end

    # Blend Type

    if parameters.has_key?('blend')

      page_g.blend_type = parameters['blend']

    end

  end

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

  # * Set Page Trigger

  #

  #   0 - Action Button

  #   1 - Contact With Player

  #   2 - Contact With Event

  #   3 - Autorun

  #   4 - Parallel Processing

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

  def self.set_page_trigger(trigger = 0)

    # Sets Last Page Trigger

    self.get_current_page.trigger = trigger

  end

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

  # * Set Page Move Settings

  #

  #   '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)

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

  def self.set_page_move_settings(parameters = {})

    # Gets Last Page

    page = self.get_current_page

    # Type

    if parameters.has_key?('type')

      page.move_type = parameters['type']

    end

    # Speed

    if parameters.has_key?('speed')

      page.move_speed = parameters['speed']

    end

    # Frequency

    if parameters.has_key?('freq')

      page.move_frequency = parameters['freq']

    end

    # Route

    if parameters.has_key?('route')

      if parameters['route'].is_a?(RPG::MoveRoute)

        page.move_route = parameters['route'] 

      end

    end

  end

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

  # * Set Page Options

  #

  #   'walk_anime'    => true or false

  #   'step_anime'    => true or false

  #   'direction_fix' => true or false

  #   'through'       => true or false

  #   'always_on_top' => true or false

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

  def self.set_page_options(parameters = {})

    # Gets Last Page

    page = self.get_current_page

    # Walk Animation

    if parameters.has_key?('walk_anime')

      page.walk_anime = parameters['walk_anime']

    end

    # Step Animation

    if parameters.has_key?('step_anime')

      page.step_anime = parameters['step_anime']

    end

    # Direction Fix

    if parameters.has_key?('direction_fix')

      page.direction_fix = parameters['direction_fix']

    end

    # Through

    if parameters.has_key?('through')

      page.through = parameters['through']

    end

    # Always On Top

    if parameters.has_key?('always_on_top')

      page.always_on_top = parameters['always_on_top']

    end

  end

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

  # * Add New Page

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

  def self.add_page

    @event.pages << RPG::Event::Page.new

  end

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

  # * Generate Move Route

  #

  #   list = [ <move_command>, ... ]

  #

  #   <move_command> : [code, parameters]

  #

  #   If no parameters required :

  #

  #   <move_command> : code

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

  def self.generate_move_route(list = [], repeat = true, skippable = false)

    # Creates New Move Route

    move_route = RPG::MoveRoute.new

    # Sets Repeat & Skipable

    move_route.repeat    = repeat

    move_route.skippable = skippable

    # Passes Through List

    for move_command in list

      if move_command.is_a?(Array)

        code, parameters = move_command[0], move_command[1]

      else

        code, parameters = move_command, []

      end

      # Crates New MoveCommand

      move_command = RPG::MoveCommand.new

      # Adds MoveCommand to List

      move_route << move_command

      # Sets MoveCommand Properties

      move_command.parameters = parameters

      move_command.code = code

    end

    # Add Blank Move Command

    move_route << RPG::MoveCommand.new

    # Return Move Route

    return move_route

  end

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

  # * End Event

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

  def self.end_event(save_event = false)

    # Stop If nil Event Created

    return if @event.nil?

    # Fix ID

    @event.id = $game_map.events.empty? ? 1 : $game_map.events.keys.max + 1

    # Add Event to Map & Spriteset Data

    $game_map.add_event(@event)

    # If Save Event Data

    if save_event

      # Creates Map Event Data (If none Present)

      unless @saved_events.has_key?((map_id = $game_map.map_id))

        @saved_events[map_id] = []

      end

      # Saves Event Data

      @saved_events[map_id] << @event.id

    end

    # Clear Event Data

    @event = nil

  end

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

  # * Clone Event

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

  def self.clone_event(target_id, new_x, new_y, new_name, 

      end_event = false, save_event = false)

    # Stops If Event Not Found

    return unless $game_map.events.has_key?(target_id)

    # Gets Event Data

    @event = $game_map.events[target_id].event

    # Changes X, Y & name

    @event.x    = new_x

    @event.y    = new_y

    @event.name = new_name

    # Generates New ID

    @event.id = $game_map.events.empty? ? 1 : $game_map.events.keys.max + 1

    # If End Event

    if end_event

      # Ends Event Creation

      self.end_event(save_event)

    end

  end

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

  # * Saved Events { map_id => { event_id => name }, ... }

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

  @saved_events = {}

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

  # * Saved Events (Read)

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

  def self.saved_events(map_id = nil)

    # If Map ID not Defined

    if map_id.nil?

      # Return All Saved Event Data

      return @saved_events

    end

    # If Map Data Saved

    if @saved_events.has_key?(map_id)

      # Return Map Saved Event Data

      return @saved_events[map_id]

    end

    # Return Blank Array

    return []

  end

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

  # * Saved Events (Write)

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

  def self.saved_events=(saved_events)

    @saved_events = saved_events

  end

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

  # * Current Page

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

  def self.get_current_page

    return @event.pages.last

  end

end

 

#==============================================================================

# ** Game_Map

#==============================================================================

 

class Game_Map

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

  # * Alias Listings

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

  alias_method :seph_eventspawner_gmap_init,  :initialize

  alias_method :seph_eventspawner_gmap_setup, :setup

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

  # * Object Initialization

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

  def initialize

    # Original Initialization

    seph_eventspawner_gmap_init

    # Create Saved Events

    @saved_events = {}

  end

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

  # * Setup

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

  def setup(map_id)

    # Gets Saved Events

    saved_events = Event_Spawner.saved_events(@map_id)

    # If Not Empty

    unless saved_events.empty?

      # Create List (If none exist)

      @saved_events[@map_id] = {} unless @saved_events.has_key?(@map_id)

      # Saves spawned events

      saved_events.each do |event_id|

        @saved_events[@map_id][event_id] = @events[event_id]

      end

    end

    # Original Map Setup

    seph_eventspawner_gmap_setup(map_id)

    # If Map Has Saved Events

    if @saved_events.has_key?(@map_id)

      # Add saved events to events list

      @saved_events[@map_id].each do |event_id, event|

        @events[event_id] = event

      end

    end

  end

end

 

#==============================================================================

# ** Scene_Save

#==============================================================================

 

class Scene_Save

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

  # * Alias Listings

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

  alias_method :seph_eventspawner_scnsave_wsd, :write_save_data

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

  # * Write Save Data

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

  def write_save_data(file)

    # Original Write Data

    seph_eventspawner_scnsave_wsd(file)

    # Saves Saved Event Data

    Marshal.dump(Event_Spawner.saved_events, file)

  end

end

 

#==============================================================================

# ** Scene_Load

#==============================================================================

 

class Scene_Load

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

  # * Alias Listings

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

  alias_method :seph_eventspawner_scnload_rsd, :read_save_data

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

  # * Read Save Data

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

  def read_save_data(file)

    # Original Write Data

    seph_eventspawner_scnload_rsd(file)

    # Load Saved Event Data

    Event_Spawner.saved_events = Marshal.load(file)

  end

end

If somebody knows a similar non-sdk like this I'd really apreciate if somebody could link it xD
Otherwise, I think I'll use the version 1.0 then

Thanks in advance \o
See ya
 
idk ive never used this one, but i said it in my script archive:
[rgss] 
#==============================================================================
# Event spawning utility
# by Khatharr
#==============================================================================
# For RMXP greatness visit - www.dubealex.com
#==============================================================================
# Oh, and to make this crap work you just post it into a new section.
# Just make sure that that new section is JUST ABOVE "MAIN"!
# Don't bug me about this script.  I don't wanna hear it.  Thank you.
#==============================================================================
class Game_Map
  attr_accessor :events
end
class Scene_Map
  attr_accessor :spriteset
end
#----------------------------------------------------------------------------
class Spawn_Event
  attr_accessor :monkey
  #--------------------------------------------------------------------------
  def initialize(x, y, name = "")
    @monkey = RPG::Event.new(x, y)
    @monkey.id = $game_map.events.size + 1
    @monkey.name = name
  end
  #--------------------------------------------------------------------------
  def makepage(type = 0, speed = 3, freq = 3, walkani = true, step = false, lock = false, phase = false, top = false, trigger = 0)
    bliffle = @monkey.pages.size
    @monkey.pages.push(RPG::Event::Page.new)
    @monkey.pages[bliffle].move_type = type
    @monkey.pages[bliffle].move_speed = speed
    @monkey.pages[bliffle].move_frequency = freq
    @monkey.pages[bliffle].walk_anime = walkani
    @monkey.pages[bliffle].step_anime = step
    @monkey.pages[bliffle].direction_fix = lock
    @monkey.pages[bliffle].through = phase
    @monkey.pages[bliffle].always_on_top = top
    @monkey.pages[bliffle].trigger = trigger #0=key, 1=htouch, 2=etouch, 3=auto ,4=para
  end
  #--------------------------------------------------------------------------
  def route(page, repeat = true, skippable = false)
    @monkey.pages[page].move_route.repeat = repeat
    @monkey.pages[page].move_route.skippable = skippable
  end
  #--------------------------------------------------------------------------
  def movement(page, code = 0, parameters = [])
    ickyptwang = @monkey.pages[page].move_route.list.pop
    @monkey.pages[page].move_route.list.push(RPG::MoveCommand.new(code, parameters))
    @monkey.pages[page].move_route.list.push(ickyptwang)
  end
  #--------------------------------------------------------------------------
  def graphic(page, pic = "", tile = 0, hue = 0, dir = 2, pattern = 0, opacity = 255, blend = 0)
    @monkey.pages[page].graphic.tile_id = tile
    @monkey.pages[page].graphic.character_name = pic
    @monkey.pages[page].graphic.character_name
    @monkey.pages[page].graphic.character_hue = hue
    @monkey.pages[page].graphic.direction = dir
    @monkey.pages[page].graphic.pattern = pattern #direction handles row, pattern handles column
    @monkey.pages[page].graphic.opacity = opacity
    @monkey.pages[page].graphic.blend_type = blend
  end
  #--------------------------------------------------------------------------
  def list(page, code, parameters)
    temp = @monkey.pages[page].list.pop
    arf = @monkey.pages[page].list.size
    @monkey.pages[page].list.push(RPG::EventCommand.new)
    @monkey.pages[page].list[arf].code = code
    @monkey.pages[page].list[arf].parameters = parameters
    @monkey.pages[page].list.push(temp)
  end
  #--------------------------------------------------------------------------
  def condition(page, s1on = false, s1id = 1, s2on = false, s2id = 1, varon = false, varid = 1, varval = 0, sswon = false, sswval = "A")
    @monkey.pages[page].condition.switch1_valid = s1on
    @monkey.pages[page].condition.switch2_valid = s2on
    @monkey.pages[page].condition.variable_valid = varon
    @monkey.pages[page].condition.self_switch_valid = sswon
    @monkey.pages[page].condition.switch1_id = s1id
    @monkey.pages[page].condition.switch2_id = s2id
    @monkey.pages[page].condition.variable_id = varid
    @monkey.pages[page].condition.variable_value = varval
    @monkey.pages[page].condition.self_switch_ch = sswval
  end
  #--------------------------------------------------------------------------
  def inject
    $game_map.events[@monkey.id] = Game_Event.new(@map_id, @monkey)
    $game_map.need_refresh = true
    $scene.spriteset = Spriteset_Map.new
    @monkey = nil
  end
  #--------------------------------------------------------------------------
end
[/rgss]
 

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