|
Home > RGSS Script Reference > Interpreter
Interpreter
Inherits from:
None
Description:
This class holds methods that execute the event commands you enter into the editor. Every running event represents an instance of this class.
class Interpreter
# ------------------------------------
def initialize(depth = 0, main = false)
@depth = depth
@main = main
if depth > 100
print("Event call stack overflow.")
exit
end
clear
end
# ------------------------------------
def clear
@map_id = 0
@event_id = 0
@message_waiting = false
@move_route_waiting = false
@button_input_variable_id = 0
@wait_count = 0
@child_interpreter = nil
@branch = {}
end
# ------------------------------------
def setup(list, event_id)
clear
@map_id = $game_map.map_id
@event_id = event_id
@list = list
@index = 0
@branch.clear
end
# ------------------------------------
def running?
return @list != nil
end
# ------------------------------------
def setup_starting_event
if $game_map.need_refresh
$game_map.refresh
end
if $game_temp.common_event_id > 0
setup($data_common_events[$game_temp.common_event_id].list, 0)
$game_temp.common_event_id = 0
return
end
for event in $game_map.events.values
if event.starting
if event.trigger < 3
event.clear_starting
event.lock
end
setup(event.list, event.id)
return
end
end
for common_event in $data_common_events.compact
if common_event.trigger == 1 and
$game_switches[common_event.switch_id] == true
setup(common_event.list, 0)
return
end
end
end
# ------------------------------------
def update
@loop_count = 0
loop do
@loop_count += 1
if @loop_count > 100
Graphics.update
@loop_count = 0
end
if $game_map.map_id != @map_id
@event_id = 0
end
if @child_interpreter != nil
@child_interpreter.update
unless @child_interpreter.running?
@child_interpreter = nil
end
if @child_interpreter != nil
return
end
end
if @message_waiting
return
end
if @move_route_waiting
if $game_player.move_route_forcing
return
end
for event in $game_map.events.values
if event.move_route_forcing
return
end
end
@move_route_waiting = false
end
if @button_input_variable_id > 0
input_button
return
end
if @wait_count > 0
@wait_count -= 1
return
end
if $game_temp.forcing_battler != nil
return
end
if $game_temp.battle_calling or
$game_temp.shop_calling or
$game_temp.name_calling or
$game_temp.menu_calling or
$game_temp.save_calling or
$game_temp.gameover
return
end
if @list == nil
if @main
setup_starting_event
end
if @list == nil
return
end
end
if execute_command == false
return
end
@index += 1
end
end
# ------------------------------------
def input_button
n = 0
for i in 1..18
if Input.trigger?(i)
n = i
end
end
if n > 0
$game_variables[@button_input_variable_id] = n
$game_map.need_refresh = true
@button_input_variable_id = 0
end
end
# ------------------------------------
def setup_choices(parameters)
$game_temp.choice_max = parameters[0].size
for text in parameters[0]
$game_temp.message_text += text + "\n"
end
$game_temp.choice_cancel_type = parameters[1]
current_indent = @list[@index].indent
$game_temp.choice_proc = Proc.new { |n| @branch[current_indent] = n }
end
# ------------------------------------
def iterate_actor(parameter)
if parameter == 0
for actor in $game_party.actors
yield actor
end
else
actor = $game_actors[parameter]
yield actor if actor != nil
end
end
# ------------------------------------
def iterate_enemy(parameter)
if parameter == -1
for enemy in $game_troop.enemies
yield enemy
end
else
enemy = $game_troop.enemies[parameter]
yield enemy if enemy != nil
end
end
# ------------------------------------
def iterate_battler(parameter1, parameter2)
if parameter1 == 0
iterate_enemy(parameter2) do |enemy|
yield enemy
end
else
if parameter2 == -1
for actor in $game_party.actors
yield actor
end
else
actor = $game_party.actors[parameter2]
yield actor if actor != nil
end
end
end
end
# ------------------------------------
def execute_command
if @index >= @list.size - 1
command_end
return true
end
@parameters = @list[@index].parameters
case @list[@index].code
when 101
return command_101
when 102
return command_102
when 402
return command_402
when 403
return command_403
when 103
return command_103
when 104
return command_104
when 105
return command_105
when 106
return command_106
when 111
return command_111
when 411
return command_411
when 112
return command_112
when 413
return command_413
when 113
return command_113
when 115
return command_115
when 116
return command_116
when 117
return command_117
when 118
return command_118
when 119
return command_119
when 121
return command_121
when 122
return command_122
when 123
return command_123
when 124
return command_124
when 125
return command_125
when 126
return command_126
when 127
return command_127
when 128
return command_128
when 129
return command_129
when 131
return command_131
when 132
return command_132
when 133
return command_133
when 134
return command_134
when 135
return command_135
when 136
return command_136
when 201
return command_201
when 202
return command_202
when 203
return command_203
when 204
return command_204
when 205
return command_205
when 206
return command_206
when 207
return command_207
when 208
return command_208
when 209
return command_209
when 210
return command_210
when 221
return command_221
when 222
return command_222
when 223
return command_223
when 224
return command_224
when 225
return command_225
when 231
return command_231
when 232
return command_232
when 233
return command_233
when 234
return command_234
when 235
return command_235
when 236
return command_236
when 241
return command_241
when 242
return command_242
when 245
return command_245
when 246
return command_246
when 247
return command_247
when 248
return command_248
when 249
return command_249
when 250
return command_250
when 251
return command_251
when 301
return command_301
when 601
return command_601
when 602
return command_602
when 603
return command_603
when 302
return command_302
when 303
return command_303
when 311
return command_311
when 312
return command_312
when 313
return command_313
when 314
return command_314
when 315
return command_315
when 316
return command_316
when 317
return command_317
when 318
return command_318
when 319
return command_319
when 320
return command_320
when 321
return command_321
when 322
return command_322
when 331
return command_331
when 332
return command_332
when 333
return command_333
when 334
return command_334
when 335
return command_335
when 336
return command_336
when 337
return command_337
when 338
return command_338
when 339
return command_339
when 340
return command_340
when 351
return command_351
when 352
return command_352
when 353
return command_353
when 354
return command_354
when 355
return command_355
else
return true
end
end
# ------------------------------------
def command_end
@list = nil
if @main and @event_id > 0
$game_map.events[@event_id].unlock
end
end
# ------------------------------------
def command_skip
indent = @list[@index].indent
loop do
if @list[@index+1].indent == indent
return true
end
@index += 1
end
end
# ------------------------------------
def get_character(parameter)
case parameter
when -1
return $game_player
when 0
return $game_map.events[@event_id]
else
return $game_map.events[parameter]
end
end
# ------------------------------------
def operate_value(operation, operand_type, operand)
if operand_type == 0
value = operand
else
value = $game_variables[operand]
end
if operation == 1
value = -value
end
return value
end
end
# ------------------------------------
def command_101
if $game_temp.message_text != nil
return false
end
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
$game_temp.message_text = @list[@index].parameters[0] + "\n"
line_count = 1
loop do
if @list[@index+1].code == 401
$game_temp.message_text += @list[@index+1].parameters[0] + "\n"
line_count += 1
else
if @list[@index+1].code == 102
if @list[@index+1].parameters[0].size <= 4 - line_count
@index += 1
$game_temp.choice_start = line_count
setup_choices(@list[@index].parameters)
end
elsif @list[@index+1].code == 103
if line_count < 4
@index += 1
$game_temp.num_input_start = line_count
$game_temp.num_input_variable_id = @list[@index].parameters[0]
$game_temp.num_input_digits_max = @list[@index].parameters[1]
end
end
return true
end
@index += 1
end
end
# ------------------------------------
def command_102
if $game_temp.message_text != nil
return false
end
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
$game_temp.message_text = ""
$game_temp.choice_start = 0
setup_choices(@parameters)
return true
end
# ------------------------------------
def command_402
if @branch[@list[@index].indent] == @parameters[0]
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
# ------------------------------------
def command_403
if @branch[@list[@index].indent] == 4
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
# ------------------------------------
def command_103
if $game_temp.message_text != nil
return false
end
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
$game_temp.message_text = ""
$game_temp.num_input_start = 0
$game_temp.num_input_variable_id = @parameters[0]
$game_temp.num_input_digits_max = @parameters[1]
return true
end
# ------------------------------------
def command_104
if $game_temp.message_window_showing
return false
end
$game_system.message_position = @parameters[0]
$game_system.message_frame = @parameters[1]
return true
end
# ------------------------------------
def command_105
@button_input_variable_id = @parameters[0]
@index += 1
return false
end
# ------------------------------------
def command_106
@wait_count = @parameters[0] * 2
return true
end
# ------------------------------------
def command_111
result = false
case @parameters[0]
when 0
result = ($game_switches[@parameters[1]] == (@parameters[2] == 0))
when 1
value1 = $game_variables[@parameters[1]]
if @parameters[2] == 0
value2 = @parameters[3]
else
value2 = $game_variables[@parameters[3]]
end
case @parameters[4]
when 0
result = (value1 == value2)
when 1
result = (value1 >= value2)
when 2
result = (value1 <= value2)
when 3
result = (value1 > value2)
when 4
result = (value1 < value2)
when 5
result = (value1 != value2)
end
when 2
if @event_id > 0
key = [$game_map.map_id, @event_id, @parameters[1]]
if @parameters[2] == 0
result = ($game_self_switches[key] == true)
else
result = ($game_self_switches[key] != true)
end
end
when 3
if $game_system.timer_working
sec = $game_system.timer / Graphics.frame_rate
if @parameters[2] == 0
result = (sec >= @parameters[1])
else
result = (sec <= @parameters[1])
end
end
when 4
actor = $game_actors[@parameters[1]]
if actor != nil
case @parameters[2]
when 0
result = ($game_party.actors.include?(actor))
when 1
result = (actor.name == @parameters[3])
when 2
result = (actor.skill_learn?(@parameters[3]))
when 3
result = (actor.weapon_id == @parameters[3])
when 4
result = (actor.armor1_id == @parameters[3] or
actor.armor2_id == @parameters[3] or
actor.armor3_id == @parameters[3])
when 5
result = (actor.state?(@parameters[3]))
end
end
when 5
enemy = $game_troop.enemies[@parameters[1]]
if enemy != nil
case @parameters[2]
when 0
result = (enemy.exist?)
when 1
result = (enemy.state?(@parameters[3]))
end
end
when 6
character = get_character(@parameters[1])
if character != nil
result = (character.direction == @parameters[2])
end
when 7
if @parameters[2] == 0
result = ($game_party.gold >= @parameters[1])
else
result = ($game_party.gold <= @parameters[1])
end
when 8
result = ($game_party.item_number(@parameters[1]) > 0)
when 9
result = ($game_party.weapon_number(@parameters[1]) > 0)
when 10
result = ($game_party.armor_number(@parameters[1]) > 0)
when 11
result = (Input.press?(@parameters[1]))
when 12
result = eval(@parameters[1])
end
@branch[@list[@index].indent] = result
if @branch[@list[@index].indent] == true
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
# ------------------------------------
def command_411
if @branch[@list[@index].indent] == false
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
# ------------------------------------
def command_112
return true
end
# ------------------------------------
def command_413
indent = @list[@index].indent
loop do
@index -= 1
if @list[@index].indent == indent
return true
end
end
end
# ------------------------------------
def command_113
indent = @list[@index].indent
temp_index = @index
loop do
temp_index += 1
if temp_index >= @list.size-1
return true
end
if @list[temp_index].code == 413 and @list[temp_index].indent < indent
@index = temp_index
return true
end
end
end
# ------------------------------------
def command_115
command_end
return true
end
# ------------------------------------
def command_116
if @event_id > 0
$game_map.events[@event_id].erase
end
@index += 1
return false
end
# ------------------------------------
def command_117
common_event = $data_common_events[@parameters[0]]
@child_interpreter = Interpreter.new(@depth + 1)
@child_interpreter.setup(common_event.list, @event_id)
return true
end
# ------------------------------------
def command_118
return true
end
# ------------------------------------
def command_119
label_name = @parameters[0]
temp_index = 0
loop do
if temp_index >= @list.size-1
return true
end
if @list[temp_index].code == 118 and
@list[temp_index].parameters[0] == label_name
@index = temp_index
return true
end
temp_index += 1
end
end
end
# ------------------------------------
def command_121
for i in @parameters[0] .. @parameters[1]
$game_switches[i] = (@parameters[2] == 0)
end
$game_map.need_refresh = true
return true
end
# ------------------------------------
def command_122
value = 0
case @parameters[3]
when 0
value = @parameters[4]
when 1
value = $game_variables[@parameters[4]]
when 2
value = @parameters[4] + rand(@parameters[5] - @parameters[4] + 1)
when 3
value = $game_party.item_number(@parameters[4])
when 4
actor = $game_actors[@parameters[4]]
case @parameters[5]
when 0
value = actor.level
when 1
value = actor.exp
when 2
value = actor.hp
when 3
value = actor.sp
when 4
value = actor.maxhp
when 5
value = actor.maxsp
when 6
value = actor.str
when 7
value = actor.dex
when 8
value = actor.agi
when 9
value = actor.int
when 10
value = actor.atk
when 11
value = actor.pdef
when 12
value = actor.mdef
when 13
value = actor.eva
end
when 5
enemy = $game_troop.enemies[@parameters[4]]
case @parameters[5]
when 0
value = enemy.hp
when 1
value = enemy.sp
when 2
value = enemy.maxhp
when 3
value = enemy.maxsp
when 4
value = enemy.str
when 5
value = enemy.dex
when 6
value = enemy.agi
when 7
value = enemy.int
when 8
value = enemy.atk
when 9
value = enemy.pdef
when 10
value = enemy.mdef
when 11
value = enemy.eva
end
when 6
character = get_character(@parameters[4])
case @parameters[5]
when 0
value = character.x
when 1
value = character.y
when 2
value = character.direction
when 3
value = character.screen_x
when 4
value = character.screen_y
when 5
value = character.terrain_tag
end
when 7
case @parameters[4]
when 0
value = $game_map.map_id
when 1
value = $game_party.actors.size
when 2
value = $game_party.gold
when 3
value = $game_party.steps
when 4
value = Graphics.frame_count / Graphics.frame_rate
when 5
value = $game_system.timer / Graphics.frame_rate
when 6
value = $game_system.save_count
end
end
for i in @parameters[0] .. @parameters[1]
case @parameters[2]
when 0
$game_variables[i] = value
when 1
$game_variables[i] += value
when 2
$game_variables[i] -= value
when 3
$game_variables[i] *= value
when 4
if value != 0
$game_variables[i] /= value
end
when 5
if value != 0
$game_variables[i] %= value
end
end
if $game_variables[i] > 99999999
$game_variables[i] = 99999999
end
if $game_variables[i] < -99999999
$game_variables[i] = -99999999
end
end
$game_map.need_refresh = true
return true
end
# ------------------------------------
def command_123
if @event_id > 0
key = [$game_map.map_id, @event_id, @parameters[0]]
$game_self_switches[key] = (@parameters[1] == 0)
end
$game_map.need_refresh = true
return true
end
# ------------------------------------
def command_124
if @parameters[0] == 0
$game_system.timer = @parameters[1] * Graphics.frame_rate
$game_system.timer_working = true
end
if @parameters[0] == 1
$game_system.timer_working = false
end
return true
end
# ------------------------------------
def command_125
value = operate_value(@parameters[0], @parameters[1], @parameters[2])
$game_party.gain_gold(value)
return true
end
# ------------------------------------
def command_126
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_item(@parameters[0], value)
return true
end
# ------------------------------------
def command_127
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_weapon(@parameters[0], value)
return true
end
# ------------------------------------
def command_128
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
$game_party.gain_armor(@parameters[0], value)
return true
end
# ------------------------------------
def command_129
if @parameters[1] == 0
if @parameters[2] == 1
$game_actors[@parameters[0]].setup(@parameters[0])
end
$game_party.add_actor(@parameters[0])
else
$game_party.remove_actor(@parameters[0])
end
return true
end
# ------------------------------------
def command_131
$game_system.windowskin_name = @parameters[0]
return true
end
# ------------------------------------
def command_132
$game_system.battle_bgm = @parameters[0]
return true
end
# ------------------------------------
def command_133
$game_system.battle_end_me = @parameters[0]
return true
end
# ------------------------------------
def command_134
$game_system.save_disabled = (@parameters[0] == 0)
return true
end
# ------------------------------------
def command_135
$game_system.menu_disabled = (@parameters[0] == 0)
return true
end
# ------------------------------------
def command_136
$game_system.encounter_disabled = (@parameters[0] == 0)
$game_player.make_encounter_count
return true
end
end
# ------------------------------------
def command_201
if $game_temp.player_transferring or
$game_temp.message_window_showing or
$game_temp.transition_processing
return false
end
$game_temp.player_transferring = true
if @parameters[0] == 0
$game_temp.player_new_map_id = @parameters[1]
$game_temp.player_new_x = @parameters[2]
$game_temp.player_new_y = @parameters[3]
$game_temp.player_new_direction = @parameters[4]
else
$game_temp.player_new_map_id = $game_variables[@parameters[1]]
$game_temp.player_new_x = $game_variables[@parameters[2]]
$game_temp.player_new_y = $game_variables[@parameters[3]]
$game_temp.player_new_direction = @parameters[4]
end
@index += 1
if @parameters[5] == 0
Graphics.freeze
$game_temp.transition_processing = true
$game_temp.transition_name = ""
end
return false
end
# ------------------------------------
def command_202
character = get_character(@parameters[0])
if character == nil
return true
end
if @parameters[1] == 0
character.moveto(@parameters[2], @parameters[3])
elsif @parameters[1] == 1
character.moveto($game_variables[@parameters[2]],
$game_variables[@parameters[3]])
else
old_x = character.x
old_y = character.y
character2 = get_character(@parameters[2])
character.moveto(character2.x, character2.y)
character2.moveto(old_x, old_y)
end
case @parameters[4]
when 8
character.turn_up
when 6
character.turn_right
when 2
character.turn_down
when 4
character.turn_left
end
return true
end
# ------------------------------------
def command_203
if $game_map.scrolling?
return false
end
$game_map.start_scroll(@parameters[0], @parameters[1], @parameters[2])
return true
end
# ------------------------------------
def command_204
case @parameters[0]
when 0
$game_map.panorama_name = @parameters[1]
$game_map.panorama_hue = @parameters[2]
when 1
$game_map.fog_name = @parameters[1]
$game_map.fog_hue = @parameters[2]
$game_map.fog_opacity = @parameters[3]
$game_map.fog_blend_type = @parameters[4]
$game_map.fog_zoom = @parameters[5]
$game_map.fog_sx = @parameters[6]
$game_map.fog_sy = @parameters[7]
when 2
$game_map.battleback_name = @parameters[1]
$game_temp.battleback_name = @parameters[1]
end
return true
end
# ------------------------------------
def command_205
$game_map.start_fog_tone_change(@parameters[0], @parameters[1] * 2)
return true
end
# ------------------------------------
def command_206
$game_map.start_fog_opacity_change(@parameters[0], @parameters[1] * 2)
return true
end
# ------------------------------------
def command_207
character = get_character(@parameters[0])
if character == nil
return true
end
character.animation_id = @parameters[1]
return true
end
# ------------------------------------
def command_208
$game_player.transparent = (@parameters[0] == 0)
return true
end
# ------------------------------------
def command_209
character = get_character(@parameters[0])
if character == nil
return true
end
character.force_move_route(@parameters[1])
return true
end
# ------------------------------------
def command_210
unless $game_temp.in_battle
@move_route_waiting = true
end
return true
end
# ------------------------------------
def command_221
if $game_temp.message_window_showing
return false
end
Graphics.freeze
return true
end
# ------------------------------------
def command_222
if $game_temp.transition_processing
return false
end
$game_temp.transition_processing = true
$game_temp.transition_name = @parameters[0]
@index += 1
return false
end
# ------------------------------------
def command_223
$game_screen.start_tone_change(@parameters[0], @parameters[1] * 2)
return true
end
# ------------------------------------
def command_224
$game_screen.start_flash(@parameters[0], @parameters[1] * 2)
return true
end
# ------------------------------------
def command_225
$game_screen.start_shake(@parameters[0], @parameters[1],
@parameters[2] * 2)
return true
end
# ------------------------------------
def command_231
number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
if @parameters[3] == 0
x = @parameters[4]
y = @parameters[5]
else
x = $game_variables[@parameters[4]]
y = $game_variables[@parameters[5]]
end
$game_screen.pictures[number].show(@parameters[1], @parameters[2],
x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
return true
end
# ------------------------------------
def command_232
number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
if @parameters[3] == 0
x = @parameters[4]
y = @parameters[5]
else
x = $game_variables[@parameters[4]]
y = $game_variables[@parameters[5]]
end
$game_screen.pictures[number].move(@parameters[1] * 2, @parameters[2],
x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
return true
end
# ------------------------------------
def command_233
number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
$game_screen.pictures[number].rotate(@parameters[1])
return true
end
# ------------------------------------
def command_234
number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
$game_screen.pictures[number].start_tone_change(@parameters[1],
@parameters[2] * 2)
return true
end
# ------------------------------------
def command_235
number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
$game_screen.pictures[number].erase
return true
end
# ------------------------------------
def command_236
$game_screen.weather(@parameters[0], @parameters[1], @parameters[2])
return true
end
# ------------------------------------
def command_241
$game_system.bgm_play(@parameters[0])
return true
end
# ------------------------------------
def command_242
$game_system.bgm_fade(@parameters[0])
return true
end
# ------------------------------------
def command_245
$game_system.bgs_play(@parameters[0])
return true
end
# ------------------------------------
def command_246
$game_system.bgs_fade(@parameters[0])
return true
end
# ------------------------------------
def command_247
# BGM / BGS ???
$game_system.bgm_memorize
$game_system.bgs_memorize
return true
end
# ------------------------------------
def command_248
$game_system.bgm_restore
$game_system.bgs_restore
return true
end
# ------------------------------------
def command_249
$game_system.me_play(@parameters[0])
return true
end
# ------------------------------------
def command_250
$game_system.se_play(@parameters[0])
return true
end
# ------------------------------------
def command_251
Audio.se_stop
return true
end
end
# ------------------------------------
def command_301
$game_temp.battle_abort = true
$game_temp.battle_calling = true
$game_temp.battle_troop_id = @parameters[0]
$game_temp.battle_can_escape = @parameters[1]
$game_temp.battle_can_lose = @parameters[2]
current_indent = @list[@index].indent
$game_temp.battle_proc = Proc.new { |n| @branch[current_indent] = n }
@index += 1
return false
end
# ------------------------------------
def command_601
if @branch[@list[@index].indent] == 0
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
# ------------------------------------
def command_602
if @branch[@list[@index].indent] == 1
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
# ------------------------------------
def command_603
if @branch[@list[@index].indent] == 1
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
# ------------------------------------
def command_302
$game_temp.battle_abort = true
$game_temp.shop_calling = true
$game_temp.shop_goods = [@parameters]
loop do
@index += 1
if @list[@index].code == 605
$game_temp.shop_goods.push(@list[@index].parameters)
else
return false
end
end
end
# ------------------------------------
def command_303
$game_temp.battle_abort = true
$game_temp.name_calling = true
$game_temp.name_actor_id = @parameters[0]
$game_temp.name_max_char = @parameters[1]
@index += 1
return false
end
# ------------------------------------
def command_311
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
iterate_actor(@parameters[0]) do |actor|
if actor.hp > 0
actor.hp += value
if @parameters[4] == false and actor.hp == 0
actor.hp = 1
end
end
end
$game_temp.gameover = $game_party.all_dead?
return true
end
# ------------------------------------
def command_312
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
iterate_actor(@parameters[0]) do |actor|
actor.sp += value
end
return true
end
# ------------------------------------
def command_313
iterate_actor(@parameters[0]) do |actor|
if @parameters[1] == 0
actor.add_state(@parameters[2])
else
actor.remove_state(@parameters[2])
end
end
return true
end
# ------------------------------------
def command_314
iterate_actor(@parameters[0]) do |actor|
actor.recover_all
end
return true
end
# ------------------------------------
def command_315
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
iterate_actor(@parameters[0]) do |actor|
actor.exp += value
end
return true
end
# ------------------------------------
def command_316
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
iterate_actor(@parameters[0]) do |actor|
actor.level += value
end
return true
end
# ------------------------------------
def command_317
value = operate_value(@parameters[2], @parameters[3], @parameters[4])
actor = $game_actors[@parameters[0]]
case @parameters[1]
when 0
actor.maxhp += value
when 1
actor.maxsp += value
when 2
actor.str += value
when 3
actor.dex += value
when 4
actor.agi += value
when 5
actor.int += value
end
return true
end
# ------------------------------------
def command_318
actor = $game_actors[@parameters[0]]
if @parameters[1] == 0
actor.learn_skill(@parameters[2])
else
actor.forget_skill(@parameters[2])
end
return true
end
# ------------------------------------
def command_319
$game_actors[@parameters[0]].equip(@parameters[1], @parameters[2])
return true
end
# ------------------------------------
def command_320
$game_actors[@parameters[0]].name = @parameters[1]
return true
end
# ------------------------------------
def command_321
$game_actors[@parameters[0]].class_id = @parameters[1]
return true
end
# ------------------------------------
def command_322
$game_actors[@parameters[0]].set_graphic(@parameters[1],
@parameters[2], @parameters[3], @parameters[4])
$game_player.refresh
return true
end
end
# ------------------------------------
def command_331
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
iterate_enemy(@parameters[0]) do |enemy|
if enemy.hp > 0
enemy.hp += value
if @parameters[4] == false and enemy.hp == 0
enemy.hp = 1
end
end
end
return true
end
# ------------------------------------
def command_332
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
iterate_enemy(@parameters[0]) do |enemy|
enemy.sp += value
end
return true
end
# ------------------------------------
def command_333
iterate_enemy(@parameters[0]) do |enemy|
if $data_states[@parameters[2]].zero_hp
enemy.immortal = false
end
if @parameters[1] == 0
enemy.add_state(@parameters[2])
else
enemy.remove_state(@parameters[2])
end
end
return true
end
# ------------------------------------
def command_334
iterate_enemy(@parameters[0]) do |enemy|
enemy.recover_all
end
return true
end
# ------------------------------------
def command_335
enemy = $game_troop.enemies[@parameters[0]]
enemy.hidden = false
return true
end
# ------------------------------------
def command_336
enemy = $game_troop.enemies[@parameters[0]]
enemy.transform(@parameters[1])
return true
end
# ------------------------------------
def command_337
iterate_battler(@parameters[0], @parameters[1]) do |battler|
if battler.exist?
battler.animation_id = @parameters[2]
end
end
return true
end
# ------------------------------------
def command_338
value = operate_value(0, @parameters[2], @parameters[3])
iterate_battler(@parameters[0], @parameters[1]) do |battler|
if battler.exist?
battler.hp -= value
if $game_temp.in_battle
battler.damage = value
battler.damage_pop = true
end
end
end
return true
end
# ------------------------------------
def command_339
unless $game_temp.in_battle
return true
end
iterate_battler(@parameters[0], @parameters[1]) do |battler|
if battler.exist?
battler.current_action.kind = @parameters[2]
if battler.current_action.kind == 0
battler.current_action.basic = @parameters[3]
else
battler.current_action.skill_id = @parameters[3]
end
if @parameters[4] == -2
if battler.is_a?(Game_Enemy)
battler.current_action.decide_last_target_for_enemy
else
battler.current_action.decide_last_target_for_actor
end
elsif @parameters[4] == -1
if battler.is_a?(Game_Enemy)
battler.current_action.decide_random_target_for_enemy
else
battler.current_action.decide_random_target_for_actor
end
elsif @parameters[4] >= 0
battler.current_action.target_index = @parameters[4]
end
if battler.current_action.valid? and @parameters[5] == 1
$game_temp.forcing_battler = battler
@index += 1
return false
end
end
end
return true
end
# ------------------------------------
def command_340
$game_temp.battle_abort = true
return false
end
# ------------------------------------
def command_351
$game_temp.battle_abort = true
$game_temp.menu_calling = true
@index += 1
return false
end
# ------------------------------------
def command_352
$game_temp.battle_abort = true
$game_temp.save_calling = true
@index += 1
return false
end
# ------------------------------------
def command_353
$game_temp.gameover = true
return false
end
# ------------------------------------
def command_354
$game_temp.to_title = true
return false
end
# ------------------------------------
def command_355
script = @list[@index].parameters[0] + "\n"
loop do
if @list[@index+1].code == 655
script += @list[@index+1].parameters[0] + "\n"
else
break
end
@index += 1
end
result = eval(script)
if result == false
return false
end
return true
end
end
|
Map_ID:
The map ID of the event when it starts. Note that event executions can
continue even if the current map changes. This value won't be updated if this happens.
Event_ID:
The event ID of the event.
Message_Waiting:
This flag is set if the game is waiting for the player to push a button to
advance the message window.
Move_Route_Waiting:
This flag is set if the event is waiting because a "Proceed with Movement"
command has stopped all events from executing until a "Move Event" command has finished.
Button_Input_Variable_ID:
The variable ID in which to store the code for the key being pressed. Used with the "Key Input Processing" event command.
Wait_Count:
The number of frames to wait due to a "Wait" event command.
Child_Interpreter: If this event has called another event, then this variable holds the Interpreter object associated with it.
Branch: A hash table. The keys are indent levels and the values are either booleans or integers that determine which branch the event should take when presented with an event command that can cause branching.
List: The list of event commands in the event.
Index:
A pointer to the next event command to execute. Each event command you enter in the editor increases the possible value of this variable by 1, except for commands the have case handling, such as Conditional Branch and Enemy Encounter, which add more than one index.
Loop_Count: The loop counter for updating the graphics. This counter is incremented once per frame, and that graphics are updated when the counter reaches 100.
Parameters:
An array of parameters being passed to an event command. The number and type of parameters differ for each event command.
Main: This flag is set if this interpreter is the main interpreter. That is, this interpreter was not created as the result of another event calling this event.
Initialize
Arguments:
Depth: The depth of the call stack of this interpreter. Assumed to be 0 if not specified.
Main: A flag telling whether this interpreter is the main interpreter. That is, the interpreter was not created as the result of another event calling this event. Assumed to be false if not specified.
Local Variables:
None
How it Works: Sets the values of @depth and @main instance variables. Also, if the call stack is over 100 elements high, the game will suffer a stack overflow and end.
Clear
Arguments:
None
Local Variables:
None
How it Works: This method clears the instance variables associated with an interpreter.
Setup
Arguments:
List: The list of event commands.
Event_ID: The event ID of the current event.
Local Variables:
None
How it Works: This method sets up the event by first clearing the existing data, then setting the map ID, event ID, and event command list. It then sets the event pointer to the beginning of the command list and clears the branch hash table.
Running?
Arguments:
None
Local Variables:
None
How it Works: Returns true if there is at least one event command in the event command list. Otherwise,
it returns false.
Setup_Starting_Event
Arguments:
None
Local Variables:
None
How it Works: This method starts a non-parallel event that has been triggered. The method first refreshes the map if it needs to be refreshed. Since the same method is used to start both common events and map events, it needs to check which type of event needs to be started. It first checks to see if $game_temp.common_event_id is greater than 0 (meaning a common event is waiting to start). If it is, then the setup method is called and no further processing is done. If no common event is starting, then the for loop iterates through each map event and checks to see if its @starting flag is set and it isn't a parallel process event. If it is, then the event's @starting flag is cleared and the event's facing is locked. For information about how the @starting flag works, please see the Game_Event class description. Finally, it checks for common events with the Auto Start property (trigger == 1). If the switch associated with the Auto Start common event is ON, the event is set up.
Update
Arguments:
None
Local Variables:
None
How it Works: The frame update method for this class. The method first sets the value of @loop_count to zero. The main loop of this method iterates until broken by one of the conditions described below. To prevent freezing, each time @loop_count reaches 100, the graphics are updated. The next check sets the value of @event_id to 0 if the current map isn't the same as the map on which the event started ("orphaned interpreter"). The next if statement checks to see if the event has spawned a child interpreter. If it has, and that event has 1 or more event commands in its command list, the method terminates, allowing the child interpreter to take over. If the @message_waiting flag is set, the method terminates. The next two statements check to see if either the player or an event is being forced to move by a "Move Event" command. If any are, the event is terminated. Next, the input_button method is called if the value of @button_input_variable_id has been set by a "Key Input Processing" event command. Next, if the event is waiting due to a "Wait" command, the number of frames to wait is decremented. If battler is being forced, then the method terminates. If a battle, shop, menu, name input screen, save menu, or game over screen is being called, the method terminates, since any of these will change the value of $scene and temporarily suspend event processing. If the list is nil and this is the main interpreter, then the method checks for events to start. If there are no events to start, then the method terminates. If a common can't be executed for some reason, the method terminates. If it makes it to the end of the loop, the event command pointer is advanced by one.
Input_Button
Arguments:
None
Local Variables:
None
How it Works: This method, used in the Key Input Processing event command, checks to see if a button is being pushed. The method iterates through each button code and stores the result in n if the button is being pushed. If n is greater than 0, the button code is stored in $game_variables[@button_input_variable_id] and the map is refreshed.
Setup_Choices
Arguments:
Parameters: An array containing the parameters for the choices to be setup. parameters[0] is itself an array containing the text of the choices. parameters[1] holds a value that determines the cancellation handler for the choices.
Local Variables: None
How it Works: This method sets up the choices for a Show Choices command. It first sets $game_temp.choice_max to the number of choices in parameters[0], then loads the message text for each choice into $game_temp.message_text. It then loads the choice cancel type into $game_temp.cancel_type. Finally, it loads the branch data for the choices.
Iterate_Actor
Arguments:
Parameter: A value containing actor ID of the actor on which to execute the effect (0 = Entire Party)
Local Variables: None
How it Works: This method is called by event commands that can either affect the entire party or just one hero, such as "Change Hero HP" and "Complete Healing". It first checks to see if parameter is 0. If it is, then for each actor in the party, the method yeilds the actor. The yield statement executes the code block passed to it with the paramater being yeilded (in this case, actor). What code is executed depends on the calling event command method. Otherwise, the method yields the actor ID contained in parameter.
Iterate_Enemy
Arguments:
Parameter: A value containing the relative position of the enemy in the enemy party on which to execute the effect (-1 = All Enemies)
Local Variables:
None
How it Works: This method is called by event commands that can either affect one enemy or all enemies, such as "Change Enemy HP" and "Completely Heal Enemy". It first checks to see if parameter is -1. If it is, then for each enemy in the monster, the method yeilds the monster. Otherwise, the method yields the monster index contained in parameter.
Iterate_Battler
Arguments:
Parameter1: Tells the method whether to execute the effect on a party member or a monster (0 = Monster, 1 = Party Member).
Parameter2: The relative position within the party or enemy group of the party member or monster on which to execute the effect (-1 = All Party Members or All Enemies)
Local Variables: None
How it Works: This method is called by event commands that can either all enemies, all party members, one party member, or one enemy such as "Show Battle Animation" and "Deal Damage". The method first checks to see if the first parameter is 0 (monster). If it is, then it just calls iterate_enemy to take care of the processing. If the first parameter is 1 (actor), then it yields every actor in the party, otherwise, it yields the actor ID in parameter2.
Execute_Command
Arguments:
None
Local Variables:
None
How it Works: This method is the hub of activity in this class. It checks to see what command is next in the list to execute and calls that command's method. The comparison of @index to @list.size makes sure that the pointer isn't pointing to the end of the list. If it is, then command_end is called, which terminates the event. Otherwise, the parameters for the next event command to execute are loaded into @parameters and the appropriate method is called based on the command code of that command.
Command_End
Arguments:
None
Local Variables:
None
How it Works: This method terminates the event. It first sets the @list to nil, meaning the event is not running. If this interpreter is the main interpreter and @event_id is greater than 0 (that is, the event didn't cause a map change and this event is not a common event), then the event's graphic is unlocked.
Command_Skip
Arguments:
None
Local Variables:
None
How it Works: This method causes the event execution pointer to jump over a branch of event commands that shouldn't be executed because the conditions for their execution weren't met, such as in a conditional branch. The method first acquires the "indent" level of the pointer, which is the number of nested branches. The main loop in this method iterates through moves the pointer down the list one command and checks the indent of that command. If they're equal, this method returns. Otherwise, it does it again.
Get_Character
Arguments:
Parameter: Tells the method which character object to return.
Local Variables:
None
How it Works: This method returns a character based on the parameter passed to it. If the parameter is -1, then it returns the player object. If it's 0, it returns the character object associated with the currently executing event. If it's 1 or more, it returns the character object associated with that event ID on the map.
Operate_Value
Arguments:
Operation: Many event commands allow for both adding or subtracting from such
quantity (such as Item Management, Change HP, etc.). This value tells the
method whether the quantity should be left alone or be turned into a negative
number.
Operand_Type: Tells the method whether the value of
operand
is the actual value of the operand or a reference to a variable.
Operand: A number that is interpreted as either the actual operand or a
variable reference to the operand, depending on the value of
operand_type
.
Local Variables:
None
How it Works: This method exists because many of the event commands have a similar format: they either take a direct amount, or allow the user to get the amount from a variable, and allow for both adding or subtracting from a quantity. The method first checks operand_type. If the operand type is 0, then it the value is set directly to the value of operand. If the operand type is 1, then the value is set to the value stored in the variable ID stored in operand. If the value of operation is 1, then value returned is multiplied by -1 because the calling event command method is decreasing rather than increasing a quantity. value is then returned to the calling method.
About This Section
This section describes the methods used to execute each event command. In these descriptions, the method name is followed by the name of the event command in brackets. The text in brackets is not part of the actual method name and included here only for convenience. To call the method in your scripts, use only "command_xxx". Also, rather than passing formal arguments to these methods, the engine loads the parameters into the @parameters instance variable. The parameters are represented as an array. Therefore, for this section, the "arguments" section of each method explanation has been replaced with "parameters". The number before each parameter description refers to the array index of that parameter in @parameters.
|
Command_101 [Message]
Parameters:
0: The first line of the message text.
Local Variables:
Line_Count: The number of lines in the message.
How it Works: This method shows a message. If for some reason, this method has been called when there is no message to show, the method returns false. If a message is waiting, then the @message_waiting instance variable is set and the method begins assembling the message text. The $game_temp.message_text = @list[@index].parameters[0] + "\n" acquires the first line of the message from the parameter passed to the method and appends a newline character. The loop body assembles the rest of the contents of the message window. The first check is for an event command with a "code" of 401 (message line). This means that the message has another line. This line is appended to $game_temp.message_text and the line count is incremented. The check for an event command with code 102 (Show Choices) is performed so that if the number of choices plus the current line count is four or less, the choices will be shown in the same message window. The elsif statement that checks for a code of 103 (Input Number) makes it so that if there is available space in the message window, the number input prompt will appear in the same message window as the message text. If none of those conditions are true, then the method terminates.
Command_102 [Show Choices]
Parameters:
0: An array containing the text of the choices.
1: The method by which choice cancellation will be handled.
Local Variables:
None
How it Works: This method shows choices in their own message window. If $game_temp.message_text has nothing in it for some reason, the method does nothing. Otherwise, it sets up the choices with the parameters passed to it.
Command_402 [Check Choice Branch]
Parameters:
0: The choice number to check.
Local Variables:
None
How it Works: After a Show Choices command is executed, this method is called once for each choices that could be chosen. When the choices is chosen, the value of @branch[@list[@index].indent] is loaded with the number of the choice chosen (0 = First Choice, 1 = Second Choice, 2 = Third Choice, 3 = Fourth Choice, 4 = Cancel). The method compares the actual choice chosen with the choice being checked. If they match, then the method returns true, and the branch associated with that choice is chosen. If not, then command_skip is returned, which skips over the branch associated with this choice.
Command_403 [Check Choice Cancellation]
Parameters:
None
Local Variables:
None
How it Works: Checks to see if a Show Choices command was cancelled. The method compares the choice chosen with 4 (cancel chosen). If the choice chosen was 4, then the method returns true and executes the cancellation branch. If not, then command_skip is returned, which skips over the cancellation branch.
Command_103 [Input Number]
Parameters:
0: The ID of the variable in which to store the number.
1: The maximum number of digits allowed.
Local Variables:
None
How it Works: Handles the numerical input window. If $game_temp.message_text has nothing in it for some reason, the method does nothing. Otherwise, the numerical input window is set up.
Command_104 [Message Display Options]
Parameters:
0: The display position of the window (0 = Top, 1 = Middle, 2 = Bottom).
1: Whether the window is transparent (0 = Opaque, 1 = Transparent).
Local Variables:
None
How it Works: If a message window is showing, the method returns false. If one isn't, then the values of $game_system.message_position and $game_system.message_frame are set.
Command_105 [Key Input Processing]
Parameters:
0: The variable ID in which to store the key code.
Local Variables:
None
How it Works: Sets the value of @button_input_variable_id to the variable declared in the "Key Input Processing" event command. The Input_Button method handles the acquisition of the key into the variable.
Command_106 [Wait]
Parameters:
0: The number of frames to wait.
Local Variables:
None
How it Works: Sets the wait count to twice the number of frames set in the "Wait" command.
Command_111 [Conditional Branch]
Parameters:
0: The condition to evaluate.
1: Has various meanings, depending on which condition is being evaluated.
2: Has various meanings, depending on which condition is being evaluated.
3: Has various meanings, depending on which condition is being evaluated.
4: The comparison to be made for variables.
Local Variables:
Result: The value returned to the caller.
Value1: The first value to compare in a variable compraison.
Value2: The second value to compare in a variable compraison.
How it Works: Checks to see if the condition passed to this method is true or false. If the condition is true, then a handler associated with the condition is executed. If the condition is false, the user can choose to either have the command do nothing, or execute a special handler. I won't go through each condition compared, but the general methodology here is to set the value of result to an expression comparing the value passed to this method to the value of some object. At the end of this method, the value of @branch[@list[@index].indent] is set to the value of result, to indicate whether or not the branch should be taken. If the result is false, then the method returns command_skip, indicating that the handler associated with the condition should not be taken. This value is also used in checking to see whether an "else case handler" should be executed (see below for details).
Command_411 [Else Case Handling]
Parameters:
None
Local Variables:
None
How it Works: Checks to see if a special handler should be executed because the condition for a Conditional Branch was not met. If the branch should be taken the value of @branch[@list[@index].indent] will be set to false. If the current value of @branch[@list[@index].indent] is false, the method returns true, meaning the branch should be taken. Otherwise, it returns command_skip, which means that the branch should not be taken.
Command_112 [Loop]
Parameters:
None
Local Variables:
None
How it Works: This method does nothing. The "Loop" event command is in the list merely as a placeholder for when the "End Loop" command method is called.
Command_413 [End of Loop Data]
Parameters:
None
Local Variables:
None
How it Works: Decrements the value of @index until the indent value of the command being pointed at has the same indent value of the "End of Loop Data" command.
Command_113 [End Loop]
Parameters:
None
Local Variables:
None
How it Works: Searches the command list for the end of the loop. For this method, the temporary command pointer temp_index is created and set to the @index. The first part of the loop body checks to see if the temporary command pointer has reached the end of the event command list without finding the appropriate label. If it has, the method terminates. For each event command in the list, it checks to see if the event command's "code" is 413 (End of Loop Data). If a match is found, the real command pointer @index is set to the current location of temp_index.
Command_115 [End Event Processing]
Parameters:
None
Local Variables:
None
How it Works: Calls Command_End to terminate event processing.
Command_116 [Erase Event]
Parameters:
None
Local Variables:
None
How it Works: If the event ID of the event passed to this method is greater than 0, then the Game_Event#Erase method is called on that event.
Command_117 [Call Common Event]
Parameters:
0: The common event to call.
Local Variables:
None
How it Works: This method calls a common event. A child interpreter with a depth one greater than the current interpreter's depth is spawned and that event is set up, which transfers control to the child interpreter.
Command_118 [Label]
Parameters:
0: The name of the label.
Local Variables:
None
How it Works: This method does nothing. The "Label" event command is in the list merely as a placeholder for when the "Junp to Label" command method is called.
Command_119 [Jump to Label]
Parameters:
0: The name of the label to which to jump.
Local Variables:
temp_index: The temporary event command pointer that searches for the label passed to the method.
How it Works: Searches the command list for the label name passed to this method and sets the event command pointer to the location of that label. For this method, the temporary command pointer temp_index is created and set to the beginning of the list of event commands. The first part of the loop body checks to see if the temporary command pointer has reached the end of the event command list without finding the appropriate label. If it has, the method terminates. For each event command in the list, it checks to see if the event command's "code" is 118 (label) and its parameter is the name of the label being searched for. If a match is found, the real command pointer @index is set to the current location of temp_index.
Command_121 [Switch Operation]
Parameters:
0: The lower bound of the switch range for this operation
1: The upper bound of the switch range for this operation
2: Whether to turn the switches ON or OFF.
Local Variables:
None
How it Works: Sets game switches. For each switch in the range between paramters[0] and paramters[1], the value of the switch is set to the ON or OFF parameter passed to this method. Note that if you select the "single switch" option in the "Change Switch" dialog, the first two parameters will be set to the same value, so no unique processing is required for this case.
Command_122 [Variable Operation]
Parameters:
0: The lower bound of the variable range for this operation
1: The upper bound of the variable range for this operation
2: The operation to perform on the variable(s) (0 = Set, 1 = Add, 2 = Subtract,
3 = Multiply, 4 = Divide, 5 = Modulous).
3: The type of operand.
4: Either the operand itself or an operand subtype, depending on the main
operand type.
5: If there is an operand subtype, then this parameter is the operand.
Local Variables:
Value: The operand for the variable operation.
How it Works: Changes the value of a variable according to the parameters passed to this method. The first part of this method is a huge case statement that sets the value of value to whatever the user specified as the target. The for i in @parameters[0] .. @parameters[1] loop performs the actual changes to the variable according to the value of for i in @parameters[2]. The final part of the method is a bounding check. If the variable is above 99999999, the variable is set to 99999999. If the variable is below -99999999, the variable is set to -99999999. The reason that $game_map.need_refresh is set is so that any event preconditions that were met as a result of the variable change will be reflected on the map immediately.
Command_123 [Local Switch Operation]
Parameters:
0: The local switch to change.
1: Whether to turn the local switch OFF or ON.
Local Variables:
Key: The hash table key of the local switch to be changed.
How it Works: Sets switches local to this event. If the event ID is greater than 0 (the event is valid), then the local switch referenced by key is changed to the value passed to this method.
Command_124 [Timer Operation]
Parameters:
0: Whether to start or stop the timer (0 = Start, 1 = Stop).
1: The number of seconds for whcih to set the timer. Not used if the timer is
being stopped.
Local Variables:
None
How it Works: Sets or stops the timer. The value of paramters[0] determines the value of $game_system.timer_working. The Game_System#Update method handles the countdown of the timer if the timer is being set. If the timer is being set, it is set to the number of seconds stored in paramters[1] multiplied by the current frame rate.
Command_125 [Change Money]
Parameters:
0: Whether to add or remove money (0 = Add, 1 = Remove).
1: Whether the amount is set directly or contained in a variable (0 = Fixed
amount, 1 = Stored in Variable).
2: The amount of money to gain or lose. If the value is fixed, then this
parameter contains the fixed amount. If it's stored in a variable, this
parameter contains the ID of that variable.
Local Variables:
None
How it Works: Adds or removes money from the party. The call to operate_value figures out whether the value is stored in a variable or not and returns the amount of money to add (a negative number means items will be removed). The Game_Party#Gain_Gold method takes care of adding or removing the money.
Command_126 [Item Management]
Parameters:
0: Which item to gain or lose.
1: Whether to add or remove items (0 = Add, 1 = Remove).
2: Whether the amount of items is set directly or contained in a variable (0 =
Fixed amount, 1 = Stored in Variable).
3: The amount of that item to gain or lose. If the value is fixed, then this
parameter contains the fixed amount. If it's stored in a variable, this
parameter contains the ID of that variable.
Local Variables:
None
How it Works: Adds or removes items from the party's stock. The call to operate_value figures out whether the value is stored in a variable or not and returns the number of items to add (a negative number means items will be removed). The Game_Party#Gain_Item method takes care of adding or removing the items in the party's stock.
Command_127 [Weapon Management]
Parameters:
0: Which item to gain or lose.
1: Whether to add or remove items (0 = Add, 1 = Remove).
2: Whether the amount of items is set directly or contained in a variable (0 =
Fixed amount, 1 = Stored in Variable).
3: The amount of that item to gain or lose. If the value is fixed, then this
parameter contains the fixed amount. If it's stored in a variable, this
parameter contains the ID of that variable.
Local Variables:
None
How it Works: Adds or removes weapons from the party's stock. The call to operate_value figures out whether the value is stored in a variable or not and returns the number of weapons to add (a negative number means items will be removed). The Game_Party#Gain_Weapon method takes care of adding or removing the items in the party's stock.
Command_128 [Defense Item Management]
Parameters:
0: Which item to gain or lose.
1: Whether to add or remove items (0 = Add, 1 = Remove).
2: Whether the amount of items is set directly or contained in a variable (0 =
Fixed amount, 1 = Stored in Variable).
3: The amount of that item to gain or lose. If the value is fixed, then this
parameter contains the fixed amount. If it's stored in a variable, this
parameter contains the ID of that variable.
Local Variables:
None
How it Works: Adds or removes defense items from the party's stock. The call to operate_value figures out whether the value is stored in a variable or not and returns the number of defense items to add (a negative number means items will be removed). The Game_Party#Gain_Armor method takes care of adding or removing the items in the party's stock.
Command_129 [Change Party Members]
Parameters:
0: Which actor to add or remove.
1: Whether to add or remove an actor (0 = Add, 1 = Remove)
2: Whether or not to add the actor in its initial state (0 = No, 1 = Yes).
Local Variables:
None
How it Works: Adds and removes party members. If a party member is being added and paramters[2] is 1 (Add in initial state), then the Game_Actor#Setup method takes care of initializing the actor's state. Whether the actor is initialized or not, the Game_Party#Add_Actor method actually adds the actor (including checking for the party being full). If an actor is being removed, then Game_Party#Remove_Actor removes the actor if the actor is present.
Command_131 [Change Window Skin]
Parameters:
0: The filename of the new window skin.
Local Variables:
None
How it Works: Changes the value of $game_system.windowskin_name to the file name passed to this
method.
Command_132 [Change Battle BGM]
Parameters:
0: The filename of the new battle BGM.
Local Variables:
None
How it Works: Changes the value of $game_system.battle_bgm to the BGM passed to this method.
Command_133 [Change Battle Victory ME]
Parameters:
0: The filename of the new battle victory ME.
Local Variables:
None
How it Works: Changes the value of $game_system.battle_end_me to the ME passed to this method.
Command_134 [Allow/Disallow Saving]
Parameters:
0: Whether to allow or disallow saving (0 = Disallow, 1 = Allow).
Local Variables:
None
How it Works: Sets the $game_system.save_disabled flag to the value passed to this method.
Command_135 [Allow/Disallow Main Menu]
Parameters:
0: Whether to allow or disallow opening the main menu (0 = Disallow, 1 = Allow).
Local Variables:
None
How it Works: Sets the $game_system.menu_disabled flag to the value passed to this method.
Command_136 [Allow/Disallow Random Encounters]
Parameters:
0: Whether to allow or disallow random encounters (0 = Disallow, 1 = Allow).
Local Variables:
None
How it Works: Sets the $game_system.encounter_disabled flag to the value passed to this method. The call to Game_Player#make_encounter_count is called so that if random encounters were re-enabled, the number of steps before encountering a monster will be set.
Command_201 [Teleport]
Parameters:
0: Whether a specific location is being specified or the location is stored in
variables (0 = Specific Location, 1 = Stored in Variables)
1: The map ID of the new location. If the teleport destination is a specific
location, then this value contains the map ID. If the teleport destination is
stored in variables, then this value contains the variable ID in which the map
ID is stored.
2: The X coordinate of the new location. If the teleport destination is a
specific location, then this value contains the X coordinate. If the teleport
destination is stored in variables, then this value contains the variable ID in
which the X coordinate is stored.
3: The Y coordinate of the new location. If the teleport destination is a
specific location, then this value contains the Y coordinate. If the teleport
destination is stored in variables, then this value contains the variable ID in
which the Y coordinate is stored.
4: The direction the player will face after teleporting (0 = Retain Facing, 2 =
Down, 4 = Left, 6 = Right, 8 = Up)
5: Whether or not the screen should fade for the teleport (0 = Yes, 1 = No).
Local Variables:
None
How it Works: This method teleports the player to a new location. If the player is already teleporting, a message window is showing, or a transition is being processed, this command is ignored. The first thing the method does is set the $game_temp.player_transferring flag, so that other events won't interfere while the teleport is taking place. The if statement determines whether the new location has been entered directly, or is being assembled from variables. The values of the new map ID, X coordinate, Y coordinate, and facing direction are set. If the fade flag is set, the graphics freeze and a special transition with no name (fade) is processed.
Command_202 [Change Event Location]
Parameters:
0: The event ID of the event that will change locations (0 = This event).
1: Whether or not the new coordinates of the event are specified directly or
stored in variables (0 = Specified Directly, 1 = Stored in Variables, 2 = Trade places with another event)
2: The X coordinate of the new location. If the teleport destination is a
specific location, then this value contains the X coordinate. If the teleport
destination is stored in variables, then this value contains the variable ID in
which the X coordinate is stored.
3: The Y coordinate of the new location. If the teleport destination is a
specific location, then this value contains the Y coordinate. If the teleport
destination is stored in variables, then this value contains the variable ID in
which the Y coordinate is stored.
4: The direction the event will face after teleporting (0 = Retain Facing, 2 =
Down, 4 = Left, 6 = Right, 8 = Up)
Local Variables:
Character2: The event with which to trade places.
Old_X: The old X coordinate of the first event when trading places.
Old_Y: The old Y coordinate of the first event when trading places.
How it Works: This method moves an event on the map to a new location. The call to Get_Character determines whether this event or another event is to be moved. If the character is nil (invalid), then the method returns without doing anything. The next part of the method determines whether the new X and Y coordinates are specific coordinates or stored in variables. In either case, the Game_Character#Moveto method is called with the character, X coordinate, and Y coordinate. If the user has chosen to exchange the locations of two events, then the first event's X and Y coordinates are acquired, the character with which to trade is acquired, and the Game_Character#Moveto method is called on both events to trade their locations. The final case statement sets the facing of the event at its new location.
Command_203 [Pan Screen]
Parameters:
0: The direction to scroll the map (2 = Down, 4 = Left, 6 = Right, 8 = Up)
1: The number of tiles to scroll the map.
2: The speed at which to scroll the map. This value can range from 1 to 6.
Local Variables:
None
How it Works: Starts a screen scroll effect by loading the $game_map object with the scroll direction, scroll speed, and number of tiles to scroll. The method Game_Map#Update performs the frame-by-frame updating of the scrolling
Command_204 [Change Map Settings]
Parameters:
0: Which map setting to change (0 = Panorama, 1 = Fog, 2 = Battle Background)
1: The filename of the new image (in all three cases)
2: The hue modification of the image (for panoramas and fogs only).
3: The fog's opacity value (0 = Completely Transparent, 255 = Completely Opaque)
4: The fog's blend type (0 = Normal, 1 = Additive, 2 = Negative)
5: The fog's magnification, expressed as a percentage.
6: The fog's starting X coordinate.
7: The fog's starting Y coordinate.
Local Variables:
None
How it Works: This method changes either the panorama, fog, or battle background for the current map. The main case statement chooses between these three alternatives. If the setting to change is the panorama (case 0), then the method assigns the new filename and hue modification. If the setting to change is the fog (case 1), then the method assigns the new filename, hue modification, opacity, blend type, magnification, SX, and SY of the fog. If the setting to change is the battle background (case 2), then the method assigns the new filename of the battle background and the "temporary" battle background. This is so that if the party is currently in battle, the battle background will change immediately.
Command_205 [Tint Fog]
Parameters:
0: The new fog tone.
1: The transition time to change from the old color to the new one, in frames.
Local Variables:
None
How it Works: Starts a fog tinting effect by loading the $game_map object with the new fog tone value and the duration of the transition to the new tone. The method Game_Map#Update does the frame-by-frame tinting of the fog.
Command_206 [Change Fog Opacity]
Parameters:
0: The new fog opacity (0 = Completely Transparent, 255 = Completely Opaque).
1: The transition time to change from the old opacity to the new one, in frames.
Local Variables:
None
How it Works: Starts a fog opacity change by loading the $game_map object with the opacity value and the duration of the transition. The method Game_Map#Update actually handles the frame-by-frame transition to the new fog opacity.
Command_207 [Show Battle Animation - Map Version]
Parameters:
0: The event on which to show the animation.
1: The animation ID of the animation to show.
Local Variables:
None
How it Works: Shows a battle animation on an event. The character = get_character(@parameters[0]) statement determines whether the animation should be shown on the player, this event, or another event on the map. If the character is nil (that is, it doesn't exist), then the method does nothing. Otherwise, the character's @animation_id is set to the animation ID of the animation to show.
Command_208 [Change Hero Transparency]
Parameters:
0: The new hero transparency setting (0 = Transparent 1 = Opaque).
Local Variables:
None
How it Works: Sets the $game_player.transparent value to the value passed to this method.
Command_209 [Move Event]
Parameters:
0: The event to move.
1: An array containing the set of moves to execute.
Local Variables:
None
How it Works: Loads a character's forced movement buffer. The character = get_character(@parameters[0]) statement determines whether the Move Event applies to the player, this event, or another event on the map. If the character is nil, then the method does nothing. Otherwise, the call to Game_Character#force_move_route loads the route passed to this method into the character's forced movement buffer.
Command_210 [Proceed with Movement]
Parameters:
None
Local Variables:
None
How it Works: As long as $game_temp.in_battle is false (the hero is on the map rather than in battle), the event's @move_route_waiting flag is set, which means the event won't move until all forced movements resulting from "Move Event" are complete.
Command_221 [Prepare Transition]
Parameters:
None
Local Variables:
None
How it Works: Freezes the graphics in preparation for executing a transition. The check of $game_temp.message_window_showing checks if a message window is showing. If one is showing, then the method returns false. Otherwise, the Graphics#Freeze method is called, which means the graphics won't update until the graphics are unfrozen.
Command_222 [Execute Transition]
Parameters:
0: The filename of the transition to execute.
Local Variables:
None
How it Works: Executes a transition. The check of $game_temp.transition_processing is to see if the engine is already executing a transition. If it is, then the method returns false without doing anything. If no transition is being processed, then the method sets the value of $game_temp.transition_processing to true and the value of $game_temp.transition_name to the file name of the transition to process. The actual handling of transitions is done by a higher-level graphics class and isn't editable by the user.
Command_223 [Tint Screen]
Parameters:
0: The new screen tone.
1: The transition time from the old screen tone to the new one, in frames.
Local Variables:
None
How it Works: Starts a screen tone change by loading the $game_screen object with the appropriate tone and duration values. The method Game_Screen#Update actually handles the frame-by-frame transition to the new tone.
Command_224 [Flash Screen]
Parameters:
0: The flash color.
1: The amount of frames the flash lasts.
Local Variables:
None
How it Works: Starts a screen flash by loading the $game_screen object with the appropriate color and duration values. The method Game_Screen#Update actually handles the frame-by-frame updating of the flash effect.
Command_225 [Shake Screen]
Parameters:
0: The shake power, a value from 1 to 9.
1: The shake speed, a value from 1 to 9.
2: The duration of the shaking, in frames.
Local Variables:
None
How it Works: Starts a screen shake effect by loading the $game_screen object with the appropriate power, speed, and duration values. The method Game_Screen#Update actually handles the frame-by-frame updating of the graphics resulting from the shaking.
Command_231 [Show Picture]
Parameters:
0: The picture number to show.
1: The filename of the picture.
2: The point relative to which the picture will be shown (0 = Upper-Left, 1 =
Center).
3: Whether the display coordinates are specified directly or stored in
variables (0 = Specified Directly, 1 = Stored in Variables)
4: The X coordinate of the picture. If the X coordinate is a specific value,
then this paramater contains the value of the X coordinate. If the X
coordinate is stored in variables, then this value contains the variable ID in
which the X coordinate is stored.
5: The Y coordinate of the picture. If the Y coordinate is a specific value,
then this paramater contains the value of the Y coordinate. If the Y
coordinate is stored in variables, then this value contains the variable ID in
which the Y coordinate is stored.
6: The X-axis magnification of the picture, expressed as a percentage.
7: The Y-axis magnification of the picture, expressed as a percentage.
8: The picture's opacity (0 = Completely Transparent, 255 = Completely Opaque)
9: The picture's blend type (0 = Normal, 1 = Additive, 2 = Negative).
Local Variables:
None
How it Works: Shows a picture onscreen. The number is determined by either getting the number directly from what is passed to the method (if the party isn't in battle), or taking that number and adding 50 (if the party is in battle. The first thing the method does is acquire the X and Y coordinate of the picture, either directly (if parameters[3] is 0) or from variables (if parameters[3] is 1). The method then calls the Game_Picture#Show on that picture in order to show the picture, with the other parameters passed to this method, such as blend type, magnification, and opacity).
Command_232 [Move Picture]
Parameters:
0: The picture number to move.
1: The transition time for the move picture operation, in frames.
2: The point relative to which the picture will be shown (0 = Upper-Left, 1 =
Center).
3: Whether the display coordinates are specified directly or stored in
variables (0 = Specified Directly, 1 = Stored in Variables)
4: The X coordinate of the new location. If the new X coordinate is a specific
value, then this paramater contains the value of the new X coordinate. If the
new X coordinate is stored in variables, then this value contains the variable
ID in which the new X coordinate is stored.
5: The Y coordinate of the new location. If the new Y coordinate is a specific
value, then this paramater contains the value of the new Y coordinate. If the
new Y coordinate is stored in variables, then this value contains the variable
ID in which the new Y coordinate is stored.
6: The X-axis magnification of the picture after movement, expressed as a
percentage.
7: The Y-axis magnification of the picture after movement, expressed as a
percentage.
8: The picture's opacity after movement (0 = Completely Transparent, 255 =
Completely Opaque)
9: The picture's blend type after movement (0 = Normal, 1 = Additive, 2 =
Negative).
Local Variables:
None
How it Works: Moves a picture to a new location on the screen. The number is determined by either getting the number directly from what is passed to the method (if the party isn't in battle), or taking that number and adding 50 (if the party is in battle. The first thing the method does is acquire the X and Y coordinate of the picture, either directly (if parameters[3] is 0) or from variables (if parameters[3] is 1). The method then calls the Game_Picture#Move on that picture in order to move the picture to its new location, with the other parameters passed to this method, such as transition time, blend type, magnification, and opacity).
Command_233 [Rotate Picture]
Parameters:
0: The picture number to rotate.
1: The rotation speed of the picture in half-degrees per frame, a value from
-90 to 90. A positive vaue indications rotation to the right. A negative
value indicates rotation to the left.
Local Variables:
None
How it Works: Changes the rotation speed of a picture. The number is determined by either getting the number directly from what is passed to the method (if the party isn't in battle), or taking that number and adding 50 (if the party is in battle. The method then calls the Game_Picture#Rotate on that pictu | |