Class: Game_Interpreter
- Inherits:
-
Object
- Object
- Game_Interpreter
- Defined in:
- lib/rgss3_default_scripts/Game_Interpreter.rb
Overview
** Game_Interpreter
An interpreter for executing event commands. This class is used within the
Game_Map, Game_Troop, and Game_Event classes.
Instance Attribute Summary collapse
-
#event_id ⇒ Object
readonly
Event ID (normal events only).
-
#map_id ⇒ Object
readonly
————————————————————————– * Public Instance Variables ————————————————————————–.
Instance Method Summary collapse
-
#check_overflow ⇒ Object
————————————————————————– * Check for Overflow Under normal usage, the depth will not exceed 100.
-
#clear ⇒ Object
————————————————————————– * Clear ————————————————————————–.
-
#command_101 ⇒ Object
————————————————————————– * Show Text ————————————————————————–.
-
#command_102 ⇒ Object
————————————————————————– * Show Choices ————————————————————————–.
-
#command_103 ⇒ Object
————————————————————————– * Input Number ————————————————————————–.
-
#command_104 ⇒ Object
————————————————————————– * Select Item ————————————————————————–.
-
#command_105 ⇒ Object
————————————————————————– * Show Scrolling Text ————————————————————————–.
-
#command_108 ⇒ Object
————————————————————————– * Comment ————————————————————————–.
-
#command_111 ⇒ Object
————————————————————————– * Conditional Branch ————————————————————————–.
-
#command_112 ⇒ Object
————————————————————————– * Loop ————————————————————————–.
-
#command_113 ⇒ Object
————————————————————————– * Break Loop ————————————————————————–.
-
#command_115 ⇒ Object
————————————————————————– * Exit Event Processing ————————————————————————–.
-
#command_117 ⇒ Object
————————————————————————– * Common Event ————————————————————————–.
-
#command_118 ⇒ Object
————————————————————————– * Label ————————————————————————–.
-
#command_119 ⇒ Object
————————————————————————– * Jump to Label ————————————————————————–.
-
#command_121 ⇒ Object
————————————————————————– * Control Switches ————————————————————————–.
-
#command_122 ⇒ Object
————————————————————————– * Control Variables ————————————————————————–.
-
#command_123 ⇒ Object
————————————————————————– * Control Self Switch ————————————————————————–.
-
#command_124 ⇒ Object
————————————————————————– * Control Timer ————————————————————————–.
-
#command_125 ⇒ Object
————————————————————————– * Change Gold ————————————————————————–.
-
#command_126 ⇒ Object
————————————————————————– * Change Items ————————————————————————–.
-
#command_127 ⇒ Object
————————————————————————– * Change Weapons ————————————————————————–.
-
#command_128 ⇒ Object
————————————————————————– * Change Armor ————————————————————————–.
-
#command_129 ⇒ Object
————————————————————————– * Change Party Member ————————————————————————–.
-
#command_132 ⇒ Object
————————————————————————– * Change Battle BGM ————————————————————————–.
-
#command_133 ⇒ Object
————————————————————————– * Change Battle End ME ————————————————————————–.
-
#command_134 ⇒ Object
————————————————————————– * Change Save Access ————————————————————————–.
-
#command_135 ⇒ Object
————————————————————————– * Change Menu Access ————————————————————————–.
-
#command_136 ⇒ Object
————————————————————————– * Change Encounter Disable ————————————————————————–.
-
#command_137 ⇒ Object
————————————————————————– * Change Formation Access ————————————————————————–.
-
#command_138 ⇒ Object
————————————————————————– * Change Window Color ————————————————————————–.
-
#command_201 ⇒ Object
————————————————————————– * Transfer Player ————————————————————————–.
-
#command_202 ⇒ Object
————————————————————————– * Set Vehicle Location ————————————————————————–.
-
#command_203 ⇒ Object
————————————————————————– * Set Event Location ————————————————————————–.
-
#command_204 ⇒ Object
————————————————————————– * Scroll Map ————————————————————————–.
-
#command_205 ⇒ Object
————————————————————————– * Set Move Route ————————————————————————–.
-
#command_206 ⇒ Object
————————————————————————– * Getting On and Off Vehicles ————————————————————————–.
-
#command_211 ⇒ Object
————————————————————————– * Change Transparency ————————————————————————–.
-
#command_212 ⇒ Object
————————————————————————– * Show Animation ————————————————————————–.
-
#command_213 ⇒ Object
————————————————————————– * Show Balloon Icon ————————————————————————–.
-
#command_214 ⇒ Object
————————————————————————– * Temporarily Erase Event ————————————————————————–.
-
#command_216 ⇒ Object
————————————————————————– * Change Player Followers ————————————————————————–.
-
#command_217 ⇒ Object
————————————————————————– * Gather Followers ————————————————————————–.
-
#command_221 ⇒ Object
————————————————————————– * Fadeout Screen ————————————————————————–.
-
#command_222 ⇒ Object
————————————————————————– * Fadein Screen ————————————————————————–.
-
#command_223 ⇒ Object
————————————————————————– * Tint Screen ————————————————————————–.
-
#command_224 ⇒ Object
————————————————————————– * Screen Flash ————————————————————————–.
-
#command_225 ⇒ Object
————————————————————————– * Screen Shake ————————————————————————–.
-
#command_230 ⇒ Object
————————————————————————– * Wait ————————————————————————–.
-
#command_231 ⇒ Object
————————————————————————– * Show Picture ————————————————————————–.
-
#command_232 ⇒ Object
————————————————————————– * Move Picture ————————————————————————–.
-
#command_233 ⇒ Object
————————————————————————– * Rotate Picture ————————————————————————–.
-
#command_234 ⇒ Object
————————————————————————– * Tint Picture ————————————————————————–.
-
#command_235 ⇒ Object
————————————————————————– * Erase Picture ————————————————————————–.
-
#command_236 ⇒ Object
————————————————————————– * Set Weather ————————————————————————–.
-
#command_241 ⇒ Object
————————————————————————– * Play BGM ————————————————————————–.
-
#command_242 ⇒ Object
————————————————————————– * Fadeout BGM ————————————————————————–.
-
#command_243 ⇒ Object
————————————————————————– * Save BGM ————————————————————————–.
-
#command_244 ⇒ Object
————————————————————————– * Resume BGM ————————————————————————–.
-
#command_245 ⇒ Object
————————————————————————– * Play BGS ————————————————————————–.
-
#command_246 ⇒ Object
————————————————————————– * Fadeout BGS ————————————————————————–.
-
#command_249 ⇒ Object
————————————————————————– * Play ME ————————————————————————–.
-
#command_250 ⇒ Object
————————————————————————– * Play SE ————————————————————————–.
-
#command_251 ⇒ Object
————————————————————————– * Stop SE ————————————————————————–.
-
#command_261 ⇒ Object
————————————————————————– * Play Movie ————————————————————————–.
-
#command_281 ⇒ Object
————————————————————————– * Change Map Name Display ————————————————————————–.
-
#command_282 ⇒ Object
————————————————————————– * Change Tileset ————————————————————————–.
-
#command_283 ⇒ Object
————————————————————————– * Change Battle Background ————————————————————————–.
-
#command_284 ⇒ Object
————————————————————————– * Change Parallax Background ————————————————————————–.
-
#command_285 ⇒ Object
————————————————————————– * Get Location Info ————————————————————————–.
-
#command_301 ⇒ Object
————————————————————————– * Battle Processing ————————————————————————–.
-
#command_302 ⇒ Object
————————————————————————– * Shop Processing ————————————————————————–.
-
#command_303 ⇒ Object
————————————————————————– * Name Input Processing ————————————————————————–.
-
#command_311 ⇒ Object
————————————————————————– * Change HP ————————————————————————–.
-
#command_312 ⇒ Object
————————————————————————– * Change MP ————————————————————————–.
-
#command_313 ⇒ Object
————————————————————————– * Change State ————————————————————————–.
-
#command_314 ⇒ Object
————————————————————————– * Recover All ————————————————————————–.
-
#command_315 ⇒ Object
————————————————————————– * Change EXP ————————————————————————–.
-
#command_316 ⇒ Object
————————————————————————– * Change Level ————————————————————————–.
-
#command_317 ⇒ Object
————————————————————————– * Change Parameters ————————————————————————–.
-
#command_318 ⇒ Object
————————————————————————– * Change Skills ————————————————————————–.
-
#command_319 ⇒ Object
————————————————————————– * Change Equipment ————————————————————————–.
-
#command_320 ⇒ Object
————————————————————————– * Change Name ————————————————————————–.
-
#command_321 ⇒ Object
————————————————————————– * Change Class ————————————————————————–.
-
#command_322 ⇒ Object
————————————————————————– * Change Actor Graphic ————————————————————————–.
-
#command_323 ⇒ Object
————————————————————————– * Change Vehicle Graphic ————————————————————————–.
-
#command_324 ⇒ Object
————————————————————————– * Change Nickname ————————————————————————–.
-
#command_331 ⇒ Object
————————————————————————– * Change Enemy HP ————————————————————————–.
-
#command_332 ⇒ Object
————————————————————————– * Change Enemy MP ————————————————————————–.
-
#command_333 ⇒ Object
————————————————————————– * Change Enemy State ————————————————————————–.
-
#command_334 ⇒ Object
————————————————————————– * Enemy Recover All ————————————————————————–.
-
#command_335 ⇒ Object
————————————————————————– * Enemy Appear ————————————————————————–.
-
#command_336 ⇒ Object
————————————————————————– * Enemy Transform ————————————————————————–.
-
#command_337 ⇒ Object
————————————————————————– * Show Battle Animation ————————————————————————–.
-
#command_339 ⇒ Object
————————————————————————– * Force Action ————————————————————————–.
-
#command_340 ⇒ Object
————————————————————————– * Abort Battle ————————————————————————–.
-
#command_351 ⇒ Object
————————————————————————– * Open Menu Screen ————————————————————————–.
-
#command_352 ⇒ Object
————————————————————————– * Open Save Screen ————————————————————————–.
-
#command_353 ⇒ Object
————————————————————————– * Game Over ————————————————————————–.
-
#command_354 ⇒ Object
————————————————————————– * Return to Title Screen ————————————————————————–.
-
#command_355 ⇒ Object
————————————————————————– * Script ————————————————————————–.
-
#command_402 ⇒ Object
————————————————————————– * When [**] ————————————————————————–.
-
#command_403 ⇒ Object
————————————————————————– * When Cancel ————————————————————————–.
-
#command_411 ⇒ Object
————————————————————————– * Else ————————————————————————–.
-
#command_413 ⇒ Object
————————————————————————– * Repeat Above ————————————————————————–.
-
#command_601 ⇒ Object
————————————————————————– * If Win ————————————————————————–.
-
#command_602 ⇒ Object
————————————————————————– * If Escape ————————————————————————–.
-
#command_603 ⇒ Object
————————————————————————– * If Lose ————————————————————————–.
-
#command_skip ⇒ Object
————————————————————————– * Command Skip Skip commands deeper than current index and advance index.
-
#create_fiber ⇒ Object
————————————————————————– * Create Fiber ————————————————————————–.
-
#execute_command ⇒ Object
————————————————————————– * Event Command Execution ————————————————————————–.
-
#game_data_operand(type, param1, param2) ⇒ Object
————————————————————————– * Get Game Data for Variable Operand ————————————————————————–.
-
#get_character(param) ⇒ Object
————————————————————————– * Get Character param : If -1, player.
-
#initialize(depth = 0) ⇒ Game_Interpreter
constructor
————————————————————————– * Object Initialization depth : nest depth ————————————————————————–.
-
#iterate_actor_id(param) ⇒ Object
————————————————————————– * Actor Iterator (ID) param : If 1 or more, ID.
-
#iterate_actor_index(param) ⇒ Object
————————————————————————– * Actor Iterator (Index) param : If 0 or more, index.
-
#iterate_actor_var(param1, param2) ⇒ Object
————————————————————————– * Actor Iterator (Variable) param1: Specify as fixed if 0 and variable if 1 param2: Actor or variable ID ————————————————————————–.
-
#iterate_battler(param1, param2) ⇒ Object
————————————————————————– * Battler Iterator (Account for Entire Enemy Group or Entire Party) param1 : If 0, enemy.
-
#iterate_enemy_index(param) ⇒ Object
————————————————————————– * Enemy Iterator (Index) param : If 0 or more, index.
-
#marshal_dump ⇒ Object
————————————————————————– * Dump Objects Define fibers in advance as they are not compatible with Marshal.
-
#marshal_load(obj) ⇒ Object
————————————————————————– * Load Objects obj: An array of objects dumped by marshal_dump.
-
#next_event_code ⇒ Object
————————————————————————– * Get Code of Next Event Command ————————————————————————–.
-
#operate_value(operation, operand_type, operand) ⇒ Object
————————————————————————– * Calculate Operated Value operation : Operation (0: Increase 1: Decrease) operand_type : Operand type (0: Constant 1: Variable) operand : Operand (numeric value or variable ID) ————————————————————————–.
-
#operate_variable(variable_id, operation_type, value) ⇒ Object
————————————————————————– * Execute Variable Operation ————————————————————————–.
-
#run ⇒ Object
————————————————————————– * Execute ————————————————————————–.
-
#running? ⇒ Boolean
————————————————————————– * Determine if Running ————————————————————————–.
-
#same_map? ⇒ Boolean
————————————————————————– * Determine if Same Map as at Event Start ————————————————————————–.
-
#screen ⇒ Object
————————————————————————– * Get Target of Screen Command ————————————————————————–.
-
#setup(list, event_id = 0) ⇒ Object
————————————————————————– * Event Setup ————————————————————————–.
-
#setup_choices(params) ⇒ Object
————————————————————————– * Setup Choices ————————————————————————–.
-
#setup_item_choice(params) ⇒ Object
————————————————————————– * Set Up Item Selection ————————————————————————–.
-
#setup_num_input(params) ⇒ Object
————————————————————————– * Number Input Setup ————————————————————————–.
-
#setup_reserved_common_event ⇒ Object
————————————————————————– * Detect/Set Up Call-Reserved Common Events ————————————————————————–.
-
#update ⇒ Object
————————————————————————– * Frame Update ————————————————————————–.
-
#wait(duration) ⇒ Object
————————————————————————– * Wait ————————————————————————–.
-
#wait_for_message ⇒ Object
————————————————————————– * Wait While Message Display is Busy ————————————————————————–.
Constructor Details
#initialize(depth = 0) ⇒ Game_Interpreter
-
Object Initialization
depth : nest depth
18 19 20 21 22 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 18 def initialize(depth = 0) @depth = depth check_overflow clear end |
Instance Attribute Details
#event_id ⇒ Object (readonly)
Event ID (normal events only)
13 14 15 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 13 def event_id @event_id end |
#map_id ⇒ Object (readonly)
-
Public Instance Variables
12 13 14 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 12 def map_id @map_id end |
Instance Method Details
#check_overflow ⇒ Object
-
Check for Overflow
Under normal usage, the depth will not exceed 100. Since recursive event calls are likely to result in an infinite loop, the depth is cut off at 100 and an error results.
29 30 31 32 33 34 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 29 def check_overflow if @depth >= 100 msgbox(Vocab::EventOverflow) exit end end |
#clear ⇒ Object
-
Clear
38 39 40 41 42 43 44 45 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 38 def clear @map_id = 0 @event_id = 0 @list = nil # Execution content @index = 0 # Index @branch = {} # Branch data @fiber = nil # Fiber end |
#command_101 ⇒ Object
-
Show Text
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 251 def command_101 $game_message.face_name = @params[0] $game_message.face_index = @params[1] $game_message.background = @params[2] $game_message.position = @params[3] while next_event_code == 401 # Text data @index += 1 $game_message.add(@list[@index].parameters[0]) end case next_event_code when 102 # Show Choices @index += 1 setup_choices(@list[@index].parameters) when 103 # Input Number @index += 1 setup_num_input(@list[@index].parameters) when 104 # Select Item @index += 1 setup_item_choice(@list[@index].parameters) end end |
#command_102 ⇒ Object
-
Show Choices
277 278 279 280 281 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 277 def command_102 setup_choices(@params) Fiber.yield while $game_message.choice? end |
#command_103 ⇒ Object
-
Input Number
305 306 307 308 309 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 305 def command_103 setup_num_input(@params) Fiber.yield while $game_message.num_input? end |
#command_104 ⇒ Object
-
Select Item
320 321 322 323 324 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 320 def command_104 setup_item_choice(@params) Fiber.yield while $game_message.item_choice? end |
#command_105 ⇒ Object
-
Show Scrolling Text
334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 334 def command_105 Fiber.yield while $game_message.visible $game_message.scroll_mode = true $game_message.scroll_speed = @params[0] $game_message.scroll_no_fast = @params[1] while next_event_code == 405 @index += 1 $game_message.add(@list[@index].parameters[0]) end end |
#command_108 ⇒ Object
-
Comment
348 349 350 351 352 353 354 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 348 def command_108 @comments = [@params[0]] while next_event_code == 408 @index += 1 @comments.push(@list[@index].parameters[0]) end end |
#command_111 ⇒ Object
-
Conditional Branch
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 358 def command_111 result = false case @params[0] when 0 # Switch result = ($game_switches[@params[1]] == (@params[2] == 0)) when 1 # Variable value1 = $game_variables[@params[1]] if @params[2] == 0 value2 = @params[3] else value2 = $game_variables[@params[3]] end case @params[4] when 0 # value1 is equal to value2 result = (value1 == value2) when 1 # value1 is greater than or equal to value2 result = (value1 >= value2) when 2 # value1 is less than or equal to value2 result = (value1 <= value2) when 3 # value1 is greater than value2 result = (value1 > value2) when 4 # value1 is less than value2 result = (value1 < value2) when 5 # value1 is not equal to value2 result = (value1 != value2) end when 2 # Self switch if @event_id > 0 key = [@map_id, @event_id, @params[1]] result = ($game_self_switches[key] == (@params[2] == 0)) end when 3 # Timer if $game_timer.working? if @params[2] == 0 result = ($game_timer.sec >= @params[1]) else result = ($game_timer.sec <= @params[1]) end end when 4 # Actor actor = $game_actors[@params[1]] if actor case @params[2] when 0 # in party result = ($game_party.members.include?(actor)) when 1 # name result = (actor.name == @params[3]) when 2 # Class result = (actor.class_id == @params[3]) when 3 # Skills result = (actor.skill_learn?($data_skills[@params[3]])) when 4 # Weapons result = (actor.weapons.include?($data_weapons[@params[3]])) when 5 # Armors result = (actor.armors.include?($data_armors[@params[3]])) when 6 # States result = (actor.state?(@params[3])) end end when 5 # Enemy enemy = $game_troop.members[@params[1]] if enemy case @params[2] when 0 # appear result = (enemy.alive?) when 1 # state result = (enemy.state?(@params[3])) end end when 6 # Character character = get_character(@params[1]) if character result = (character.direction == @params[2]) end when 7 # Gold case @params[2] when 0 # Greater than or equal to result = ($game_party.gold >= @params[1]) when 1 # Less than or equal to result = ($game_party.gold <= @params[1]) when 2 # Less than result = ($game_party.gold < @params[1]) end when 8 # Item result = $game_party.has_item?($data_items[@params[1]]) when 9 # Weapon result = $game_party.has_item?($data_weapons[@params[1]], @params[2]) when 10 # Armor result = $game_party.has_item?($data_armors[@params[1]], @params[2]) when 11 # Button result = Input.press?(@params[1]) when 12 # Script result = eval(@params[1]) when 13 # Vehicle result = ($game_player.vehicle == $game_map.vehicles[@params[1]]) end @branch[@indent] = result command_skip if !@branch[@indent] end |
#command_112 ⇒ Object
-
Loop
466 467 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 466 def command_112 end |
#command_113 ⇒ Object
-
Break Loop
479 480 481 482 483 484 485 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 479 def command_113 loop do @index += 1 return if @index >= @list.size - 1 return if @list[@index].code == 413 && @list[@index].indent < @indent end end |
#command_115 ⇒ Object
-
Exit Event Processing
489 490 491 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 489 def command_115 @index = @list.size end |
#command_117 ⇒ Object
-
Common Event
495 496 497 498 499 500 501 502 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 495 def command_117 common_event = $data_common_events[@params[0]] if common_event child = Game_Interpreter.new(@depth + 1) child.setup(common_event.list, same_map? ? @event_id : 0) child.run end end |
#command_118 ⇒ Object
-
Label
506 507 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 506 def command_118 end |
#command_119 ⇒ Object
-
Jump to Label
511 512 513 514 515 516 517 518 519 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 511 def command_119 label_name = @params[0] @list.size.times do |i| if @list[i].code == 118 && @list[i].parameters[0] == label_name @index = i return end end end |
#command_121 ⇒ Object
-
Control Switches
523 524 525 526 527 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 523 def command_121 (@params[0]..@params[1]).each do |i| $game_switches[i] = (@params[2] == 0) end end |
#command_122 ⇒ Object
-
Control Variables
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 531 def command_122 value = 0 case @params[3] # Operand when 0 # Constant value = @params[4] when 1 # Variable value = $game_variables[@params[4]] when 2 # Random value = @params[4] + rand(@params[5] - @params[4] + 1) when 3 # Game Data value = game_data_operand(@params[4], @params[5], @params[6]) when 4 # Script value = eval(@params[4]) end (@params[0]..@params[1]).each do |i| operate_variable(i, @params[2], value) end end |
#command_123 ⇒ Object
-
Control Self Switch
655 656 657 658 659 660 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 655 def command_123 if @event_id > 0 key = [@map_id, @event_id, @params[0]] $game_self_switches[key] = (@params[1] == 0) end end |
#command_124 ⇒ Object
-
Control Timer
664 665 666 667 668 669 670 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 664 def command_124 if @params[0] == 0 # Start $game_timer.start(@params[1] * Graphics.frame_rate) else # Stop $game_timer.stop end end |
#command_125 ⇒ Object
-
Change Gold
674 675 676 677 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 674 def command_125 value = operate_value(@params[0], @params[1], @params[2]) $game_party.gain_gold(value) end |
#command_126 ⇒ Object
-
Change Items
681 682 683 684 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 681 def command_126 value = operate_value(@params[1], @params[2], @params[3]) $game_party.gain_item($data_items[@params[0]], value) end |
#command_127 ⇒ Object
-
Change Weapons
688 689 690 691 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 688 def command_127 value = operate_value(@params[1], @params[2], @params[3]) $game_party.gain_item($data_weapons[@params[0]], value, @params[4]) end |
#command_128 ⇒ Object
-
Change Armor
695 696 697 698 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 695 def command_128 value = operate_value(@params[1], @params[2], @params[3]) $game_party.gain_item($data_armors[@params[0]], value, @params[4]) end |
#command_129 ⇒ Object
-
Change Party Member
702 703 704 705 706 707 708 709 710 711 712 713 714 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 702 def command_129 actor = $game_actors[@params[0]] if actor if @params[1] == 0 # Add if @params[2] == 1 # Initialize $game_actors[@params[0]].setup(@params[0]) end $game_party.add_actor(@params[0]) else # Remove $game_party.remove_actor(@params[0]) end end end |
#command_132 ⇒ Object
-
Change Battle BGM
718 719 720 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 718 def command_132 $game_system.battle_bgm = @params[0] end |
#command_133 ⇒ Object
-
Change Battle End ME
724 725 726 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 724 def command_133 $game_system.battle_end_me = @params[0] end |
#command_134 ⇒ Object
-
Change Save Access
730 731 732 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 730 def command_134 $game_system.save_disabled = (@params[0] == 0) end |
#command_135 ⇒ Object
-
Change Menu Access
736 737 738 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 736 def command_135 $game_system. = (@params[0] == 0) end |
#command_136 ⇒ Object
-
Change Encounter Disable
742 743 744 745 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 742 def command_136 $game_system.encounter_disabled = (@params[0] == 0) $game_player.make_encounter_count end |
#command_137 ⇒ Object
-
Change Formation Access
749 750 751 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 749 def command_137 $game_system.formation_disabled = (@params[0] == 0) end |
#command_138 ⇒ Object
-
Change Window Color
755 756 757 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 755 def command_138 $game_system.window_tone = @params[0] end |
#command_201 ⇒ Object
-
Transfer Player
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 761 def command_201 return if $game_party.in_battle Fiber.yield while $game_player.transfer? || $game_message.visible if @params[0] == 0 # Direct designation map_id = @params[1] x = @params[2] y = @params[3] else # Designation with variables map_id = $game_variables[@params[1]] x = $game_variables[@params[2]] y = $game_variables[@params[3]] end $game_player.reserve_transfer(map_id, x, y, @params[4]) $game_temp.fade_type = @params[5] Fiber.yield while $game_player.transfer? end |
#command_202 ⇒ Object
-
Set Vehicle Location
780 781 782 783 784 785 786 787 788 789 790 791 792 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 780 def command_202 if @params[1] == 0 # Direct designation map_id = @params[2] x = @params[3] y = @params[4] else # Designation with variables map_id = $game_variables[@params[2]] x = $game_variables[@params[3]] y = $game_variables[@params[4]] end vehicle = $game_map.vehicles[@params[0]] vehicle.set_location(map_id, x, y) if vehicle end |
#command_203 ⇒ Object
-
Set Event Location
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 796 def command_203 character = get_character(@params[0]) if character if @params[1] == 0 # Direct designation character.moveto(@params[2], @params[3]) elsif @params[1] == 1 # Designation with variables new_x = $game_variables[@params[2]] new_y = $game_variables[@params[3]] character.moveto(new_x, new_y) else # Exchange with another event character2 = get_character(@params[2]) character.swap(character2) if character2 end character.set_direction(@params[4]) if @params[4] > 0 end end |
#command_204 ⇒ Object
-
Scroll Map
815 816 817 818 819 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 815 def command_204 return if $game_party.in_battle Fiber.yield while $game_map.scrolling? $game_map.start_scroll(@params[0], @params[1], @params[2]) end |
#command_205 ⇒ Object
-
Set Move Route
823 824 825 826 827 828 829 830 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 823 def command_205 $game_map.refresh if $game_map.need_refresh character = get_character(@params[0]) if character character.force_move_route(@params[1]) Fiber.yield while character.move_route_forcing if @params[1].wait end end |
#command_206 ⇒ Object
-
Getting On and Off Vehicles
834 835 836 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 834 def command_206 $game_player.get_on_off_vehicle end |
#command_211 ⇒ Object
-
Change Transparency
840 841 842 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 840 def command_211 $game_player.transparent = (@params[0] == 0) end |
#command_212 ⇒ Object
-
Show Animation
846 847 848 849 850 851 852 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 846 def command_212 character = get_character(@params[0]) if character character.animation_id = @params[1] Fiber.yield while character.animation_id > 0 if @params[2] end end |
#command_213 ⇒ Object
-
Show Balloon Icon
856 857 858 859 860 861 862 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 856 def command_213 character = get_character(@params[0]) if character character.balloon_id = @params[1] Fiber.yield while character.balloon_id > 0 if @params[2] end end |
#command_214 ⇒ Object
-
Temporarily Erase Event
866 867 868 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 866 def command_214 $game_map.events[@event_id].erase if same_map? && @event_id > 0 end |
#command_216 ⇒ Object
-
Change Player Followers
872 873 874 875 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 872 def command_216 $game_player.followers.visible = (@params[0] == 0) $game_player.refresh end |
#command_217 ⇒ Object
-
Gather Followers
879 880 881 882 883 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 879 def command_217 return if $game_party.in_battle $game_player.followers.gather Fiber.yield until $game_player.followers.gather? end |
#command_221 ⇒ Object
-
Fadeout Screen
887 888 889 890 891 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 887 def command_221 Fiber.yield while $game_message.visible screen.start_fadeout(30) wait(30) end |
#command_222 ⇒ Object
-
Fadein Screen
895 896 897 898 899 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 895 def command_222 Fiber.yield while $game_message.visible screen.start_fadein(30) wait(30) end |
#command_223 ⇒ Object
-
Tint Screen
903 904 905 906 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 903 def command_223 screen.start_tone_change(@params[0], @params[1]) wait(@params[1]) if @params[2] end |
#command_224 ⇒ Object
-
Screen Flash
910 911 912 913 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 910 def command_224 screen.start_flash(@params[0], @params[1]) wait(@params[1]) if @params[2] end |
#command_225 ⇒ Object
-
Screen Shake
917 918 919 920 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 917 def command_225 screen.start_shake(@params[0], @params[1], @params[2]) wait(@params[1]) if @params[2] end |
#command_230 ⇒ Object
-
Wait
924 925 926 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 924 def command_230 wait(@params[0]) end |
#command_231 ⇒ Object
-
Show Picture
930 931 932 933 934 935 936 937 938 939 940 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 930 def command_231 if @params[3] == 0 # Direct designation x = @params[4] y = @params[5] else # Designation with variables x = $game_variables[@params[4]] y = $game_variables[@params[5]] end screen.pictures[@params[0]].show(@params[1], @params[2], x, y, @params[6], @params[7], @params[8], @params[9]) end |
#command_232 ⇒ Object
-
Move Picture
944 945 946 947 948 949 950 951 952 953 954 955 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 944 def command_232 if @params[3] == 0 # Direct designation x = @params[4] y = @params[5] else # Designation with variables x = $game_variables[@params[4]] y = $game_variables[@params[5]] end screen.pictures[@params[0]].move(@params[2], x, y, @params[6], @params[7], @params[8], @params[9], @params[10]) wait(@params[10]) if @params[11] end |
#command_233 ⇒ Object
-
Rotate Picture
959 960 961 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 959 def command_233 screen.pictures[@params[0]].rotate(@params[1]) end |
#command_234 ⇒ Object
-
Tint Picture
965 966 967 968 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 965 def command_234 screen.pictures[@params[0]].start_tone_change(@params[1], @params[2]) wait(@params[2]) if @params[3] end |
#command_235 ⇒ Object
-
Erase Picture
972 973 974 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 972 def command_235 screen.pictures[@params[0]].erase end |
#command_236 ⇒ Object
-
Set Weather
978 979 980 981 982 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 978 def command_236 return if $game_party.in_battle screen.change_weather(@params[0], @params[1], @params[2]) wait(@params[2]) if @params[3] end |
#command_241 ⇒ Object
-
Play BGM
986 987 988 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 986 def command_241 @params[0].play end |
#command_242 ⇒ Object
-
Fadeout BGM
992 993 994 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 992 def command_242 RPG::BGM.fade(@params[0] * 1000) end |
#command_243 ⇒ Object
-
Save BGM
998 999 1000 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 998 def command_243 $game_system.save_bgm end |
#command_244 ⇒ Object
-
Resume BGM
1004 1005 1006 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1004 def command_244 $game_system.replay_bgm end |
#command_245 ⇒ Object
-
Play BGS
1010 1011 1012 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1010 def command_245 @params[0].play end |
#command_246 ⇒ Object
-
Fadeout BGS
1016 1017 1018 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1016 def command_246 RPG::BGS.fade(@params[0] * 1000) end |
#command_249 ⇒ Object
-
Play ME
1022 1023 1024 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1022 def command_249 @params[0].play end |
#command_250 ⇒ Object
-
Play SE
1028 1029 1030 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1028 def command_250 @params[0].play end |
#command_251 ⇒ Object
-
Stop SE
1034 1035 1036 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1034 def command_251 RPG::SE.stop end |
#command_261 ⇒ Object
-
Play Movie
1040 1041 1042 1043 1044 1045 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1040 def command_261 Fiber.yield while $game_message.visible Fiber.yield name = @params[0] Graphics.play_movie('Movies/' + name) unless name.empty? end |
#command_281 ⇒ Object
-
Change Map Name Display
1049 1050 1051 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1049 def command_281 $game_map.name_display = (@params[0] == 0) end |
#command_282 ⇒ Object
-
Change Tileset
1055 1056 1057 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1055 def command_282 $game_map.change_tileset(@params[0]) end |
#command_283 ⇒ Object
-
Change Battle Background
1061 1062 1063 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1061 def command_283 $game_map.change_battleback(@params[0], @params[1]) end |
#command_284 ⇒ Object
-
Change Parallax Background
1067 1068 1069 1070 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1067 def command_284 $game_map.change_parallax(@params[0], @params[1], @params[2], @params[3], @params[4]) end |
#command_285 ⇒ Object
-
Get Location Info
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1074 def command_285 if @params[2] == 0 # Direct designation x = @params[3] y = @params[4] else # Designation with variables x = $game_variables[@params[3]] y = $game_variables[@params[4]] end case @params[1] when 0 # Terrain Tag value = $game_map.terrain_tag(x, y) when 1 # Event ID value = $game_map.event_id_xy(x, y) when 2..4 # Tile ID value = $game_map.tile_id(x, y, @params[1] - 2) else # Region ID value = $game_map.region_id(x, y) end $game_variables[@params[0]] = value end |
#command_301 ⇒ Object
-
Battle Processing
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1097 def command_301 return if $game_party.in_battle if @params[0] == 0 # Direct designation troop_id = @params[1] elsif @params[0] == 1 # Designation with variables troop_id = $game_variables[@params[1]] else # Map-designated troop troop_id = $game_player.make_encounter_troop_id end if $data_troops[troop_id] BattleManager.setup(troop_id, @params[2], @params[3]) BattleManager.event_proc = Proc.new {|n| @branch[@indent] = n } $game_player.make_encounter_count SceneManager.call(Scene_Battle) end Fiber.yield end |
#command_302 ⇒ Object
-
Shop Processing
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1135 def command_302 return if $game_party.in_battle goods = [@params] while next_event_code == 605 @index += 1 goods.push(@list[@index].parameters) end SceneManager.call(Scene_Shop) SceneManager.scene.prepare(goods, @params[4]) Fiber.yield end |
#command_303 ⇒ Object
-
Name Input Processing
1149 1150 1151 1152 1153 1154 1155 1156 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1149 def command_303 return if $game_party.in_battle if $data_actors[@params[0]] SceneManager.call(Scene_Name) SceneManager.scene.prepare(@params[0], @params[1]) Fiber.yield end end |
#command_311 ⇒ Object
-
Change HP
1160 1161 1162 1163 1164 1165 1166 1167 1168 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1160 def command_311 value = operate_value(@params[2], @params[3], @params[4]) iterate_actor_var(@params[0], @params[1]) do |actor| next if actor.dead? actor.change_hp(value, @params[5]) actor.perform_collapse_effect if actor.dead? end SceneManager.goto(Scene_Gameover) if $game_party.all_dead? end |
#command_312 ⇒ Object
-
Change MP
1172 1173 1174 1175 1176 1177 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1172 def command_312 value = operate_value(@params[2], @params[3], @params[4]) iterate_actor_var(@params[0], @params[1]) do |actor| actor.mp += value end end |
#command_313 ⇒ Object
-
Change State
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1181 def command_313 iterate_actor_var(@params[0], @params[1]) do |actor| already_dead = actor.dead? if @params[2] == 0 actor.add_state(@params[3]) else actor.remove_state(@params[3]) end actor.perform_collapse_effect if actor.dead? && !already_dead end $game_party.clear_results end |
#command_314 ⇒ Object
-
Recover All
1196 1197 1198 1199 1200 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1196 def command_314 iterate_actor_var(@params[0], @params[1]) do |actor| actor.recover_all end end |
#command_315 ⇒ Object
-
Change EXP
1204 1205 1206 1207 1208 1209 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1204 def command_315 value = operate_value(@params[2], @params[3], @params[4]) iterate_actor_var(@params[0], @params[1]) do |actor| actor.change_exp(actor.exp + value, @params[5]) end end |
#command_316 ⇒ Object
-
Change Level
1213 1214 1215 1216 1217 1218 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1213 def command_316 value = operate_value(@params[2], @params[3], @params[4]) iterate_actor_var(@params[0], @params[1]) do |actor| actor.change_level(actor.level + value, @params[5]) end end |
#command_317 ⇒ Object
-
Change Parameters
1222 1223 1224 1225 1226 1227 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1222 def command_317 value = operate_value(@params[3], @params[4], @params[5]) iterate_actor_var(@params[0], @params[1]) do |actor| actor.add_param(@params[2], value) end end |
#command_318 ⇒ Object
-
Change Skills
1231 1232 1233 1234 1235 1236 1237 1238 1239 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1231 def command_318 iterate_actor_var(@params[0], @params[1]) do |actor| if @params[2] == 0 actor.learn_skill(@params[3]) else actor.forget_skill(@params[3]) end end end |
#command_319 ⇒ Object
-
Change Equipment
1243 1244 1245 1246 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1243 def command_319 actor = $game_actors[@params[0]] actor.change_equip_by_id(@params[1], @params[2]) if actor end |
#command_320 ⇒ Object
-
Change Name
1250 1251 1252 1253 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1250 def command_320 actor = $game_actors[@params[0]] actor.name = @params[1] if actor end |
#command_321 ⇒ Object
-
Change Class
1257 1258 1259 1260 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1257 def command_321 actor = $game_actors[@params[0]] actor.change_class(@params[1]) if actor && $data_classes[@params[1]] end |
#command_322 ⇒ Object
-
Change Actor Graphic
1264 1265 1266 1267 1268 1269 1270 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1264 def command_322 actor = $game_actors[@params[0]] if actor actor.set_graphic(@params[1], @params[2], @params[3], @params[4]) end $game_player.refresh end |
#command_323 ⇒ Object
-
Change Vehicle Graphic
1274 1275 1276 1277 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1274 def command_323 vehicle = $game_map.vehicles[@params[0]] vehicle.set_graphic(@params[1], @params[2]) if vehicle end |
#command_324 ⇒ Object
-
Change Nickname
1281 1282 1283 1284 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1281 def command_324 actor = $game_actors[@params[0]] actor.nickname = @params[1] if actor end |
#command_331 ⇒ Object
-
Change Enemy HP
1288 1289 1290 1291 1292 1293 1294 1295 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1288 def command_331 value = operate_value(@params[1], @params[2], @params[3]) iterate_enemy_index(@params[0]) do |enemy| return if enemy.dead? enemy.change_hp(value, @params[4]) enemy.perform_collapse_effect if enemy.dead? end end |
#command_332 ⇒ Object
-
Change Enemy MP
1299 1300 1301 1302 1303 1304 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1299 def command_332 value = operate_value(@params[1], @params[2], @params[3]) iterate_enemy_index(@params[0]) do |enemy| enemy.mp += value end end |
#command_333 ⇒ Object
-
Change Enemy State
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1308 def command_333 iterate_enemy_index(@params[0]) do |enemy| already_dead = enemy.dead? if @params[1] == 0 enemy.add_state(@params[2]) else enemy.remove_state(@params[2]) end enemy.perform_collapse_effect if enemy.dead? && !already_dead end end |
#command_334 ⇒ Object
-
Enemy Recover All
1322 1323 1324 1325 1326 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1322 def command_334 iterate_enemy_index(@params[0]) do |enemy| enemy.recover_all end end |
#command_335 ⇒ Object
-
Enemy Appear
1330 1331 1332 1333 1334 1335 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1330 def command_335 iterate_enemy_index(@params[0]) do |enemy| enemy.appear $game_troop.make_unique_names end end |
#command_336 ⇒ Object
-
Enemy Transform
1339 1340 1341 1342 1343 1344 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1339 def command_336 iterate_enemy_index(@params[0]) do |enemy| enemy.transform(@params[1]) $game_troop.make_unique_names end end |
#command_337 ⇒ Object
-
Show Battle Animation
1348 1349 1350 1351 1352 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1348 def command_337 iterate_enemy_index(@params[0]) do |enemy| enemy.animation_id = @params[1] if enemy.alive? end end |
#command_339 ⇒ Object
-
Force Action
1356 1357 1358 1359 1360 1361 1362 1363 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1356 def command_339 iterate_battler(@params[0], @params[1]) do |battler| next if battler.death_state? battler.force_action(@params[2], @params[3]) BattleManager.force_action(battler) Fiber.yield while BattleManager.action_forced? end end |
#command_340 ⇒ Object
-
Abort Battle
1367 1368 1369 1370 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1367 def command_340 BattleManager.abort Fiber.yield end |
#command_351 ⇒ Object
-
Open Menu Screen
1374 1375 1376 1377 1378 1379 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1374 def command_351 return if $game_party.in_battle SceneManager.call(Scene_Menu) Window_MenuCommand::init_command_position Fiber.yield end |
#command_352 ⇒ Object
-
Open Save Screen
1383 1384 1385 1386 1387 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1383 def command_352 return if $game_party.in_battle SceneManager.call(Scene_Save) Fiber.yield end |
#command_353 ⇒ Object
-
Game Over
1391 1392 1393 1394 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1391 def command_353 SceneManager.goto(Scene_Gameover) Fiber.yield end |
#command_354 ⇒ Object
-
Return to Title Screen
1398 1399 1400 1401 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1398 def command_354 SceneManager.goto(Scene_Title) Fiber.yield end |
#command_355 ⇒ Object
-
Script
1405 1406 1407 1408 1409 1410 1411 1412 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1405 def command_355 script = @list[@index].parameters[0] + "\n" while next_event_code == 655 @index += 1 script += @list[@index].parameters[0] + "\n" end eval(script) end |
#command_402 ⇒ Object
-
When [**]
293 294 295 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 293 def command_402 command_skip if @branch[@indent] != @params[0] end |
#command_403 ⇒ Object
-
When Cancel
299 300 301 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 299 def command_403 command_skip if @branch[@indent] != 4 end |
#command_411 ⇒ Object
-
Else
460 461 462 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 460 def command_411 command_skip if @branch[@indent] end |
#command_413 ⇒ Object
-
Repeat Above
471 472 473 474 475 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 471 def command_413 begin @index -= 1 end until @list[@index].indent == @indent end |
#command_601 ⇒ Object
-
If Win
1117 1118 1119 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1117 def command_601 command_skip if @branch[@indent] != 0 end |
#command_602 ⇒ Object
-
If Escape
1123 1124 1125 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1123 def command_602 command_skip if @branch[@indent] != 1 end |
#command_603 ⇒ Object
-
If Lose
1129 1130 1131 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 1129 def command_603 command_skip if @branch[@indent] != 2 end |
#command_skip ⇒ Object
-
Command Skip
Skip commands deeper than current index and advance index.
203 204 205 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 203 def command_skip @index += 1 while @list[@index + 1].indent > @indent end |
#create_fiber ⇒ Object
-
Create Fiber
59 60 61 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 59 def create_fiber @fiber = Fiber.new { run } if @list end |
#execute_command ⇒ Object
-
Event Command Execution
192 193 194 195 196 197 198 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 192 def execute_command command = @list[@index] @params = command.parameters @indent = command.indent method_name = "command_#{command.code}" send(method_name) if respond_to?(method_name) end |
#game_data_operand(type, param1, param2) ⇒ Object
-
Get Game Data for Variable Operand
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 552 def game_data_operand(type, param1, param2) case type when 0 # Items return $game_party.item_number($data_items[param1]) when 1 # Weapons return $game_party.item_number($data_weapons[param1]) when 2 # Armor return $game_party.item_number($data_armors[param1]) when 3 # Actors actor = $game_actors[param1] if actor case param2 when 0 # Level return actor.level when 1 # EXP return actor.exp when 2 # HP return actor.hp when 3 # MP return actor.mp when 4..11 # Parameter return actor.param(param2 - 4) end end when 4 # Enemies enemy = $game_troop.members[param1] if enemy case param2 when 0 # HP return enemy.hp when 1 # MP return enemy.mp when 2..9 # Parameter return enemy.param(param2 - 2) end end when 5 # Character character = get_character(param1) if character case param2 when 0 # x-coordinate return character.x when 1 # y-coordinate return character.y when 2 # direction return character.direction when 3 # screen x-coordinate return character.screen_x when 4 # screen y-coordinate return character.screen_y end end when 6 # Party actor = $game_party.members[param1] return actor ? actor.id : 0 when 7 # Other case param1 when 0 # map ID return $game_map.map_id when 1 # number of party members return $game_party.members.size when 2 # gold return $game_party.gold when 3 # steps return $game_party.steps when 4 # play time return Graphics.frame_count / Graphics.frame_rate when 5 # timer return $game_timer.sec when 6 # save count return $game_system.save_count when 7 # battle count return $game_system.battle_count end end return 0 end |
#get_character(param) ⇒ Object
-
Get Character
param : If -1, player. If 0, this event. Otherwise, event ID.
216 217 218 219 220 221 222 223 224 225 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 216 def get_character(param) if $game_party.in_battle nil elsif param < 0 $game_player else events = same_map? ? $game_map.events : {} events[param > 0 ? param : @event_id] end end |
#iterate_actor_id(param) ⇒ Object
-
Actor Iterator (ID)
param : If 1 or more, ID. If 0, all
125 126 127 128 129 130 131 132 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 125 def iterate_actor_id(param) if param == 0 $game_party.members.each {|actor| yield actor } else actor = $game_actors[param] yield actor if actor end end |
#iterate_actor_index(param) ⇒ Object
-
Actor Iterator (Index)
param : If 0 or more, index. If -1, all.
149 150 151 152 153 154 155 156 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 149 def iterate_actor_index(param) if param < 0 $game_party.members.each {|actor| yield actor } else actor = $game_party.members[param] yield actor if actor end end |
#iterate_actor_var(param1, param2) ⇒ Object
-
Actor Iterator (Variable)
param1: Specify as fixed if 0 and variable if 1 param2: Actor or variable ID
138 139 140 141 142 143 144 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 138 def iterate_actor_var(param1, param2) if param1 == 0 iterate_actor_id(param2) {|actor| yield actor } else iterate_actor_id($game_variables[param2]) {|actor| yield actor } end end |
#iterate_battler(param1, param2) ⇒ Object
-
Battler Iterator (Account for Entire Enemy Group or Entire Party)
param1 : If 0, enemy. If 1, actor. param2: Index if enemy and ID if actor.
174 175 176 177 178 179 180 181 182 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 174 def iterate_battler(param1, param2) if $game_party.in_battle if param1 == 0 iterate_enemy_index(param2) {|enemy| yield enemy } else iterate_actor_id(param2) {|actor| yield actor } end end end |
#iterate_enemy_index(param) ⇒ Object
-
Enemy Iterator (Index)
param : If 0 or more, index. If -1, all.
161 162 163 164 165 166 167 168 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 161 def iterate_enemy_index(param) if param < 0 $game_troop.members.each {|enemy| yield enemy } else enemy = $game_troop.members[param] yield enemy if enemy end end |
#marshal_dump ⇒ Object
-
Dump Objects
Define fibers in advance as they are not compatible with Marshal. Advance the event execution position by one and save.
67 68 69 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 67 def marshal_dump [@depth, @map_id, @event_id, @list, @index + 1, @branch] end |
#marshal_load(obj) ⇒ Object
-
Load Objects
obj: An array of objects dumped by marshal_dump. Restore data through multiple assignment and if necessary create fiber.
75 76 77 78 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 75 def marshal_load(obj) @depth, @map_id, @event_id, @list, @index, @branch = obj create_fiber end |
#next_event_code ⇒ Object
-
Get Code of Next Event Command
209 210 211 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 209 def next_event_code @list[@index + 1].code end |
#operate_value(operation, operand_type, operand) ⇒ Object
-
Calculate Operated Value
operation : Operation (0: Increase 1: Decrease) operand_type : Operand type (0: Constant 1: Variable) operand : Operand (numeric value or variable ID)
232 233 234 235 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 232 def operate_value(operation, operand_type, operand) value = operand_type == 0 ? operand : $game_variables[operand] operation == 0 ? value : -value end |
#operate_variable(variable_id, operation_type, value) ⇒ Object
-
Execute Variable Operation
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 632 def operate_variable(variable_id, operation_type, value) begin case operation_type when 0 # Set $game_variables[variable_id] = value when 1 # Add $game_variables[variable_id] += value when 2 # Sub $game_variables[variable_id] -= value when 3 # Mul $game_variables[variable_id] *= value when 4 # Div $game_variables[variable_id] /= value when 5 # Mod $game_variables[variable_id] %= value end rescue $game_variables[variable_id] = 0 end end |
#run ⇒ Object
-
Execute
100 101 102 103 104 105 106 107 108 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 100 def run while @list[@index] do execute_command @index += 1 end Fiber.yield @fiber = nil end |
#running? ⇒ Boolean
-
Determine if Running
112 113 114 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 112 def running? @fiber != nil end |
#same_map? ⇒ Boolean
-
Determine if Same Map as at Event Start
82 83 84 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 82 def same_map? @map_id == $game_map.map_id end |
#screen ⇒ Object
-
Get Target of Screen Command
186 187 188 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 186 def screen $game_party.in_battle ? $game_troop.screen : $game_map.screen end |
#setup(list, event_id = 0) ⇒ Object
-
Event Setup
49 50 51 52 53 54 55 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 49 def setup(list, event_id = 0) clear @map_id = $game_map.map_id @event_id = event_id @list = list create_fiber end |
#setup_choices(params) ⇒ Object
-
Setup Choices
285 286 287 288 289 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 285 def setup_choices(params) params[0].each {|s| $game_message.choices.push(s) } $game_message.choice_cancel_type = params[1] $game_message.choice_proc = Proc.new {|n| @branch[@indent] = n } end |
#setup_item_choice(params) ⇒ Object
-
Set Up Item Selection
328 329 330 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 328 def setup_item_choice(params) $game_message.item_choice_variable_id = params[0] end |
#setup_num_input(params) ⇒ Object
-
Number Input Setup
313 314 315 316 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 313 def setup_num_input(params) $game_message.num_input_variable_id = params[0] $game_message.num_input_digits_max = params[1] end |
#setup_reserved_common_event ⇒ Object
-
Detect/Set Up Call-Reserved Common Events
88 89 90 91 92 93 94 95 96 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 88 def setup_reserved_common_event if $game_temp.common_event_reserved? setup($game_temp.reserved_common_event.list) $game_temp.clear_common_event true else false end end |
#update ⇒ Object
-
Frame Update
118 119 120 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 118 def update @fiber.resume if @fiber end |
#wait(duration) ⇒ Object
-
Wait
239 240 241 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 239 def wait(duration) duration.times { Fiber.yield } end |
#wait_for_message ⇒ Object
-
Wait While Message Display is Busy
245 246 247 |
# File 'lib/rgss3_default_scripts/Game_Interpreter.rb', line 245 def Fiber.yield while $game_message.busy? end |