Class: Interpreter

Inherits:
Interpreter_RMXP show all
Includes:
Util::SystemMessage
Defined in:
scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb,
scripts/00600 Script_RMXP/03100 Game_SelfVariables.rb,
scripts/01450 Systems/99990 Global Systems/01500 HoneyTree.rb,
scripts/00700 PSDK Event Interpreter/01150 Interpreter_Time.rb,
scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb,
scripts/00700 PSDK Event Interpreter/01205 Interpreter_Fiber.rb,
scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb,
scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb,
scripts/00700 PSDK Event Interpreter/01201 Interpreter_add_item.rb,
scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb,
scripts/00700 PSDK Event Interpreter/01102 Interpreter_Move_Reminder.rb,
scripts/00700 PSDK Event Interpreter/01101 Interpreter_Pokemon Internal.rb,
scripts/01450 Systems/09000 Games/00003 Ruine Alpha/00002 Ruine_Alpha_by_FL0RENT_.rb

Overview

Interpreter of the event script commands

Constant Summary collapse

FEC_SKIP_CODES =
[108, 121, 122]
MODE_SWOOSH =

If the put item in pocket message is not shown

true
RECEIVED_POKEMON_ME =

Name of the file used as Received Pokemon ME (with additional parameter like volume)

['audio/me/rosa_yourpokemonevolved', 80]
SYSTEM_MESSAGE_HEADER =

Header of the system messages

':[windowskin=m_18]:\\c[10]'
DEFAULT_TRAINER_BGM =

Default BGM used for trainer battle (sent to AudioFile so no audio/bgm)

['xy_trainer_battle', 100, 100]
DEFAULT_EYE_BGM =

Default eye bgm for trainer encounter (direct, requires audio/bgm)

['audio/bgm/pkmrs-enc1', 100, 100]
DEFAULT_EXCLAMATION_SE =

Default exclamation SE for trainer encounter (direct, requires audio/se)

['audio/se/015-jump01', 65, 95]
EXCLAMATION_PARTICLE_DURATION =

Duration of the exclamation particle

54

Constants included from Util::SystemMessage

Util::SystemMessage::HAS_NUMBER_REG, Util::SystemMessage::IS_ITEM, Util::SystemMessage::IS_NUMBER1, Util::SystemMessage::IS_NUMBER2, Util::SystemMessage::IS_NUMBER3, Util::SystemMessage::IS_POKEMON, Util::SystemMessage::MESSAGES

Constants inherited from Interpreter_RMXP

Interpreter_RMXP::COMMAND_TRANSLATION, Interpreter_RMXP::LiteRGSS2RGSS_Input, Interpreter_RMXP::RGSS2LiteRGSS_Input

Instance Attribute Summary

Attributes inherited from Interpreter_RMXP

#event_id

Instance Method Summary collapse

Methods included from Util::SystemMessage

load_message, parse_opts, show_message, show_message_and_wait

Methods inherited from Interpreter_RMXP

#clear, #command_101, #command_102, #command_103, #command_104, #command_105, #command_106, #command_111, #command_112, #command_113, #command_115, #command_116, #command_117, #command_118, #command_119, #command_121, #command_122, #command_123, #command_124, #command_125, #command_126, #command_127, #command_128, #command_129, #command_131, #command_132, #command_133, #command_134, #command_135, #command_136, #command_201, #command_202, #command_203, #command_204, #command_205, #command_206, #command_207, #command_208, #command_209, #command_210, #command_221, #command_222, #command_223, #command_224, #command_225, #command_231, #command_232, #command_233, #command_234, #command_235, #command_236, #command_241, #command_242, #command_245, #command_246, #command_247, #command_248, #command_249, #command_250, #command_251, #command_301, #command_302, #command_303, #command_311, #command_312, #command_313, #command_314, #command_315, #command_316, #command_317, #command_318, #command_319, #command_320, #command_321, #command_322, #command_331, #command_332, #command_333, #command_334, #command_335, #command_336, #command_337, #command_338, #command_339, #command_340, #command_351, #command_352, #command_353, #command_354, #command_355, #command_402, #command_403, #command_411, #command_413, #command_601, #command_602, #command_603, #command_end, #command_skip, #eval_condition_script, #eval_script, #execute_command, #get_character, #initialize, #input_button, #iterate_actor, #iterate_battler, #iterate_enemy, #launch_common_event, #operate_value, #running?, #setup, #setup_choices, #setup_starting_event, #update

Constructor Details

This class inherits a constructor from Interpreter_RMXP

Instance Method Details

#add_egg(id) ⇒ PFM::Pokemon? Also known as: ajouter_oeuf

Add an egg to the Party (or in the PC)

Parameters:

  • id (Integer, Hash, Symbol)

    the id of the Pokemon in the database

Returns:

Author:

  • Nuri Yuri



133
134
135
136
137
138
139
140
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 133

def add_egg(id)
  creature = data_creature(id.is_a?(Hash) ? id[:id].to_i : id)
  raise "Database Error : The Pokémon ##{id} doesn't exists." if creature.db_symbol == :__undef__

  pokemon = id.is_a?(Hash) ? PFM::Pokemon.generate_from_hash(id) : PFM::Pokemon.new(id, 1)
  pokemon.egg_init
  return add_pokemon(pokemon)
end

#add_item(item_id, no_delete = false, text_id: 4, no_space_text_id: 7, color: 11, count: 1)

Add an item to the bag if possible, will delete the event forever

Parameters:

  • item_id (Integer, Symbol)

    id of the item in the database

  • no_delete (Boolean) (defaults to: false)

    bypass the deletion of the event

  • text_id (Integer) (defaults to: 4)

    ID of the text used when the item is found

  • no_space_text_id (Integer) (defaults to: 7)

    ID of the text when the player has not enough space in the bag

  • count (Integer) (defaults to: 1)

    number of item to add

  • color (Integer) (defaults to: 11)

    color to put on the item name



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'scripts/00700 PSDK Event Interpreter/01201 Interpreter_add_item.rb', line 12

def add_item(item_id, no_delete = false, text_id: 4, no_space_text_id: 7, color: 11, count: 1)
  db_symbol = item_id.is_a?(Symbol) ? item_id : data_item(item_id).db_symbol

  if (max = Configs.settings.max_bag_item_count) > 0 && ($bag.item_quantity(db_symbol) + count) >= max
    add_item_no_space(db_symbol, no_space_text_id, color)
  else
    item_text, socket = add_item_show_message_got(db_symbol, text_id, color, count: count)
    # Pokemon Sword/Shield does not show this type of message
    # If you want your game to show it, change MODE_SWOOSH to false
    if count == 1 && !MODE_SWOOSH
      pocket_name = GamePlay::Bag::POCKET_NAMES[socket]
      pocket_name = send(*pocket_name) if pocket_name.is_a?(Array)
      show_message(
        :bag_store_item_in_pocket,
        item_1: item_text, header: SYSTEM_MESSAGE_HEADER,
        PFM::Text::TRNAME[0] => $trainer.name,
        '[VAR 0112(0002)]' => pocket_name
      )
    end
    $bag.add_item(db_symbol, count)
    delete_this_event_forever unless no_delete
  end

  @wait_count = 2
end

#add_items_to_limited_shop(symbol_of_shop, list_item_id_to_refill = [], list_quantity_to_refill = []) Also known as: ajouter_objets_magasin

Add items to a limited shop



22
23
24
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 22

def add_items_to_limited_shop(symbol_of_shop, list_item_id_to_refill = [], list_quantity_to_refill = [])
  PFM.game_state.shop.refill_limited_shop(symbol_of_shop, list_item_id_to_refill, list_quantity_to_refill)
end

#add_limited_shop(symbol_of_new_shop, list_of_item_id = [], list_of_item_quantity = [], shop_rewrite: false) Also known as: ajouter_un_magasin_limite

Create a limited shop (in the main PFM::Shop object)



16
17
18
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 16

def add_limited_shop(symbol_of_new_shop, list_of_item_id = [], list_of_item_quantity = [], shop_rewrite: false)
  PFM.game_state.shop.create_new_limited_shop(symbol_of_new_shop, list_of_item_id, list_of_item_quantity, shop_rewrite: shop_rewrite)
end

#add_new_pokemon_shop(sym_new_shop, list_id_mon, list_prices, list_param_mon, list_quantity_mon = [], shop_rewrite: false) Also known as: ajouter_nouveau_magasin_pokemon

Create a limited Pokemon Shop



45
46
47
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 45

def add_new_pokemon_shop(sym_new_shop, list_id_mon, list_prices, list_param_mon, list_quantity_mon = [], shop_rewrite: false)
  PFM.game_state.shop.create_new_pokemon_shop(sym_new_shop, list_id_mon, list_prices, list_param_mon, list_quantity_mon, shop_rewrite: shop_rewrite)
end

#add_parallax(image, x, y, z, zoom_x = 1, zoom_y = 1, opacity = 255, blend_type = 0)

Add a parallax

Parameters:

  • image (String)

    name of the image in Graphics/Pictures/

  • x (Integer)

    x coordinate of the parallax from the first pixel of the Map (16x16 tiles /!)

  • y (Integer)

    y coordinate of the parallax from the first pixel of the Map (16x16 tiles /!)

  • z (Integer)

    z superiority in the tile viewport

  • zoom_x (Numeric) (defaults to: 1)

    zoom_x of the parallax

  • zoom_y (Numeric) (defaults to: 1)

    zoom_y of the parallax

  • opacity (Integer) (defaults to: 255)

    opacity of the parallax (0~255)

  • blend_type (Integer) (defaults to: 0)

    blend_type of the parallax (0, 1, 2)



211
212
213
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 211

def add_parallax(*args)
  Yuki::Particles.add_parallax(*args)
end

#add_pokemon(pokemon_or_id, level = 5, shiny = false) ⇒ PFM::Pokemon? Also known as: ajouter_pokemon, ajouter_stocker_pokemon

Add a pokemon to the party or store it in the PC

Parameters:

  • pokemon_or_id (Integer, Symbol, PFM::Pokemon)

    the ID of the pokemon in the database or a Pokemon

  • level (Integer) (defaults to: 5)

    the level of the Pokemon (if ID given)

  • shiny (Boolean, Integer) (defaults to: false)

    true means the Pokemon will be shiny, 0 means it'll have no chance to be shiny, other number are the chance (1 / n) the pokemon can be shiny.

Returns:

  • (PFM::Pokemon, nil)

    if nil, the Pokemon couldn't be stored in the PC or added to the party. Otherwise it's the Pokemon that was added.

Author:

  • Nuri Yuri



8
9
10
11
12
13
14
15
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 8

def add_pokemon(pokemon_or_id, level = 5, shiny = false)
  return internal_add_pokemon_final(pokemon_or_id) if pokemon_or_id.is_a?(PFM::Pokemon)
  return internal_add_pokemon_check_level_shiny(pokemon_or_id, level, shiny, :add_pokemon) if pokemon_or_id.is_a?(Integer)
  return internal_add_pokemon_check_symbol(pokemon_or_id, level, shiny, :add_pokemon) if pokemon_or_id.is_a?(Symbol)
  raise 'Argument Error : Pokémon ID cannot be string' if pokemon_or_id.is_a?(String)

  nil
end

#add_pokemon_to_shop(symbol_of_shop, list_id_mon, list_prices, list_param_mon, list_quantity_mon = [], pkm_rewrite: false) Also known as: ajouter_pokemon_au_magasin

Add Pokemon to a Pokemon Shop



52
53
54
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 52

def add_pokemon_to_shop(symbol_of_shop, list_id_mon, list_prices, list_param_mon, list_quantity_mon = [], pkm_rewrite: false)
  PFM.game_state.shop.refill_pokemon_shop(symbol_of_shop, list_id_mon, list_prices, list_param_mon, list_quantity_mon, pkm_rewrite: pkm_rewrite)
end

#add_rename_pokemon(pokemon_or_id, level = 5, shiny = false, num_char = 12) ⇒ PFM::Pokemon? Also known as: ajouter_renommer_pokemon

Add a pokemon to the party or store it in the PC and rename it

Parameters:

  • pokemon_or_id (Integer, Symbol, PFM::Pokemon)

    the ID of the pokemon in the database or a Pokemon

  • level (Integer) (defaults to: 5)

    the level of the Pokemon (if ID given)

  • shiny (Boolean, Integer) (defaults to: false)

    true means the Pokemon will be shiny, 0 means it'll have no chance to be shiny, other number are the chance (1 / n) the pokemon can be shiny.

  • num_char (Integer) (defaults to: 12)

    the number of character the Pokemon can have in its name.

Returns:

  • (PFM::Pokemon, nil)

    if nil, the Pokemon couldn't be stored in the PC or added to the party. Otherwise it's the Pokemon that was added.

Author:

  • Nuri Yuri



122
123
124
125
126
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 122

def add_rename_pokemon(pokemon_or_id, level = 5, shiny = false, num_char = 12)
  pokemon = add_pokemon(pokemon_or_id, level, shiny)
  rename_pokemon(pokemon, num_char) if pokemon
  return pokemon
end

#add_specific_pokemon(hash) ⇒ PFM::Pokemon? Also known as: ajouter_pokemon_param

Add a pokemon (#add_pokemon) with specific informations.

Parameters:

  • hash (Hash)

    the parameters of the Pokemon, see PFM::Pokemon#generate_from_hash.

Returns:

Author:

  • Nuri Yuri



39
40
41
42
43
44
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 39

def add_specific_pokemon(hash)
  pokemon_id = hash[:id].to_i
  raise "Database Error : The Pokémon ##{pokemon_id} doesn't exists." if each_data_creature.none? { |creature| creature.id == pokemon_id }

  return add_pokemon(PFM::Pokemon.generate_from_hash(hash))
end

#animate_from_charset(lines, duration, reverse: false, repeat: false) ⇒ Boolean

Shortcut for get_character(@event_id).animate_from_charset(*args)

Parameters:

  • lines (Array<Integer>)

    list of the lines to animates (0,1,2,3)

  • duration (Integer)

    duration of the animation in frame (60frame per secondes)

  • reverse (Boolean) (defaults to: false)

    <default: false> set it to true if the animation is reversed

  • repeat (Boolean) (defaults to: false)

    <default: false> set it to true if the animation is looped

Returns:

  • (Boolean)


264
265
266
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 264

def animate_from_charset(lines, duration, reverse: false, repeat: false)
  return get_character(@event_id).animate_from_charset(lines, duration, reverse: reverse, repeat: repeat)
end

#call_battle_wild(id, level, shiny, no_shiny) #call_battle_wild(id, level, *args) #call_battle_wild(id, level, *args) Also known as: demarrer_combat

Start a wild battle

Overloads:

  • #call_battle_wild(id, level, shiny, no_shiny)

    Parameters:

    • id (Integer, Symbol)

      id of the Pokemon in the database

    • level (Integer)

      level of the Pokemon

    • shiny (Boolean)

      if the Pokemon is shiny

    • no_shiny (Boolean)

      if the Pokemon cannot be shiny

  • #call_battle_wild(id, level, *args)

    Parameters:

    • id (PFM::Pokemon, Symbol)

      First Pokemon in the wild battle.

    • level (Object)

      ignored

    • args (Array<PFM::Pokemon>)

      other pokemon in the wild battle.

  • #call_battle_wild(id, level, *args)

    Parameters:

    • id (Integer, Symbol)

      id of the Pokemon in the database

    • level (Integer)

      level of the first Pokemon

    • args (Array<Integer, Integer>)

      array of id, level of the other Pokemon in the wild battle.

Author:

  • Nuri Yuri



158
159
160
161
162
163
164
165
166
167
168
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 158

def call_battle_wild(id, level, *args)
  id = data_creature(id).id if id.is_a?(Symbol)
  # /!\ the following condition can trigger some bugs...
  if args[0].is_a?(Numeric) || args[0].is_a?(Symbol) || args[0].class == PFM::Pokemon || id.class == PFM::Pokemon
    args[0] = data_creature(args[0]).id if args[0].is_a?(Symbol)
    $wild_battle.start_battle(id, level, *args)
  else
    $wild_battle.start_battle(::PFM::Pokemon.new(id, level, args[0], args[1] == true))
  end
  @wait_count = 2
end

#call_party_menu(id_var = ::Yuki::Var::Party_Menu_Sel, party = $actors, mode = :map, extend_data = nil) Also known as: appel_menu_equipe

Show the party menu in order to select a Pokemon

Parameters:

  • id_var (Integer) (defaults to: ::Yuki::Var::Party_Menu_Sel)

    id of the variable in which the index will be store (-1 = no selection)

  • party (Array<PFM::Pokemon>) (defaults to: $actors)

    the array of Pokemon to show in the menu

  • mode (Symbol) (defaults to: :map)

    the mode of the Menu (:map, :menu, :item, :hold, :battle)

  • extend_data (Integer, PFM::ItemDescriptor::Wrapper, Array, Symbol) (defaults to: nil)

    extend_data informations

Author:

  • Nuri Yuri



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 168

def call_party_menu(id_var = ::Yuki::Var::Party_Menu_Sel, party = $actors, mode = :map, extend_data = nil)
  block = proc { |scene| $game_variables[id_var] = scene.return_data }
  case mode
  when :map
    GamePlay.open_party_menu_to_select_pokemon(party, &block)
  when :item
    GamePlay.open_party_menu_to_use_item(extend_data, party, &block)
  when :hold
    GamePlay.open_party_menu_to_give_item_to_pokemon(extend_data, party, &block)
  when :select
    GamePlay.open_party_menu_to_select_a_party(party, PFM.game_state.game_variables[Yuki::Var::Max_Pokemon_Select], extend_data)
    $game_variables[id_var] = -1
  when :absofusion
    GamePlay.open_party_menu_to_absofusion_pokemon(party, *extend_data)
    $game_variables[id_var] = -1
  when :separate
    GamePlay.open_party_menu_to_separate_pokemon(party, extend_data)
    $game_variables[id_var] = -1
  else
    GamePlay.open_party_menu(party, &block)
  end
  @wait_count = 2
end

#can_move_reminder_be_called?(mode = 0) ⇒ Boolean Also known as: maitre_capacites_appelable?

Detect if the move reminder can remind a move to the selected pokemon

Parameters:

Returns:

  • (Boolean)

    if the scene can be called



17
18
19
20
21
22
# File 'scripts/00700 PSDK Event Interpreter/01102 Interpreter_Move_Reminder.rb', line 17

def can_move_reminder_be_called?(mode = 0)
  var = $game_variables[::Yuki::Var::Party_Menu_Sel]
  return false if var < 0 || var >= $actors.size

  return $actors[var].remindable_skills(mode).any? && !$actors[var].egg?
end

#carte_du_monde(arg = :view, wm_id = $env.get_worldmap) Also known as: world_map

Open the world map

Parameters:

  • arg (Symbol) (defaults to: :view)

    the mode of the world map, :view or :fly

  • wm_id (Integer) (defaults to: $env.get_worldmap)

    the world map id to display

Author:

  • Nuri Yuri



121
122
123
124
125
126
127
128
129
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 121

def carte_du_monde(arg = :view, wm_id = $env.get_worldmap)
  arg = arg.bytesize == 3 ? :fly : :view if arg.instance_of?(String)
  if arg == :fly
    GamePlay.open_town_map_to_fly(wm_id)
  else
    GamePlay.open_town_map(wm_id)
  end
  @wait_count = 2
end

#casino(arg = :voltorb_flip, speed = 2)

Open the casino gameplay

Parameters:

  • arg (Symbol) (defaults to: :voltorb_flip)

    the mode of the casino :voltorb_flip, :slotmachine, …

  • speed (Integer) (defaults to: 2)

    speed of the slot machine

Author:

  • Nuri Yuri



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 279

def casino(arg = :voltorb_flip, speed = 2)
  return if $game_variables[Yuki::Var::CoinCase] <= 0

  case arg # Anticipate the creation of other casino scenes
  when :voltorb_flip
    casino = GamePlay::Casino::VoltorbFlip.new
  when :slotmachine
    casino = GamePlay::Casino::SlotMachine.new(speed)
  else
    return
  end
  casino.main
  Graphics.transition
  @wait_count = 2
end

#choice(variable_id, cancel_type, *choices)

Start a choice with more option than RMXP allows.

Parameters:

  • variable_id (Integer)

    the id of the Variable where the choice will be store.

  • cancel_type (Integer)

    the choice that cancel (-1 = no cancel)

  • choices (Array<String>)

    the list of possible choice.

Author:

  • Nuri Yuri



112
113
114
115
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 112

def choice(variable_id, cancel_type, *choices)
  setup_choices([choices, cancel_type])
  $game_temp.choice_proc = proc { |choix| $game_variables[variable_id] = choix + 1 }
end

#clear_saved_fog

Clear the saved fog



194
195
196
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 194

def clear_saved_fog
  $fog_info = nil
end

#cry_pokemon(id)

Play the cry of a Pokemon

Parameters:

  • id (Integer, Symbol)

    the id of the Pokemon in the database



91
92
93
94
95
96
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 91

def cry_pokemon(id)
  creature = data_creature(id)
  raise "Database Error : The Pokémon ##{id} doesn't exists." if creature.db_symbol == :__undef__

  Audio.se_play(format('Audio/SE/Cries/%03dCry', creature.id))
end

#current_timeInteger

Return the current time in minute

Returns:



4
5
6
7
8
9
10
# File 'scripts/00700 PSDK Event Interpreter/01150 Interpreter_Time.rb', line 4

def current_time
  return ((time = Time.new).to_i / 60 + time.gmtoff / 60) if $game_switches[Yuki::Sw::TJN_RealTime]
  $game_variables[Yuki::Var::TJN_Min] +
    $game_variables[Yuki::Var::TJN_Hour] * 60 +
    (($game_variables[Yuki::Var::TJN_MDay] - 1) % 7) * 1440 +
    ($game_variables[Yuki::Var::TJN_Week]) * 10_080
end

#delete_this_event_forever

Delete the current event forever



144
145
146
147
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 144

def delete_this_event_forever
  $env.set_event_delete_state(@event_id)
  $game_map.events[@event_id]&.erase
end

#detect_invalid_tile(x, y, width, height, tile_id) ⇒ Boolean

Detect if a specified tile (in layer 3) is in the specified zone

Examples:

To detect if there is non-cracked ice floor tile in a zone going from

X = 15 (included) to 24 and Y = 10 (included) to 15, you have to write : 
detect_invalid_tile(15, 10, 10, 6, 394)
To calculate tile_id the formula is this one : 384 + tileset_x + tileset_y * 8
For example : the tile is the third of the second line we then have tileset_x = 2, tileset_y = 1 which gives 394.

Parameters:

  • x (Integer)

    the coordinate x of the zone

  • y (Integer)

    the coordinate y of the zone

  • width (Integer)

    the width of the zone

  • height (Integer)

    the height of the zone

  • tile_id (Integer)

    the tile's id in the tileset

Returns:

  • (Boolean)

    “true” if the tile is detected in the zone, else “false”



171
172
173
174
175
176
177
178
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 171

def detect_invalid_tile(x, y, width, height, tile_id)
  ox = Yuki::MapLinker.get_OffsetX
  oy = Yuki::MapLinker.get_OffsetY
  rangex = (x + ox)...(x + ox + width)
  rangey = (y + oy)...(y + oy + height)
  gm = $game_map
  return rangex.any? { |tx| rangey.any? { |ty| gm.get_tile(tx, ty) == tile_id } }
end

#detect_player(nb_pas, direction) ⇒ Boolean

Detect the player in a specific direction

Parameters:

  • nb_pas (Integer)

    the number of step between the event and the player

  • direction (Symbol, Integer)

    the direction : :right, 6, :down, 2, :left, 4, :up or 8

Returns:

  • (Boolean)

Author:

  • Nuri Yuri



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 98

def detect_player(nb_pas, direction)
  return false if player_detection_disabled?

  c = $game_map.events[@event_id]
  dx = $game_player.x - c.x
  dy = $game_player.y - c.y
  case direction
  when :right, 6
    return (dy == 0 && dx >= 0 && dx <= nb_pas)
  when :down, 2
    return (dx == 0 && dy >= 0 && dy <= nb_pas)
  when :left, 4
    return (dy == 0 && dx <= 0 && dx >= -nb_pas)
  else
    return (dx == 0 && dy <= 0 && dy >= -nb_pas)
  end
end

#detect_player_circle(r) ⇒ Boolean

Detect the player in a circle around the event

Parameters:

  • r (Numeric)

    the square radius (r = R²) of the circle around the event

Returns:

  • (Boolean)

Author:

  • Nuri Yuri



134
135
136
137
138
139
140
141
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 134

def detect_player_circle(r)
  return false if player_detection_disabled?

  c = $game_map.events[@event_id]
  dx = $game_player.x - c.x
  dy = $game_player.y - c.y
  return ((dx * dx) + (dy * dy)) <= r
end

#detect_player_rect(nx, ny) ⇒ Boolean

Detect the player in a rectangle around the event

Parameters:

  • nx (Integer)

    the x distance of detection between the event and the player

  • ny (Integer)

    the y distance of detection between the event and the player

Returns:

  • (Boolean)

Author:

  • Nuri Yuri



121
122
123
124
125
126
127
128
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 121

def detect_player_rect(nx, ny)
  return false if player_detection_disabled?

  c = $game_map.events[@event_id]
  dx = ($game_player.x - c.x).abs
  dy = ($game_player.y - c.y).abs
  return (dx <= nx && dy <= ny)
end

#emotion(type, char_id = 0, wait = 34, params = {})

Note:

The available emotion type are :

  • :exclamation

  • :exclamation2

  • :poison

  • :interrogation

  • :music

  • :love

  • :joy

  • :sad

  • :happy

  • :angry

  • :sulk

  • :nocomment

Show an emotion to an event or the player

Examples:

Displaying the poison emotion :

emotion(:poison)

Displaying the poison emotion on the player (with offset) :

emotion(:poison, -1, 34, oy_offset: 10)

Parameters:

  • type (Symbol)

    the type of emotion (see wiki)

  • char_id (Integer) (defaults to: 0)

    the ID of the event (> 0), the current event (0) or the player (-1)

  • wait (Integer) (defaults to: 34)

    the number of frame the event will wait after this command.

  • params (Hash) (defaults to: {})

    particle



73
74
75
76
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 73

def emotion(type, char_id = 0, wait = 34, params = {})
  Yuki::Particles.add_particle(get_character(char_id), type, params)
  @wait_count = wait
end

#empty_and_save_party(id_storage = nil)

Save the team somewhere and make it empty in the point of view of the player.

Parameters:

  • id_storage (String) (defaults to: nil)

    the specific name of the storage, if nil sent to $storage.other_party

Author:

  • Nuri Yuri



174
175
176
177
178
179
180
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 174

def empty_and_save_party(id_storage = nil)
  var_id = id_storage ? "@_str_#{id_storage}".to_sym : :@other_party
  $actors.compact!
  party = Marshal.load(Marshal.dump($actors))
  $actors.clear
  $storage.instance_variable_set(var_id, party)
end

#event_calling(common_event, event_id) ⇒ Boolean

Check if an event is calling a common event (in its first non comment commands)

Parameters:

  • common_event (Integer)

    the id of the common event

  • event_id (Integer)

    the id of the event on the MAP

Returns:

  • (Boolean)


98
99
100
101
102
103
104
105
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 98

def event_calling(common_event, event_id)
  if (event = $game_map.events[event_id]) && event.list
    i = 0
    i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)
    return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event
  end
  return false
end

#fast_travel(x, y = nil, ms = 5)

Shortcut defining the pathfinding request and wait for the end of the path following

Parameters:

  • x (Integer)

    x coords to reach

  • y (Integer) (defaults to: nil)

    y coords to reach

  • ms (Integer) (defaults to: 5)

    <default : 5> movement speed



249
250
251
252
253
254
255
256
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 249

def fast_travel(x, y=nil, ms = 5)
  $game_player.move_speed = ms
  if y
    $game_player.find_path to: [x, y]
  else
    $game_player.find_path to: x, type: :Border
  end
end

#find_path(**kwargs)

Shortcut for get_character(@event_id).find_path(*args). Exemple : find_path to:, radius:5

Parameters:

  • to (Array<Integer, Integer>, Game_Character)

    the target, [x, y] or Game_Character object

  • radius (Integer)

    <default : 0> the distance from the target to consider it as reached

  • priority (Integer)

    <default : Pathfinding::PRIORITY_NORMAL> the priority in front of the other requests

  • tries (Integer, Symbol)

    <default : 5> the number of tries allowed to this request, use :infinity to unlimited tris count



236
237
238
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 236

def find_path(**kwargs)
  get_character(@event_id).find_path(**kwargs)
end

#force_save Also known as: forcer_sauvegarde

Save the game without asking



133
134
135
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 133

def force_save
  GamePlay::Save.save
end

#front_event_calling(common_event) ⇒ Boolean

Check if the front event calls a common event (in its first non comment commands)

Parameters:

  • common_event (Integer)

    the id of the common event in the database

Returns:

  • (Boolean)

Author:

  • Nuri Yuri



83
84
85
86
87
88
89
90
91
92
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 83

def front_event_calling(common_event)
  event = $game_player.front_tile_event
  if event&.list
    @event_id = event.id if @event_id == 0
    i = 0
    i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)
    return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event
  end
  return false
end

#ge(id = @event_id) ⇒ Game_Event

Return the $game_map.events

Returns:



34
35
36
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 34

def ge(id = @event_id)
  gm.events[id]
end

#get_local_variable(id_var) ⇒ Object #get_local_variable(id_var, operation, value = nil) ⇒ Object #get_local_variable(id_event, id_var) ⇒ Object #get_local_variable(id_event, id_var, operation, value = nil) ⇒ Object #get_local_variable(id_map, id_event, id_var) ⇒ Object #get_local_variable(id_map, id_event, id_var, operation, value = nil) ⇒ Object Also known as: VL, LV

Overloads:

  • #get_local_variable(id_var) ⇒ Object

    Get a local variable

    Parameters:

    • id_var (Symbol)

      the id of the variable

  • #get_local_variable(id_var, operation, value = nil) ⇒ Object

    Perform an operation on a local variable and get the result

    Parameters:

    • id_var (Symbol)

      the id of the variable

    • operation (Symbol)

      symbol of the operation to do on the variable

    • value (Object) (defaults to: nil)

      value associated to the operation

  • #get_local_variable(id_event, id_var) ⇒ Object

    Get a local variable of a specific event

    Parameters:

    • id_event (Integer)

      the id of the event

    • id_var (Symbol)

      the id of the variable

  • #get_local_variable(id_event, id_var, operation, value = nil) ⇒ Object

    Perform an operation on a local variable of an specific event and get the result

    Parameters:

    • id_event (Integer)

      the id of the event

    • id_var (Symbol)

      the id of the variable

    • operation (Symbol)

      symbol of the operation to do on the variable

    • value (Object) (defaults to: nil)

      value associated to the operation

  • #get_local_variable(id_map, id_event, id_var) ⇒ Object

    Get a local variable of a specific event on a specific map

    Parameters:

    • id_map (Integer)

      the id of the map

    • id_event (Integer)

      the id of the event

    • id_var (Symbol)

      the id of the variable

  • #get_local_variable(id_map, id_event, id_var, operation, value = nil) ⇒ Object

    Perform an operation on a local variable of an specific event on a specific map and get the result

    Parameters:

    • id_map (Integer)

      the id of the map

    • id_event (Integer)

      the id of the event

    • id_var (Symbol)

      the id of the variable

    • operation (Symbol)

      symbol of the operation to do on the variable

    • value (Object) (defaults to: nil)

      value associated to the operation

Returns:



104
105
106
107
108
109
110
111
112
113
# File 'scripts/00600 Script_RMXP/03100 Game_SelfVariables.rb', line 104

def get_local_variable(*args)
  if args.first.is_a?(Symbol) # [var_loc, operation, value]
    return $game_self_variables.do([@map_id, @event_id, args.first], args[1], args[2])
  elsif args[1].is_a?(Integer)# [map_id, event_id, var_loc, operation, value]
    return $game_self_variables.do([args.first, args[1], args[2]], args[3], args[4])
  else # [event_id, var_loc, operation, value]
    return $game_self_variables.do([@map_id, args.first, args[1]], args[2], args[3])
  end
  return nil
end

#get_self_switch(self_switch, event_id, map_id = @map_id) ⇒ Boolean Also known as: get_ss

Get the value of a self_switch

Parameters:

  • self_switch (String)

    the name of the self switch (“A”, “B”, “C”, “D”)

  • event_id (Integer)

    the id of the event that see the self switch

  • map_id (Integer) (defaults to: @map_id)

    the id of the map where the event see the self switch

Returns:

  • (Boolean)

    the value of the self switch

Author:

  • Leikt



157
158
159
160
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 157

def get_self_switch(self_switch, event_id, map_id = @map_id)
  key = [map_id, event_id, self_switch]  # Clef pour retrouver l'interrupteur local que l'on veut modifier
  return $game_self_switches[key]
end

#give_exp(index, amount)

Give a certain amount of exp to one Pokemon

Parameters:

  • index (Integer)

    the Pokemon index

  • amount (Integer)

    the amount of exp to give



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 336

def give_exp(index, amount)
  index = index.clamp(0, $actors.size - 1)
  return if $actors[index].level >= $pokemon_party.level_max_limit || $actors[index].egg?

  @amount = amount
  pokemon = $actors[index]
  exp_to_next_lvl = pokemon.exp_lvl - pokemon.exp

  while @amount >= exp_to_next_lvl
    break if pokemon.level >= $pokemon_party.level_max_limit

    pokemon.exp += exp_to_next_lvl
    @amount -= exp_to_next_lvl
    exp_to_next_lvl = pokemon.exp_lvl - pokemon.exp
    if pokemon.exp >= pokemon.exp_lvl
      pokemon.level_up_stat_refresh
      Audio.me_play(PFM::ItemDescriptor::LVL_SOUND)
      PFM::Text.set_num3(pokemon.level.to_s, 1)
      $scene.display_message_and_wait(parse_text(18, 62, '[VAR 010C(0000)]' => pokemon.given_name))
      PFM::Text.reset_variables
      pokemon.check_skill_and_learn
      id, form = pokemon.evolve_check
      GamePlay.make_pokemon_evolve(pokemon, id, form, true) if id
    end
  
  end

  pokemon.exp += @amount unless pokemon.level >= $pokemon_party.level_max_limit

end

#give_exp_all(amount)

Give a certain amount of exp to every Pokemon in party

Parameters:

  • amount (Integer)

    the amount of exp to give



369
370
371
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 369

def give_exp_all(amount)
  $actors.size.times { |i| give_exp(i, amount) }
end

#give_item(item_id, count = 1)

Give an item to the player

Parameters:

  • item_id (Integer, Symbol)

    id of the item in the database

  • count (Integer) (defaults to: 1)

    number of item



49
50
51
52
# File 'scripts/00700 PSDK Event Interpreter/01201 Interpreter_add_item.rb', line 49

def give_item(item_id, count = 1)
  text_id = data_item(item_id).socket == 5 ? 1 : 0
  add_item(item_id, true, text_id: text_id, count: count)
end

#give_level(index, amount)

Give a certain amount of level to one Pokemon

Parameters:

  • index (Integer)

    the Pokemon index

  • amount (Integer)

    the amount of level to give



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 376

def give_level(index, amount)
  return if $actors[index].level >= $pokemon_party.level_max_limit || $actors[index].egg?

  amount.times do |i|
    break if $actors[index].level >= $pokemon_party.level_max_limit

    $actors[index].level_up_stat_refresh
    Audio.me_play(PFM::ItemDescriptor::LVL_SOUND)
    PFM::Text.set_num3($actors[index].level.to_s, 1)
    $scene.display_message_and_wait(parse_text(18, 62, '[VAR 010C(0000)]' => $actors[index].given_name))
    PFM::Text.reset_variables
    $actors[index].check_skill_and_learn
    id, form = $actors[index].evolve_check
    GamePlay.make_pokemon_evolve($actors[index], id, form, true) if id
  end
end

#give_level_all(amount)

Give a certain amount of level to every Pokemon in party

Parameters:

  • amount (Integer)

    the amount of level to give



395
396
397
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 395

def give_level_all(amount)
  $actors.size.times { |i| give_level(i, amount) }
end

#gmGame_Map

Return the $game_map

Returns:



22
23
24
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 22

def gm
  $game_map
end

#gpGame_Player

Return the $game_player

Returns:



28
29
30
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 28

def gp
  $game_player
end

#gsGame_Switches

Return the $game_switches

Returns:



10
11
12
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 10

def gs
  $game_switches
end

#gtGame_Temp

Return the $game_temp

Returns:



16
17
18
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 16

def gt
  $game_temp
end

#gvGame_Variables

Return the $game_variables

Returns:



4
5
6
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 4

def gv
  $game_variables
end

#hall_of_fame(filename_bgm = 'audio/bgm/Hall-of-Fame', context_of_victory = :league)

Open the Hall of Fame UI

Parameters:

  • filename_bgm (String) (defaults to: 'audio/bgm/Hall-of-Fame')

    the bgm to play during the Hall of Fame

  • context_of_victory (Symbol) (defaults to: :league)

    the symbol to put as the context of victory



298
299
300
301
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 298

def hall_of_fame(filename_bgm = 'audio/bgm/Hall-of-Fame', context_of_victory = :league)
  GamePlay.open_hall_of_fame(filename_bgm, context_of_victory)
  @wait_count = 2
end

#honey_tree_event(id)

Function calling the honey tree event

Parameters:

  • id (Integer)

    ID of the honey tree



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'scripts/01450 Systems/99990 Global Systems/01500 HoneyTree.rb', line 154

def honey_tree_event(id)
  if PFM::HoneyTree.has_pokemon?(id) # There's a Pokemon
    show_message(:honey_tree_slathered)
    if PFM::HoneyTree.can_battle?(id)
      honey_data = PFM::HoneyTree.get(id)
      pokemon_id = PFM::HoneyTree::POKEMON_LISTS[honey_data[:column]][honey_data[:mon_index]]
      honey_data[:column] = 0 # Reset
      $wild_battle.start_battle(pokemon_id, rand(PFM::HoneyTree::LEVEL_RANGE))
    else
      honey_tree_slather_event(id)
    end
  else
    show_message(:honey_tree_sweet_scent)
    honey_tree_slather_event(id)
  end
end

#internal_add_pokemon_check_level_shiny(pokemon_id, level, shiny, method_name) ⇒ PFM::Pokemon

Check the input parameters and send the Pokemon to method_name

Parameters:

  • pokemon_id (Integer)

    ID of the Pokemon in the database

  • level (Integer)

    level of the Pokemon to add

  • shiny (Integer, Boolean)

    the shiny chance

  • method_name (Symbol)

    Method to use in order to add the Pokemon somewhere

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'scripts/00700 PSDK Event Interpreter/01101 Interpreter_Pokemon Internal.rb', line 36

def internal_add_pokemon_check_level_shiny(pokemon_id, level, shiny, method_name)
  do_not_add = false
  # Check parameters
  do_not_add = "Database Error : The Pokémon ##{pokemon_id} doesn't exists." if data_creature(pokemon_id).db_symbol == :__undef__
  if level < 1 || level > PFM.game_state.level_max_limit
    do_not_add << 10 if do_not_add
    do_not_add = "#{do_not_add}Level Error : level #{level} is out of bound."
  end
  raise do_not_add if do_not_add

  # Shiny attribute management
  shiny = rand(shiny) == 0 if shiny.is_a?(Integer) && shiny > 0
  pokemon = PFM::Pokemon.new(pokemon_id, level.abs, shiny, shiny == 0)
  return send(method_name, pokemon)
end

#internal_add_pokemon_check_symbol(pokemon_or_id, level, shiny, method_name) ⇒ PFM::Pokemon

Check the symbol of the Pokemon and send the Pokemon to method_name

Parameters:

  • pokemon_or_id (Symbol)

    Symbol ID of the Pokemon in the database

  • level (Integer)

    level of the Pokemon to add

  • shiny (Integer, Boolean)

    the shiny chance

  • method_name (Symbol)

    Method to use in order to add the Pokemon somewhere

Returns:



23
24
25
26
27
28
# File 'scripts/00700 PSDK Event Interpreter/01101 Interpreter_Pokemon Internal.rb', line 23

def internal_add_pokemon_check_symbol(pokemon_or_id, level, shiny, method_name)
  id = data_creature(pokemon_or_id).id
  raise "Database Error : The Pokémon #{pokemon_or_id} doesn't exists." if id == 0

  send(method_name, id, level, shiny)
end

#internal_add_pokemon_final(pokemon) ⇒ PFM::Pokemon

Try to add Pokemon to the party or store the Pokemon in the storage system

Parameters:

Returns:



5
6
7
8
9
10
11
12
13
14
15
# File 'scripts/00700 PSDK Event Interpreter/01101 Interpreter_Pokemon Internal.rb', line 5

def internal_add_pokemon_final(pokemon)
  return_value = PFM.game_state.add_pokemon(pokemon)
  if return_value.is_a?(Integer)
    $game_switches[Yuki::Sw::SYS_Stored] = true
  elsif return_value
    $game_switches[Yuki::Sw::SYS_Stored] = false
  else
    raise "Management Error :\nThe last Pokémon couldn't added to the team\nor to the storage system..."
  end
  return pokemon
end

#internal_store_pokemon_final(pokemon) ⇒ PFM::Pokemon

Try to add Pokemon to the party or store the Pokemon in the storage system

Parameters:

Returns:



55
56
57
58
59
60
# File 'scripts/00700 PSDK Event Interpreter/01101 Interpreter_Pokemon Internal.rb', line 55

def internal_store_pokemon_final(pokemon)
  return_value = $storage.store(pokemon)
  raise 'Management Error : The Pokemon couldn\'t be stored...' unless return_value
  $game_switches[Yuki::Sw::SYS_Stored] = true
  return pokemon
end

#message(string, cancel_type = 0, *choices) ⇒ Integer

Note:

This function should only be called from text events!

Show a message with eventually a choice

Examples:

Simple message

message("It's a message!")

Message from CSV files

message(ext_text(csv_id, index))

Message with choice

choice_result = message("You are wonkru or you are the enemy of wonkru!\nChoose !", 1, 'Wonkru', '*Knifed*')

Parameters:

  • string (String)

    message to show

  • cancel_type (Integer) (defaults to: 0)

    option used to cancel (1 indexed position, 0 means no cancel)

  • choices (Array<String>)

    all the possible choice

Returns:

  • (Integer)

    the choosen choice (0 indexed this time)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'scripts/00700 PSDK Event Interpreter/01205 Interpreter_Fiber.rb', line 14

def message(string, cancel_type = 0, *choices)
  return rmxp_message(string, 1, *choices) unless @fiber # RMXP Compatibility
  choice_result = 0
  # Return false to the interpreter while the last message is shown
  Fiber.yield(false) while $game_temp.message_text
  $game_player.look_to(@event_id) unless $game_switches[::Yuki::Sw::MSG_Noturn]
  # Give info to allow the interpreter to work correctly
  @message_waiting = true
  $game_temp.message_proc = proc { @message_waiting = false }
  # Give the message info to the message engine
  $game_temp.message_text = string
  # Give the choice info
  if choices.any?
    $game_temp.choice_cancel_type = cancel_type
    $game_temp.choices = choices
    $game_temp.choice_max = choices.size
    $game_temp.choice_proc = proc { |n| choice_result = n }
  end
  # Give the control back to the interpreter
  Fiber.yield(true)
  # Return the result to the event
  return choice_result
end

#mining_game(item_count, music_filename = GamePlay::MiningGame::DEFAULT_MUSIC) #mining_game(wanted_item_db_symbols, music_filename = GamePlay::MiningGame::DEFAULT_MUSIC)

Open the Mining Game UI

Overloads:

  • #mining_game(item_count, music_filename = GamePlay::MiningGame::DEFAULT_MUSIC)

    Parameters:

    • item_count (Integer)

      the number of items to search

    • music_filename (String) (defaults to: GamePlay::MiningGame::DEFAULT_MUSIC)

      the filename of the music to play

  • #mining_game(wanted_item_db_symbols, music_filename = GamePlay::MiningGame::DEFAULT_MUSIC)

    Parameters:

    • wanted_item_db_symbols (Array<Symbol>)

      the array containing the specific items (comprised between 1 and 5 items)

    • music_filename (String) (defaults to: GamePlay::MiningGame::DEFAULT_MUSIC)

      the filename of the music to play



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 310

def mining_game(param = nil, music_filename = GamePlay::MiningGame::DEFAULT_MUSIC, delete_after: true)
  message_id = $game_map.events[@event_id].event.name.downcase.include?('miningrock') ? 2 : 0
  if PFM.game_state.bag.contain_item?(:explorer_kit)
    if yes_no_choice(ext_text(9005, message_id))
      $game_system.bgm_memorize
      $game_system.bgm_fade(0.2)
      $scene.call_scene(GamePlay::MiningGame, param, music_filename, fade_out_params: [:mining_game, 0])
      $game_system.bgm_restore
      @wait_count = 2
      delete_this_event_forever if delete_after
    end
  else
    message(ext_text(9005, message_id + 1))
  end
end

#mirror_picture(id)

Mirror a RMXP Picture

Parameters:

  • id (Integer)

    the picture id

  • bool (Boolean)

    the mirroring state



329
330
331
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 329

def mirror_picture(id)
  $game_screen.pictures[id].mirror = true
end

#move_reminder(pokemon = $actors[$game_variables[::Yuki::Var::Party_Menu_Sel], mode = 0) ⇒ Boolean Also known as: maitre_capacites

Call the move reminder UI with the choosen Pokemon and a specific mode (0 by default)

Parameters:

Returns:

  • (Boolean)

    if the Pokemon learnt a move or not



6
7
8
9
10
11
# File 'scripts/00700 PSDK Event Interpreter/01102 Interpreter_Move_Reminder.rb', line 6

def move_reminder(pokemon = $actors[$game_variables[::Yuki::Var::Party_Menu_Sel]], mode = 0)
  result = false
  GamePlay.open_move_reminder(pokemon, mode) { |scene| result = scene.reminded_move? }
  @wait_count = 2
  return result
end

#npc_trade_sequence(index, pokemon)

Sequence that perform NPC trade

Parameters:

  • index (Integer)

    index of the Pokemon in the party

  • pokemon (PFM::Pokemon)

    Pokemon that is traded with



150
151
152
153
154
155
156
157
158
159
# File 'scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb', line 150

def npc_trade_sequence(index, pokemon)
  return unless $actors[index].is_a?(PFM::Pokemon)

  actor = $actors[index]
  $actors[index] = pokemon
  # TODO: Trade animation taking actor, pokemon (including messages)
  $scene.display_message("#{actor.given_name} is being traded with #{pokemon.name}")
  id, form = pokemon.evolve_check(:trade, pokemon)
  GamePlay.make_pokemon_evolve(pokemon, id, form, true) if id
end

#open_shop(items, prices) #open_shop(items, prices) Also known as: ouvrir_magasin

Open a shop

Overloads:

  • #open_shop(items, prices)

    Parameters:

    • items (Symbol)
    • prices (Hash)

      (optional)

  • #open_shop(items, prices)

    Parameters:

    • items (Array<Integer>)
    • prices (Hash)

      (optional)



9
10
11
12
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 9

def open_shop(items, prices = {}, show_background: true)
  $scene.call_scene(GamePlay::Shop, items, prices, show_background: show_background)
  @wait_count = 2
end

#partyPFM::GameState

Return the party object (game state)

Returns:



40
41
42
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 40

def party
  PFM.game_state
end

#pfm_textPFM::Text

Return the PFM::Text module

Returns:



217
218
219
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 217

def pfm_text
  return PFM::Text
end

#pick_item(item_id, count = 1, no_delete = false)

Pick an item on the ground (and delete the event)

Parameters:

  • item_id (Integer, Symbol)

    id of the item in the database

  • count (Integer) (defaults to: 1)

    number of item

  • no_delete (Boolean) (defaults to: false)

    if the event should not be delete forever



42
43
44
# File 'scripts/00700 PSDK Event Interpreter/01201 Interpreter_add_item.rb', line 42

def pick_item(item_id, count = 1, no_delete = false)
  add_item(item_id, no_delete, text_id: 4, count: count)
end

#player_spotted?(nb_pas) ⇒ Boolean Also known as: trainer_spotted

Detect if the event can spot the player and move to the player

Examples:

To detect the player 7 tiles in front of the event, put in a condition :

player_spotted?(7)

Parameters:

  • nb_pas (Integer)

    number of step the event should do to spot the player

Returns:

  • (Boolean)

    if the event spot the player or not

Author:

  • Nuri Yuri



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 9

def player_spotted?(nb_pas)
  return r = false if player_detection_disabled?

  c = $game_map.events[@event_id]
  # Detect if the player is too far away from the event
  return r = false if (c.x - $game_player.x).abs > nb_pas || (c.y - $game_player.y).abs > nb_pas
  return r = false if c.z != $game_player.z # Prevent detection when event & player arent both on a bridge
  return r = true if Input.trigger?(:A) && $game_player.front_tile_event == c # Ensure the player can force the event to detect from other sides

  it = c.each_front_tiles(nb_pas)
  # Find first tile where the event & the player overlaps
  px, py, * = it.find { |x, y| $game_player.x == x && $game_player.y == y }
  return false unless px && py

  # Find last tile where the event can move
  lx, ly, * = it.find { |x, y, d| !c.passable?(x, y, d) }
  return false unless lx && ly

  return r = ((lx - px).abs <= 1 && (ly - py).abs <= 1)
ensure
  # Stop the player from Running
  if r
    $game_switches[::Yuki::Sw::EV_Run] = false
    $game_temp.common_event_id = Game_CommonEvent::APPEARANCE
  end
end

#player_spotted_directional?(up: nil, down: nil, left: nil, right: nil) ⇒ Boolean

Detect if the event can spot the player and move to the player with direction relative detection

Examples:

The event turn left and bottom but does not have the same vision when turned bottom

player_spotted_directional?(left: 7, bottom: 3)

Parameters:

  • up (Integer) (defaults to: nil)

    number of step to the up direction

  • down (Integer) (defaults to: nil)

    number of step to the down direction

  • left (Integer) (defaults to: nil)

    number of step to the left direction

  • right (Integer) (defaults to: nil)

    number of step to the right direction

Returns:

  • (Boolean)

    if the event spotted the player



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 79

def player_spotted_directional?(up: nil, down: nil, left: nil, right: nil)
  case $game_map.events[@event_id].direction
  when 2
    return player_spotted?(down || up || left || right || 1)
  when 8
    return player_spotted?(up || down || left || right || 1)
  when 4
    return player_spotted?(left || right || up || down || 1)
  when 6
    return player_spotted?(right || left || up || down || 1)
  end
  return false
end

#player_spotted_rect?(nb_pas, dist) ⇒ Boolean Also known as: trainer_spotted_rect

Detect if the event can spot the player in a certain rect in frond of itself

Parameters:

  • nb_pas (Integer)

    number of step the event should do to spot the player

  • dist (Integer)

    distance in both side of the detection

Returns:

  • (Boolean)

    if the event spot the player or not



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 41

def player_spotted_rect?(nb_pas, dist)
  return r = false if player_detection_disabled?

  c = $game_map.events[@event_id]
  # Detect if the player is too far away from the event
  return r = false if (c.x - $game_player.x).abs > nb_pas || (c.y - $game_player.y).abs > nb_pas
  return r = false if c.z != $game_player.z # Prevent detection when event & player arent both on a bridge
  return r = true if Input.trigger?(:A) && $game_player.front_tile_event == c # Ensure the player can force the event to detect from other sides

  it = c.each_front_tiles_rect(nb_pas, dist)
  # Find first tile where the event & the player overlaps
  px, py, * = it.find { |x, y| $game_player.x == x && $game_player.y == y }
  return false unless px && py

  # Find last tile where the event can move
  lx, ly, * = it.find { |x, y, d| !c.passable?(x, y, d) }
  return false unless lx && ly || c.through

  lx = $game_player.x
  ly = $game_player.y
  return r = ((lx - px).abs <= 1 && (ly - py).abs <= 1)
ensure
  # Stop the player from Running
  if r
    $game_switches[::Yuki::Sw::EV_Run] = false
    $game_temp.common_event_id = Game_CommonEvent::APPEARANCE
  end
end

#pokemon_index(method_name, *args)

Return the index of the choosen Pokemon or call a method of GameState to find the right Pokemon

Parameters:

  • method_name (Symbol)

    identifier of the method

  • args (Array)

    parameters to send to the method



224
225
226
227
228
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 224

def pokemon_index(method_name, *args)
  index = $game_variables[Yuki::Var::Party_Menu_Sel].to_i
  index = party.send(method_name, *args) if index < 0
  return index
end

#pokemon_shop_open(symbol_or_list, prices = [], param = [], show_background: true) Also known as: ouvrir_magasin_pokemon

Open a Pokemon shop



34
35
36
37
38
39
40
41
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 34

def pokemon_shop_open(symbol_or_list, prices = [], param = [], show_background: true)
  if symbol_or_list.is_a?(Symbol)
    GamePlay.open_existing_pokemon_shop(symbol_or_list, prices.is_a?(Hash) ? prices : {}, show_background: show_background)
  else
    GamePlay.open_pokemon_shop(symbol_or_list, prices, param, show_background: show_background)
  end
  @wait_count = 2
end

#pokemon_stored_sequence(pokemon)

Show the “Pokemon was sent to BOX $” message

Parameters:



43
44
45
46
47
48
# File 'scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb', line 43

def pokemon_stored_sequence(pokemon)
  show_message(:pokemon_stored_to_box,
               pokemon: pokemon,
               '[VAR BOXNAME]' => $storage.get_box_name($storage.current_box),
               header: SYSTEM_MESSAGE_HEADER)
end

#puzzle_alpha(id = 1, id_switch = Yuki::Sw::RuinsVictory)



2
3
4
5
6
# File 'scripts/01450 Systems/09000 Games/00003 Ruine Alpha/00002 Ruine_Alpha_by_FL0RENT_.rb', line 2

def puzzle_alpha(id = 1, id_switch = Yuki::Sw::RuinsVictory)
  $game_switches[id_switch] = false
  $scene = GamePlay::Alph_Ruins_Puzzle.new(id, id_switch)
  @wait_count = 2
end

#quest_book Also known as: livre_quetes, quest_ui

Show the quest book



194
195
196
197
198
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 194

def quest_book
  GamePlay::QuestUI.new.main
  Graphics.transition
  @wait_count = 2
end

#receive_pokemon_sequence(pokemon_or_id, level = 5, shiny = false) ⇒ PFM::Pokemon?

Receive Pokemon sequence, when the player is given a Pokemon

Parameters:

  • pokemon_or_id (Integer, Symbol, PFM::Pokemon)

    the ID of the pokemon in the database or a Pokemon

  • level (Integer) (defaults to: 5)

    the level of the Pokemon (if ID given)

  • shiny (Boolean, Integer) (defaults to: false)

    true means the Pokemon will be shiny, 0 means it'll have no chance to be shiny, other number are the chance (1 / n) the pokemon can be shiny.

Returns:

  • (PFM::Pokemon, nil)

    if nil, the Pokemon couldn't be stored in the PC or added to the party. Otherwise it's the Pokemon that was added.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb', line 20

def receive_pokemon_sequence(pokemon_or_id, level = 5, shiny = false)
  pokemon = add_pokemon(pokemon_or_id, level, shiny)
  if pokemon
    Audio.me_play(*RECEIVED_POKEMON_ME)
    show_message(:received_pokemon, pokemon: pokemon, header: SYSTEM_MESSAGE_HEADER)
    original_name = pokemon.given_name
    while yes_no_choice(load_message(:give_nickname_question))
      rename_pokemon(pokemon)
      if pokemon.given_name == original_name ||
         yes_no_choice(load_message(:is_nickname_correct_qesion, pokemon: pokemon))
        break
      else
        pokemon.given_name = original_name
      end
    end
    pokemon_stored_sequence(pokemon) if $game_switches[Yuki::Sw::SYS_Stored]
    PFM::Text.reset_variables
  end
  return pokemon
end

#remove_items_from_limited_shop(symbol_of_shop, list_item_id_to_remove, list_quantity_to_remove) Also known as: enlever_objets_magasin

Remove items from a limited shop



28
29
30
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 28

def remove_items_from_limited_shop(symbol_of_shop, list_item_id_to_remove, list_quantity_to_remove)
  PFM.game_state.shop.remove_from_limited_shop(symbol_of_shop, list_item_id_to_remove, list_quantity_to_remove)
end

#remove_pokemon_from_shop(symbol_of_shop, remove_list_mon, param_form, list_quantity_to_remove = []) Also known as: enlever_pokemon_du_magasin

Remove Pokemon from a Pokemon Shop



59
60
61
# File 'scripts/00700 PSDK Event Interpreter/01301 Interpreter_Shop.rb', line 59

def remove_pokemon_from_shop(symbol_of_shop, remove_list_mon, param_form, list_quantity_to_remove = [])
  PFM.game_state.shop.remove_from_pokemon_shop(symbol_of_shop, remove_list_mon, param_form, list_quantity_to_remove)
end

#rename_pokemon(index_or_pokemon, num_char = 12) Also known as: renommer_pokemon

Show the rename interface of a Pokemon

Parameters:

  • index_or_pokemon (Integer, PFM::Pokemon)

    the Pokemon or the index of the Pokemon in the party (0~5)

  • num_char (Integer) (defaults to: 12)

    the number of character the Pokemon can have in its name.

Author:

  • Nuri Yuri



102
103
104
105
106
107
108
109
110
111
112
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 102

def rename_pokemon(index_or_pokemon, num_char = 12)
  if index_or_pokemon.is_a?(Integer)
    pokemon = $actors[index_or_pokemon]
    raise "IndexError : Pokemon at index #{index_or_pokemon} couldn't be found." unless pokemon
  else
    pokemon = index_or_pokemon
  end
  $scene.window_message_close(false) if $scene.class == Scene_Map
  GamePlay.open_pokemon_name_input(pokemon, num_char) { |name_input| pokemon.given_name = name_input.return_name }
  @wait_count = 2
end

#retrieve_saved_party(id_storage = nil) Also known as: retreive_saved_party

Retrieve the saved team when emptied ( /!\ empty the current team)

Parameters:

  • id_storage (String) (defaults to: nil)

    the specific name of the storage, if nil sent to $storage.other_party

Author:

  • Nuri Yuri



185
186
187
188
189
190
191
192
193
194
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 185

def retrieve_saved_party(id_storage = nil)
  var_id = id_storage ? "@_str_#{id_storage}".to_sym : :@other_party
  party = $storage.instance_variable_get(var_id)
  return nil if party.empty?
  $actors.each do |pokemon|
    $storage.store(pokemon)
  end
  $actors = PFM.game_state.actors = party
  $storage.remove_instance_variable(var_id) if id_storage
end

#retrieve_stolen_pokemon(id_storage = nil) Also known as: retreive_stolen_pokemon

Retrieve previously stolen Pokemon ( /!\ uses #add_pokemon)

Parameters:

  • id_storage (String) (defaults to: nil)

    the specific name of the storage, if nil sent to $storage.other_party

Author:

  • Nuri Yuri



220
221
222
223
224
225
226
227
228
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 220

def retrieve_stolen_pokemon(id_storage = nil)
  var_id = id_storage ? "@_str_#{id_storage}".to_sym : :@other_party
  party = $storage.instance_variable_get(var_id)
  return nil if party.empty?
  party.each do |pokemon|
    add_pokemon(pokemon) if pokemon
  end
  $storage.remove_instance_variable(var_id) if id_storage
end

#save_this_fogArray

Save the current fog

Returns:

  • (Array)

    the fog info



182
183
184
185
186
187
188
189
190
191
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 182

def save_this_fog
  $fog_info = [$game_map.fog_name,
                $game_map.fog_hue,
                $game_map.fog_opacity,
                $game_map.fog_blend_type,
                $game_map.fog_zoom,
                $game_map.fog_sx,
                $game_map.fog_sy
              ]
end

#set_local_variable(value, id_var, id_event = @event_id, id_map = @map_id) Also known as: set_VL, set_LV

Set a local variable

Parameters:

  • value (Object)

    the new value of the variable

  • id_var (Symbol)

    the id of the variable

  • id_event (Integer) (defaults to: @event_id)

    the id of the event

  • id_map (Integer) (defaults to: @map_id)

    the id of the map



122
123
124
125
# File 'scripts/00600 Script_RMXP/03100 Game_SelfVariables.rb', line 122

def set_local_variable(value, id_var, id_event = @event_id, id_map = @map_id)
  key = [id_map, id_event, id_var]
  $game_self_variables[key] = value
end

#set_self_switch(value, self_switch, event_id, map_id = @map_id) Also known as: set_ss

Set the value of a self_switch

Parameters:

  • value (Boolean)

    the new value of the switch

  • self_switch (String)

    the name of the self switch (“A”, “B”, “C”, “D”)

  • event_id (Integer)

    the id of the event that see the self switch

  • map_id (Integer) (defaults to: @map_id)

    the id of the map where the event see the self switch

Author:

  • Leikt



144
145
146
147
148
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 144

def set_self_switch(value, self_switch, event_id, map_id = @map_id) # Notre fonction
  key = [map_id, event_id, self_switch]  # Clef pour retrouver l'interrupteur local que l'on veut modifier
  $game_self_switches[key] = (value == true) # Modification de l'interrupteur local (on le veut à True ou à False)
  $game_map.events[event_id].refresh if $game_map.map_id == map_id # On rafraichi l'event s'il est sur la même map, pour qu'il prenne en compte la modification
end

#show_pokemon(pokemon) #show_pokemon(pokemon_id)

Show the Pokemon dex info

Overloads:

  • #show_pokemon(pokemon)

    Parameters:

  • #show_pokemon(pokemon_id)

    Parameters:

    • pokemon_id (Integer, Symbol)

      ID of the Pokemon in the dex



244
245
246
247
248
249
250
251
252
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 244

def show_pokemon(pokemon_id)
  pokemon_id = data_creature(pokemon_id).id if pokemon_id.is_a?(Symbol)
  if pokemon_id.is_a?(PFM::Pokemon)
    GamePlay.open_dex_to_show_pokemon(pokemon_id)
  else
    GamePlay.open_dex_to_show_page(pokemon_id)
  end
  @wait_count = 2
end

#skill_learn(pokemon, id_skill) ⇒ Boolean Also known as: enseigner_capacite

Learn a skill to a Pokemon

Parameters:

  • pokemon (PFM::Pokemon, Integer)

    the Pokemon that will learn the skill (use $actors for a Pokemon in the party). An integer will automatically search into the party

  • id_skill (Integer, Symbol)

    the id of the skill in the database

Returns:

  • (Boolean)

    if the move was learnt or not

Author:

  • Nuri Yuri



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 73

def skill_learn(pokemon, id_skill)
  pokemon = $actors[pokemon] if pokemon.is_a?(Integer)
  move = data_move(id_skill)
  raise "Database Error : Skill ##{id_skill} doesn't exists." if move.db_symbol == :__undef__
  raise "Pokemon Error: #{pokemon} doesn't exists" unless pokemon.is_a?(PFM::Pokemon)

  @wait_count = 2
  result = nil
  # Show the skill learn interface
  GamePlay.open_move_teaching(pokemon, move.db_symbol) do |scene|
    result = scene.learnt
  end
  return result
end

#start_double_trainer_battle(trainer_id, second_trainer_id, bgm: DEFAULT_TRAINER_BGM, disable: 'A', enable: 'B', troop_id: 3, &block)

Start a trainer battle

Parameters:

  • trainer_id (Integer)

    ID of the trainer in Ruby Host

  • second_trainer_id (Integer)

    ID of the second trainer in Ruby Host

  • bgm (String, Array) (defaults to: DEFAULT_TRAINER_BGM)

    BGM to play for battle

  • disable (String) (defaults to: 'A')

    Name of the local switch to disable (if defeat)

  • enable (String) (defaults to: 'B')

    Name of the local switch to enable (if victory)

  • troop_id (Integer) (defaults to: 3)

    ID of the troop to use : 3 = trainer, 4 = Gym Leader, 5 = Elite, 6 = Champion



87
88
89
90
# File 'scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb', line 87

def start_double_trainer_battle(trainer_id, second_trainer_id, bgm: DEFAULT_TRAINER_BGM, disable: 'A', enable: 'B', troop_id: 3, &block)
  start_trainer_battle(trainer_id, bgm: bgm, disable: disable, enable: enable, troop_id: troop_id, &block)
  $game_variables[Yuki::Var::Second_Trainer_ID] = second_trainer_id
end

#start_double_trainer_battle_with_friend(trainer_id, second_trainer_id, friend_trainer_id, bgm: DEFAULT_TRAINER_BGM, disable: 'A', enable: 'B', troop_id: 3, &block)

Start a trainer battle

Parameters:

  • trainer_id (Integer)

    ID of the trainer in Ruby Host

  • second_trainer_id (Integer)

    ID of the second trainer in Ruby Host

  • friend_trainer_id (Integer)

    ID of the friend trainer in Ruby Host

  • bgm (String, Array) (defaults to: DEFAULT_TRAINER_BGM)

    BGM to play for battle

  • disable (String) (defaults to: 'A')

    Name of the local switch to disable (if defeat)

  • enable (String) (defaults to: 'B')

    Name of the local switch to enable (if victory)

  • troop_id (Integer) (defaults to: 3)

    ID of the troop to use : 3 = trainer, 4 = Gym Leader, 5 = Elite, 6 = Champion



100
101
102
103
104
# File 'scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb', line 100

def start_double_trainer_battle_with_friend(trainer_id, second_trainer_id, friend_trainer_id, bgm: DEFAULT_TRAINER_BGM, disable: 'A', enable: 'B', troop_id: 3, &block)
  start_trainer_battle(trainer_id, bgm: bgm, disable: disable, enable: enable, troop_id: troop_id, &block)
  $game_variables[Yuki::Var::Second_Trainer_ID] = second_trainer_id
  $game_variables[Yuki::Var::Allied_Trainer_ID] = friend_trainer_id
end

#start_pc Also known as: demarrer_pc

Start the storage PC



45
46
47
48
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 45

def start_pc
  Audio.se_play('audio/se/computeropen')
  GamePlay.open_pokemon_storage_system
end

#start_trade(server)

Start an online Trade

Parameters:

  • server (Boolean)

    if the player is the server



233
234
235
236
237
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 233

def start_trade(server)
  GamePlay::Trade.new(server).main
  Graphics.transition
  @wait_count = 2
end

#start_trainer_battle(trainer_id, bgm: DEFAULT_TRAINER_BGM, disable: 'A', enable: 'B', troop_id: 3)

Start a trainer battle

Examples:

Start a simple trainer battle

start_trainer_battle(5) # 5 is the trainer 5 in Ruby Host

Start a trainer battle agains a gym leader

start_trainer_battle(5, bgm: '28 Pokemon Gym', troop_id: 4)

Parameters:

  • trainer_id (Integer)

    ID of the trainer in Ruby Host

  • bgm (String, Array) (defaults to: DEFAULT_TRAINER_BGM)

    BGM to play for battle

  • disable (String) (defaults to: 'A')

    Name of the local switch to disable (if defeat)

  • enable (String) (defaults to: 'B')

    Name of the local switch to enable (if victory)

  • troop_id (Integer) (defaults to: 3)

    ID of the troop to use : 3 = trainer, 4 = Gym Leader, 5 = Elite, 6 = Champion



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb', line 60

def start_trainer_battle(trainer_id, bgm: DEFAULT_TRAINER_BGM, disable: 'A', enable: 'B', troop_id: 3)
  set_self_switch(false, disable, @event_id) # Better to disable the switch here than in defeat
  original_battle_bgm = $game_system.battle_bgm
  $game_system.battle_bgm = RPG::AudioFile.new(*bgm)
  $game_variables[Yuki::Var::Trainer_Battle_ID] = trainer_id
  $game_temp.battle_abort = true
  $game_temp.battle_calling = true
  $game_temp.battle_troop_id = troop_id
  $game_temp.battle_can_escape = false
  $game_temp.battle_can_lose = false
  $game_temp.battle_proc = proc do |n|
    yield if block_given?
    $game_variables[Yuki::Var::Trainer_Battle_ID] = 0
    $game_variables[Yuki::Var::Second_Trainer_ID] = 0
    $game_variables[Yuki::Var::Allied_Trainer_ID] = 0
    set_self_switch(true, enable, @event_id) if n == 0
    $game_system.battle_bgm = original_battle_bgm
  end
end

#steal_pokemon(indexes, id_storage = nil, no_save = false)

Save some Pokemon of the team somewhere and remove them from the party

Parameters:

  • id_storage (String) (defaults to: nil)

    the specific name of the storage, if nil sent to $storage.other_party

  • indexes (Array, Range)

    list of index in the team

  • no_save (Boolean) (defaults to: false)

    if the Pokémon are not saved.

Author:

  • Nuri Yuri



202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 202

def steal_pokemon(indexes, id_storage = nil, no_save = false)
  pokemons = []
  indexes.each do |i|
    pokemons << $actors[i]
  end
  pokemons.compact!
  pokemons.each do |pokemon|
    $actors.delete(pokemon)
  end
  unless no_save
    var_id = id_storage ? "@_str_#{id_storage}".to_sym : :@other_party
    $storage.instance_variable_set(var_id, pokemons)
  end
end

#stop_path

Shortcut for get_character(@event_id).stop_path



241
242
243
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 241

def stop_path
  get_character(@event_id).stop_path
end

#store_pokemon(pokemon_or_id, level = 5, shiny = false) ⇒ PFM::Pokemon? Also known as: stocker_pokemon

Store a Pokemon in the PC

Parameters:

  • pokemon_or_id (Integer, Symbol, PFM::Pokemon)

    the ID of the pokemon in the database or a Pokemon

  • level (Integer) (defaults to: 5)

    the level of the Pokemon (if ID given)

  • shiny (Boolean, Integer) (defaults to: false)

    true means the Pokemon will be shiny, 0 means it'll have no chance to be shiny, other number are the chance (1 / n) the pokemon can be shiny.

Returns:

  • (PFM::Pokemon, nil)

    if nil, the Pokemon couldn't be stored in the PC. Otherwise it's the Pokemon that was added.

Author:

  • Nuri Yuri



25
26
27
28
29
30
31
32
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 25

def store_pokemon(pokemon_or_id, level = 5, shiny = false)
  return internal_store_pokemon_final(pokemon_or_id) if pokemon_or_id.is_a?(PFM::Pokemon)
  return internal_add_pokemon_check_level_shiny(pokemon_or_id, level, shiny, :store_pokemon) if pokemon_or_id.is_a?(Integer)
  return internal_add_pokemon_check_symbol(pokemon_or_id, level, shiny, :store_pokemon) if pokemon_or_id.is_a?(Symbol)
  raise 'Argument Error : Pokémon ID cannot be string' if pokemon_or_id.is_a?(String)

  nil
end

#timed_event_remaining_time(event_id = @event_id, map_id = @map_id) ⇒ Integer

Get the remaining time until the trigger (in minutes)

Parameters:

  • event_id (Integer) (defaults to: @event_id)

    event id that should be activated

  • map_id (Integer) (defaults to: @map_id)

    map where the event should be located

Returns:



32
33
34
# File 'scripts/00700 PSDK Event Interpreter/01150 Interpreter_Time.rb', line 32

def timed_event_remaining_time(event_id = @event_id, map_id = @map_id)
  return ($user_data.dig(:tjn_events, map_id, event_id)&.first || current_time) - current_time
end

#trainer_eye_sequence(phrase, eye_bgm: DEFAULT_EYE_BGM, exclamation_se: DEFAULT_EXCLAMATION_SE)

Sequence to call before start trainer battle

Examples:

Simple eye sequence

trainer_eye_sequence('Hello!')

Eye sequence with another eye_bgm

trainer_eye_sequence('Hello!', eye_bgm: 'audio/bgm/pkmrs-enc7')

Parameters:

  • phrase (String)

    the full speech of the trainer

  • eye_bgm (String, Array) (defaults to: DEFAULT_EYE_BGM)

    BGM to play during the speech

  • exclamation_se (String, Array) (defaults to: DEFAULT_EXCLAMATION_SE)

    SE to play when the trainer detect the player



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'scripts/00700 PSDK Event Interpreter/01300 Interpreter_Sequences.rb', line 114

def trainer_eye_sequence(phrase, eye_bgm: DEFAULT_EYE_BGM, exclamation_se: DEFAULT_EXCLAMATION_SE)
  character = get_character(@event_id)
  character.turn_toward_player
  front_coordinates = $game_player.front_tile
  # Unless the player triggered the event we show the exclamation
  unless character.x == front_coordinates.first && character.y == front_coordinates.last
    Audio.se_play(*exclamation_se)
    emotion(:exclamation)
    EXCLAMATION_PARTICLE_DURATION.times do
      $game_player.update
      $scene.spriteset.update
      Graphics.update
    end
  end
  Audio.bgm_play(*eye_bgm)
  # We move to the trainer
  while (($game_player.x - character.x).abs + ($game_player.y - character.y).abs) > 1
    character.move_toward_player
    while character.moving?
      $game_map.update
      $scene.spriteset.update
      Graphics.update
    end
  end
  $game_player.turn_toward_character(character)
  # We do the speech
  @message_waiting = true
  message = PFM::Text.parse_string_for_messages(phrase)
  $scene.display_message(message)
  @message_waiting = false
  @wait_count = 2
end

#trigger_event_in(amount_of_minutes, local_switch_letter, event_id = @event_id, map_id = @map_id)

Store a timed event (will enable the desired local switch when the timer reached the amount of minutes)

Examples:

Setting an event in 24h for the current event (local switch D)

trigger_event_in(24 * 60, 'D')

Parameters:

  • amount_of_minutes (Integer)

    number of minute from now to enable the switch

  • local_switch_letter (String)

    letter of the local switch to enable in order to trigger the event

  • event_id (Integer) (defaults to: @event_id)

    event id that should be activated

  • map_id (Integer) (defaults to: @map_id)

    map where the event should be located



19
20
21
22
23
24
25
26
# File 'scripts/00700 PSDK Event Interpreter/01150 Interpreter_Time.rb', line 19

def trigger_event_in(amount_of_minutes, local_switch_letter, event_id = @event_id, map_id = @map_id)
  next_time = current_time + amount_of_minutes
  # Store the event to trigger
  (($user_data[:tjn_events] ||= {})[map_id] ||= {})[event_id] = [next_time, local_switch_letter]
  # Set its local switch to false
  set_self_switch(false, local_switch_letter, event_id, map_id)
  $game_map.need_refresh = true
end

#wait_character_move_completion(event_id = @event_id) Also known as: attendre_fin_deplacement_cet_event, wait_event, attendre_event

Wait for the end of the movement of this particular character

Parameters:

  • event_id (Integer) (defaults to: @event_id)

    <default : calling event's> the id of the event to watch



151
152
153
154
# File 'scripts/00700 PSDK Event Interpreter/01000 Interpreter_Environnement.rb', line 151

def wait_character_move_completion(event_id = @event_id)
  @move_route_waiting = true
  @move_route_waiting_id = event_id
end

#wait_for_player Also known as: attendre_joueur

Shortcut for wait_character_move_completion(0) Wait for the end of the player movement



270
271
272
# File 'scripts/00700 PSDK Event Interpreter/01200 Interpreter_Shortcut.rb', line 270

def wait_for_player
  wait_character_move_completion 0
end

#withdraw_pokemon(id, counter = 1) Also known as: retirer_pokemon

withdraw a Pokemon from the Party

Parameters:

  • id (Integer, Symbol)

    the id of the Pokemon you want to withdraw

  • counter (Integer) (defaults to: 1)

    the number of Pokemon with this id to withdraw

Author:

  • Nuri Yuri



51
52
53
54
55
56
57
58
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 51

def withdraw_pokemon(id, counter = 1)
  id = data_creature(id).id
  $actors.delete_if do |pokemon|
    next false unless pokemon.id == id && counter > 0

    next(counter -= 1) # Any number are treaten as true
  end
end

#withdraw_pokemon_at(index) Also known as: retirer_pokemon_index

withdraw a Pokemon from the party at a specific position in the Party

Parameters:

  • index (Integer)

    the position (0~5) in the party.



63
64
65
# File 'scripts/00700 PSDK Event Interpreter/01100 Interpreter_Pokemon.rb', line 63

def withdraw_pokemon_at(index)
  $actors.delete_at(index)
end

#yes_no_choice(message, yes = nil, no = nil) ⇒ Boolean

Show a yes no choice

Examples:

Simple yes/no choice (in a condition)

yes_no_choice('Do you want to continue?')

Boy/Girl choice (in a condition, validation will mean boy)

yes_no_choice('Are you a boy?[WAIT 60] \nOr are you a girl?', 'Boy', 'Girl')

Parameters:

  • message (String)

    message shown by the event

  • yes (String) (defaults to: nil)

    string used as yes

  • no (String) (defaults to: nil)

    string used as no

Returns:

  • (Boolean)

    if the yes option was choosen



47
48
49
50
51
52
# File 'scripts/00700 PSDK Event Interpreter/01205 Interpreter_Fiber.rb', line 47

def yes_no_choice(message, yes = nil, no = nil)
  yes ||= text_get(11, 27)
  no ||= text_get(11, 28)
  return rmxp_message(message, 1, yes.dup, no.dup) == 0 unless @fiber # RMXP Compatibility
  return message(message, 2, yes.dup, no.dup) == 0
end