rgss3_default_scripts 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +4 -0
  4. data/README.md +9 -0
  5. data/Rakefile +2 -0
  6. data/lib/rgss3_default_scripts.rb +109 -0
  7. data/lib/rgss3_default_scripts/BattleManager.rb +392 -0
  8. data/lib/rgss3_default_scripts/Cache.rb +134 -0
  9. data/lib/rgss3_default_scripts/DataManager.rb +267 -0
  10. data/lib/rgss3_default_scripts/Game_Action.rb +262 -0
  11. data/lib/rgss3_default_scripts/Game_ActionResult.rb +159 -0
  12. data/lib/rgss3_default_scripts/Game_Actor.rb +696 -0
  13. data/lib/rgss3_default_scripts/Game_Actors.rb +22 -0
  14. data/lib/rgss3_default_scripts/Game_BaseItem.rb +51 -0
  15. data/lib/rgss3_default_scripts/Game_Battler.rb +824 -0
  16. data/lib/rgss3_default_scripts/Game_BattlerBase.rb +731 -0
  17. data/lib/rgss3_default_scripts/Game_Character.rb +396 -0
  18. data/lib/rgss3_default_scripts/Game_CharacterBase.rb +443 -0
  19. data/lib/rgss3_default_scripts/Game_CommonEvent.rb +41 -0
  20. data/lib/rgss3_default_scripts/Game_Enemy.rb +264 -0
  21. data/lib/rgss3_default_scripts/Game_Event.rb +308 -0
  22. data/lib/rgss3_default_scripts/Game_Follower.rb +74 -0
  23. data/lib/rgss3_default_scripts/Game_Followers.rb +112 -0
  24. data/lib/rgss3_default_scripts/Game_Interpreter.rb +1413 -0
  25. data/lib/rgss3_default_scripts/Game_Map.rb +704 -0
  26. data/lib/rgss3_default_scripts/Game_Message.rb +101 -0
  27. data/lib/rgss3_default_scripts/Game_Party.rb +418 -0
  28. data/lib/rgss3_default_scripts/Game_Picture.rb +161 -0
  29. data/lib/rgss3_default_scripts/Game_Pictures.rb +28 -0
  30. data/lib/rgss3_default_scripts/Game_Player.rb +488 -0
  31. data/lib/rgss3_default_scripts/Game_Screen.rb +234 -0
  32. data/lib/rgss3_default_scripts/Game_SelfSwitches.rb +35 -0
  33. data/lib/rgss3_default_scripts/Game_Switches.rb +35 -0
  34. data/lib/rgss3_default_scripts/Game_System.rb +122 -0
  35. data/lib/rgss3_default_scripts/Game_Temp.rb +45 -0
  36. data/lib/rgss3_default_scripts/Game_Timer.rb +56 -0
  37. data/lib/rgss3_default_scripts/Game_Troop.rb +205 -0
  38. data/lib/rgss3_default_scripts/Game_Unit.rb +131 -0
  39. data/lib/rgss3_default_scripts/Game_Variables.rb +34 -0
  40. data/lib/rgss3_default_scripts/Game_Vehicle.rb +193 -0
  41. data/lib/rgss3_default_scripts/SceneManager.rb +94 -0
  42. data/lib/rgss3_default_scripts/Scene_Base.rb +132 -0
  43. data/lib/rgss3_default_scripts/Scene_Battle.rb +693 -0
  44. data/lib/rgss3_default_scripts/Scene_Debug.rb +87 -0
  45. data/lib/rgss3_default_scripts/Scene_End.rb +61 -0
  46. data/lib/rgss3_default_scripts/Scene_Equip.rb +144 -0
  47. data/lib/rgss3_default_scripts/Scene_File.rb +203 -0
  48. data/lib/rgss3_default_scripts/Scene_Gameover.rb +85 -0
  49. data/lib/rgss3_default_scripts/Scene_Item.rb +75 -0
  50. data/lib/rgss3_default_scripts/Scene_ItemBase.rb +147 -0
  51. data/lib/rgss3_default_scripts/Scene_Load.rb +40 -0
  52. data/lib/rgss3_default_scripts/Scene_Map.rb +276 -0
  53. data/lib/rgss3_default_scripts/Scene_Menu.rb +127 -0
  54. data/lib/rgss3_default_scripts/Scene_MenuBase.rb +63 -0
  55. data/lib/rgss3_default_scripts/Scene_Name.rb +32 -0
  56. data/lib/rgss3_default_scripts/Scene_Save.rb +38 -0
  57. data/lib/rgss3_default_scripts/Scene_Shop.rb +299 -0
  58. data/lib/rgss3_default_scripts/Scene_Skill.rb +108 -0
  59. data/lib/rgss3_default_scripts/Scene_Status.rb +25 -0
  60. data/lib/rgss3_default_scripts/Scene_Title.rb +137 -0
  61. data/lib/rgss3_default_scripts/Sound.rb +135 -0
  62. data/lib/rgss3_default_scripts/Sprite_Base.rb +232 -0
  63. data/lib/rgss3_default_scripts/Sprite_Battler.rb +231 -0
  64. data/lib/rgss3_default_scripts/Sprite_Character.rb +226 -0
  65. data/lib/rgss3_default_scripts/Sprite_Picture.rb +82 -0
  66. data/lib/rgss3_default_scripts/Sprite_Timer.rb +77 -0
  67. data/lib/rgss3_default_scripts/Spriteset_Battle.rb +389 -0
  68. data/lib/rgss3_default_scripts/Spriteset_Map.rb +273 -0
  69. data/lib/rgss3_default_scripts/Spriteset_Weather.rb +184 -0
  70. data/lib/rgss3_default_scripts/Vocab.rb +145 -0
  71. data/lib/rgss3_default_scripts/Window_ActorCommand.rb +78 -0
  72. data/lib/rgss3_default_scripts/Window_Base.rb +571 -0
  73. data/lib/rgss3_default_scripts/Window_BattleActor.rb +38 -0
  74. data/lib/rgss3_default_scripts/Window_BattleEnemy.rb +70 -0
  75. data/lib/rgss3_default_scripts/Window_BattleItem.rb +40 -0
  76. data/lib/rgss3_default_scripts/Window_BattleLog.rb +425 -0
  77. data/lib/rgss3_default_scripts/Window_BattleSkill.rb +34 -0
  78. data/lib/rgss3_default_scripts/Window_BattleStatus.rb +111 -0
  79. data/lib/rgss3_default_scripts/Window_ChoiceList.rb +88 -0
  80. data/lib/rgss3_default_scripts/Window_Command.rb +152 -0
  81. data/lib/rgss3_default_scripts/Window_DebugLeft.rb +104 -0
  82. data/lib/rgss3_default_scripts/Window_DebugRight.rb +119 -0
  83. data/lib/rgss3_default_scripts/Window_EquipCommand.rb +36 -0
  84. data/lib/rgss3_default_scripts/Window_EquipItem.rb +78 -0
  85. data/lib/rgss3_default_scripts/Window_EquipSlot.rb +111 -0
  86. data/lib/rgss3_default_scripts/Window_EquipStatus.rb +97 -0
  87. data/lib/rgss3_default_scripts/Window_GameEnd.rb +38 -0
  88. data/lib/rgss3_default_scripts/Window_Gold.rb +47 -0
  89. data/lib/rgss3_default_scripts/Window_Help.rb +43 -0
  90. data/lib/rgss3_default_scripts/Window_HorzCommand.rb +106 -0
  91. data/lib/rgss3_default_scripts/Window_ItemCategory.rb +54 -0
  92. data/lib/rgss3_default_scripts/Window_ItemList.rb +117 -0
  93. data/lib/rgss3_default_scripts/Window_KeyItem.rb +55 -0
  94. data/lib/rgss3_default_scripts/Window_MapName.rb +96 -0
  95. data/lib/rgss3_default_scripts/Window_MenuActor.rb +43 -0
  96. data/lib/rgss3_default_scripts/Window_MenuCommand.rb +106 -0
  97. data/lib/rgss3_default_scripts/Window_MenuStatus.rb +85 -0
  98. data/lib/rgss3_default_scripts/Window_Message.rb +397 -0
  99. data/lib/rgss3_default_scripts/Window_NameEdit.rb +129 -0
  100. data/lib/rgss3_default_scripts/Window_NameInput.rb +253 -0
  101. data/lib/rgss3_default_scripts/Window_NumberInput.rb +148 -0
  102. data/lib/rgss3_default_scripts/Window_PartyCommand.rb +47 -0
  103. data/lib/rgss3_default_scripts/Window_SaveFile.rb +69 -0
  104. data/lib/rgss3_default_scripts/Window_ScrollText.rb +90 -0
  105. data/lib/rgss3_default_scripts/Window_Selectable.rb +442 -0
  106. data/lib/rgss3_default_scripts/Window_ShopBuy.rb +115 -0
  107. data/lib/rgss3_default_scripts/Window_ShopCommand.rb +36 -0
  108. data/lib/rgss3_default_scripts/Window_ShopNumber.rb +137 -0
  109. data/lib/rgss3_default_scripts/Window_ShopSell.rb +27 -0
  110. data/lib/rgss3_default_scripts/Window_ShopStatus.rb +124 -0
  111. data/lib/rgss3_default_scripts/Window_SkillCommand.rb +76 -0
  112. data/lib/rgss3_default_scripts/Window_SkillList.rb +121 -0
  113. data/lib/rgss3_default_scripts/Window_SkillStatus.rb +38 -0
  114. data/lib/rgss3_default_scripts/Window_Status.rb +125 -0
  115. data/lib/rgss3_default_scripts/Window_TitleCommand.rb +45 -0
  116. data/rgss3_default_scripts.gemspec +23 -0
  117. metadata +186 -0
@@ -0,0 +1,74 @@
1
+ #==============================================================================
2
+ # ** Game_Follower
3
+ #------------------------------------------------------------------------------
4
+ # This class handles followers. A follower is an allied character, other than
5
+ # the front character, displayed in the party. It is referenced within the
6
+ # Game_Followers class.
7
+ #==============================================================================
8
+
9
+ class Game_Follower < Game_Character
10
+ #--------------------------------------------------------------------------
11
+ # * Object Initialization
12
+ #--------------------------------------------------------------------------
13
+ def initialize(member_index, preceding_character)
14
+ super()
15
+ @member_index = member_index
16
+ @preceding_character = preceding_character
17
+ @transparent = $data_system.opt_transparent
18
+ @through = true
19
+ end
20
+ #--------------------------------------------------------------------------
21
+ # * Refresh
22
+ #--------------------------------------------------------------------------
23
+ def refresh
24
+ @character_name = visible? ? actor.character_name : ""
25
+ @character_index = visible? ? actor.character_index : 0
26
+ end
27
+ #--------------------------------------------------------------------------
28
+ # * Get Corresponding Actor
29
+ #--------------------------------------------------------------------------
30
+ def actor
31
+ $game_party.battle_members[@member_index]
32
+ end
33
+ #--------------------------------------------------------------------------
34
+ # * Determine Visibility
35
+ #--------------------------------------------------------------------------
36
+ def visible?
37
+ actor && $game_player.followers.visible
38
+ end
39
+ #--------------------------------------------------------------------------
40
+ # * Frame Update
41
+ #--------------------------------------------------------------------------
42
+ def update
43
+ @move_speed = $game_player.real_move_speed
44
+ @transparent = $game_player.transparent
45
+ @walk_anime = $game_player.walk_anime
46
+ @step_anime = $game_player.step_anime
47
+ @direction_fix = $game_player.direction_fix
48
+ @opacity = $game_player.opacity
49
+ @blend_type = $game_player.blend_type
50
+ super
51
+ end
52
+ #--------------------------------------------------------------------------
53
+ # * Pursue Preceding Character
54
+ #--------------------------------------------------------------------------
55
+ def chase_preceding_character
56
+ unless moving?
57
+ sx = distance_x_from(@preceding_character.x)
58
+ sy = distance_y_from(@preceding_character.y)
59
+ if sx != 0 && sy != 0
60
+ move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
61
+ elsif sx != 0
62
+ move_straight(sx > 0 ? 4 : 6)
63
+ elsif sy != 0
64
+ move_straight(sy > 0 ? 8 : 2)
65
+ end
66
+ end
67
+ end
68
+ #--------------------------------------------------------------------------
69
+ # * Determine if at Same Position as Preceding Character
70
+ #--------------------------------------------------------------------------
71
+ def gather?
72
+ !moving? && pos?(@preceding_character.x, @preceding_character.y)
73
+ end
74
+ end
@@ -0,0 +1,112 @@
1
+ #==============================================================================
2
+ # ** Game_Followers
3
+ #------------------------------------------------------------------------------
4
+ # This is a wrapper for a follower array. This class is used internally for
5
+ # the Game_Player class.
6
+ #==============================================================================
7
+
8
+ class Game_Followers
9
+ #--------------------------------------------------------------------------
10
+ # * Public Instance Variables
11
+ #--------------------------------------------------------------------------
12
+ attr_accessor :visible # Player Followers ON?
13
+ #--------------------------------------------------------------------------
14
+ # * Object Initialization
15
+ # leader: Lead character
16
+ #--------------------------------------------------------------------------
17
+ def initialize(leader)
18
+ @visible = $data_system.opt_followers
19
+ @gathering = false # Gathering processing underway flag
20
+ @data = []
21
+ @data.push(Game_Follower.new(1, leader))
22
+ (2...$game_party.max_battle_members).each do |index|
23
+ @data.push(Game_Follower.new(index, @data[-1]))
24
+ end
25
+ end
26
+ #--------------------------------------------------------------------------
27
+ # * Get Followers
28
+ #--------------------------------------------------------------------------
29
+ def [](index)
30
+ @data[index]
31
+ end
32
+ #--------------------------------------------------------------------------
33
+ # * Iterator
34
+ #--------------------------------------------------------------------------
35
+ def each
36
+ @data.each {|follower| yield follower } if block_given?
37
+ end
38
+ #--------------------------------------------------------------------------
39
+ # * Iterator (Reverse)
40
+ #--------------------------------------------------------------------------
41
+ def reverse_each
42
+ @data.reverse.each {|follower| yield follower } if block_given?
43
+ end
44
+ #--------------------------------------------------------------------------
45
+ # * Refresh
46
+ #--------------------------------------------------------------------------
47
+ def refresh
48
+ each {|follower| follower.refresh }
49
+ end
50
+ #--------------------------------------------------------------------------
51
+ # * Frame Update
52
+ #--------------------------------------------------------------------------
53
+ def update
54
+ if gathering?
55
+ move unless moving? || moving?
56
+ @gathering = false if gather?
57
+ end
58
+ each {|follower| follower.update }
59
+ end
60
+ #--------------------------------------------------------------------------
61
+ # * Movement
62
+ #--------------------------------------------------------------------------
63
+ def move
64
+ reverse_each {|follower| follower.chase_preceding_character }
65
+ end
66
+ #--------------------------------------------------------------------------
67
+ # * Synchronize
68
+ #--------------------------------------------------------------------------
69
+ def synchronize(x, y, d)
70
+ each do |follower|
71
+ follower.moveto(x, y)
72
+ follower.set_direction(d)
73
+ end
74
+ end
75
+ #--------------------------------------------------------------------------
76
+ # * Gather
77
+ #--------------------------------------------------------------------------
78
+ def gather
79
+ @gathering = true
80
+ end
81
+ #--------------------------------------------------------------------------
82
+ # * Determine if Gathering
83
+ #--------------------------------------------------------------------------
84
+ def gathering?
85
+ @gathering
86
+ end
87
+ #--------------------------------------------------------------------------
88
+ # * Get Array of Displayed Followers
89
+ # "folloers" is typo, but retained because of the compatibility.
90
+ #--------------------------------------------------------------------------
91
+ def visible_folloers
92
+ @data.select {|follower| follower.visible? }
93
+ end
94
+ #--------------------------------------------------------------------------
95
+ # * Determine if Moving
96
+ #--------------------------------------------------------------------------
97
+ def moving?
98
+ visible_folloers.any? {|follower| follower.moving? }
99
+ end
100
+ #--------------------------------------------------------------------------
101
+ # * Determine if Gathered
102
+ #--------------------------------------------------------------------------
103
+ def gather?
104
+ visible_folloers.all? {|follower| follower.gather? }
105
+ end
106
+ #--------------------------------------------------------------------------
107
+ # * Detect Collision
108
+ #--------------------------------------------------------------------------
109
+ def collide?(x, y)
110
+ visible_folloers.any? {|follower| follower.pos?(x, y) }
111
+ end
112
+ end
@@ -0,0 +1,1413 @@
1
+ #==============================================================================
2
+ # ** Game_Interpreter
3
+ #------------------------------------------------------------------------------
4
+ # An interpreter for executing event commands. This class is used within the
5
+ # Game_Map, Game_Troop, and Game_Event classes.
6
+ #==============================================================================
7
+
8
+ class Game_Interpreter
9
+ #--------------------------------------------------------------------------
10
+ # * Public Instance Variables
11
+ #--------------------------------------------------------------------------
12
+ attr_reader :map_id # Map ID
13
+ attr_reader :event_id # Event ID (normal events only)
14
+ #--------------------------------------------------------------------------
15
+ # * Object Initialization
16
+ # depth : nest depth
17
+ #--------------------------------------------------------------------------
18
+ def initialize(depth = 0)
19
+ @depth = depth
20
+ check_overflow
21
+ clear
22
+ end
23
+ #--------------------------------------------------------------------------
24
+ # * Check for Overflow
25
+ # Under normal usage, the depth will not exceed 100. Since recursive
26
+ # event calls are likely to result in an infinite loop, the depth is
27
+ # cut off at 100 and an error results.
28
+ #--------------------------------------------------------------------------
29
+ def check_overflow
30
+ if @depth >= 100
31
+ msgbox(Vocab::EventOverflow)
32
+ exit
33
+ end
34
+ end
35
+ #--------------------------------------------------------------------------
36
+ # * Clear
37
+ #--------------------------------------------------------------------------
38
+ def clear
39
+ @map_id = 0
40
+ @event_id = 0
41
+ @list = nil # Execution content
42
+ @index = 0 # Index
43
+ @branch = {} # Branch data
44
+ @fiber = nil # Fiber
45
+ end
46
+ #--------------------------------------------------------------------------
47
+ # * Event Setup
48
+ #--------------------------------------------------------------------------
49
+ def setup(list, event_id = 0)
50
+ clear
51
+ @map_id = $game_map.map_id
52
+ @event_id = event_id
53
+ @list = list
54
+ create_fiber
55
+ end
56
+ #--------------------------------------------------------------------------
57
+ # * Create Fiber
58
+ #--------------------------------------------------------------------------
59
+ def create_fiber
60
+ @fiber = Fiber.new { run } if @list
61
+ end
62
+ #--------------------------------------------------------------------------
63
+ # * Dump Objects
64
+ # Define fibers in advance as they are not compatible with Marshal.
65
+ # Advance the event execution position by one and save.
66
+ #--------------------------------------------------------------------------
67
+ def marshal_dump
68
+ [@depth, @map_id, @event_id, @list, @index + 1, @branch]
69
+ end
70
+ #--------------------------------------------------------------------------
71
+ # * Load Objects
72
+ # obj: An array of objects dumped by marshal_dump.
73
+ # Restore data through multiple assignment and if necessary create fiber.
74
+ #--------------------------------------------------------------------------
75
+ def marshal_load(obj)
76
+ @depth, @map_id, @event_id, @list, @index, @branch = obj
77
+ create_fiber
78
+ end
79
+ #--------------------------------------------------------------------------
80
+ # * Determine if Same Map as at Event Start
81
+ #--------------------------------------------------------------------------
82
+ def same_map?
83
+ @map_id == $game_map.map_id
84
+ end
85
+ #--------------------------------------------------------------------------
86
+ # * Detect/Set Up Call-Reserved Common Events
87
+ #--------------------------------------------------------------------------
88
+ def setup_reserved_common_event
89
+ if $game_temp.common_event_reserved?
90
+ setup($game_temp.reserved_common_event.list)
91
+ $game_temp.clear_common_event
92
+ true
93
+ else
94
+ false
95
+ end
96
+ end
97
+ #--------------------------------------------------------------------------
98
+ # * Execute
99
+ #--------------------------------------------------------------------------
100
+ def run
101
+ wait_for_message
102
+ while @list[@index] do
103
+ execute_command
104
+ @index += 1
105
+ end
106
+ Fiber.yield
107
+ @fiber = nil
108
+ end
109
+ #--------------------------------------------------------------------------
110
+ # * Determine if Running
111
+ #--------------------------------------------------------------------------
112
+ def running?
113
+ @fiber != nil
114
+ end
115
+ #--------------------------------------------------------------------------
116
+ # * Frame Update
117
+ #--------------------------------------------------------------------------
118
+ def update
119
+ @fiber.resume if @fiber
120
+ end
121
+ #--------------------------------------------------------------------------
122
+ # * Actor Iterator (ID)
123
+ # param : If 1 or more, ID. If 0, all
124
+ #--------------------------------------------------------------------------
125
+ def iterate_actor_id(param)
126
+ if param == 0
127
+ $game_party.members.each {|actor| yield actor }
128
+ else
129
+ actor = $game_actors[param]
130
+ yield actor if actor
131
+ end
132
+ end
133
+ #--------------------------------------------------------------------------
134
+ # * Actor Iterator (Variable)
135
+ # param1: Specify as fixed if 0 and variable if 1
136
+ # param2: Actor or variable ID
137
+ #--------------------------------------------------------------------------
138
+ def iterate_actor_var(param1, param2)
139
+ if param1 == 0
140
+ iterate_actor_id(param2) {|actor| yield actor }
141
+ else
142
+ iterate_actor_id($game_variables[param2]) {|actor| yield actor }
143
+ end
144
+ end
145
+ #--------------------------------------------------------------------------
146
+ # * Actor Iterator (Index)
147
+ # param : If 0 or more, index. If -1, all.
148
+ #--------------------------------------------------------------------------
149
+ def iterate_actor_index(param)
150
+ if param < 0
151
+ $game_party.members.each {|actor| yield actor }
152
+ else
153
+ actor = $game_party.members[param]
154
+ yield actor if actor
155
+ end
156
+ end
157
+ #--------------------------------------------------------------------------
158
+ # * Enemy Iterator (Index)
159
+ # param : If 0 or more, index. If -1, all.
160
+ #--------------------------------------------------------------------------
161
+ def iterate_enemy_index(param)
162
+ if param < 0
163
+ $game_troop.members.each {|enemy| yield enemy }
164
+ else
165
+ enemy = $game_troop.members[param]
166
+ yield enemy if enemy
167
+ end
168
+ end
169
+ #--------------------------------------------------------------------------
170
+ # * Battler Iterator (Account for Entire Enemy Group or Entire Party)
171
+ # param1 : If 0, enemy. If 1, actor.
172
+ # param2: Index if enemy and ID if actor.
173
+ #--------------------------------------------------------------------------
174
+ def iterate_battler(param1, param2)
175
+ if $game_party.in_battle
176
+ if param1 == 0
177
+ iterate_enemy_index(param2) {|enemy| yield enemy }
178
+ else
179
+ iterate_actor_id(param2) {|actor| yield actor }
180
+ end
181
+ end
182
+ end
183
+ #--------------------------------------------------------------------------
184
+ # * Get Target of Screen Command
185
+ #--------------------------------------------------------------------------
186
+ def screen
187
+ $game_party.in_battle ? $game_troop.screen : $game_map.screen
188
+ end
189
+ #--------------------------------------------------------------------------
190
+ # * Event Command Execution
191
+ #--------------------------------------------------------------------------
192
+ def execute_command
193
+ command = @list[@index]
194
+ @params = command.parameters
195
+ @indent = command.indent
196
+ method_name = "command_#{command.code}"
197
+ send(method_name) if respond_to?(method_name)
198
+ end
199
+ #--------------------------------------------------------------------------
200
+ # * Command Skip
201
+ # Skip commands deeper than current index and advance index.
202
+ #--------------------------------------------------------------------------
203
+ def command_skip
204
+ @index += 1 while @list[@index + 1].indent > @indent
205
+ end
206
+ #--------------------------------------------------------------------------
207
+ # * Get Code of Next Event Command
208
+ #--------------------------------------------------------------------------
209
+ def next_event_code
210
+ @list[@index + 1].code
211
+ end
212
+ #--------------------------------------------------------------------------
213
+ # * Get Character
214
+ # param : If -1, player. If 0, this event. Otherwise, event ID.
215
+ #--------------------------------------------------------------------------
216
+ def get_character(param)
217
+ if $game_party.in_battle
218
+ nil
219
+ elsif param < 0
220
+ $game_player
221
+ else
222
+ events = same_map? ? $game_map.events : {}
223
+ events[param > 0 ? param : @event_id]
224
+ end
225
+ end
226
+ #--------------------------------------------------------------------------
227
+ # * Calculate Operated Value
228
+ # operation : Operation (0: Increase 1: Decrease)
229
+ # operand_type : Operand type (0: Constant 1: Variable)
230
+ # operand : Operand (numeric value or variable ID)
231
+ #--------------------------------------------------------------------------
232
+ def operate_value(operation, operand_type, operand)
233
+ value = operand_type == 0 ? operand : $game_variables[operand]
234
+ operation == 0 ? value : -value
235
+ end
236
+ #--------------------------------------------------------------------------
237
+ # * Wait
238
+ #--------------------------------------------------------------------------
239
+ def wait(duration)
240
+ duration.times { Fiber.yield }
241
+ end
242
+ #--------------------------------------------------------------------------
243
+ # * Wait While Message Display is Busy
244
+ #--------------------------------------------------------------------------
245
+ def wait_for_message
246
+ Fiber.yield while $game_message.busy?
247
+ end
248
+ #--------------------------------------------------------------------------
249
+ # * Show Text
250
+ #--------------------------------------------------------------------------
251
+ def command_101
252
+ wait_for_message
253
+ $game_message.face_name = @params[0]
254
+ $game_message.face_index = @params[1]
255
+ $game_message.background = @params[2]
256
+ $game_message.position = @params[3]
257
+ while next_event_code == 401 # Text data
258
+ @index += 1
259
+ $game_message.add(@list[@index].parameters[0])
260
+ end
261
+ case next_event_code
262
+ when 102 # Show Choices
263
+ @index += 1
264
+ setup_choices(@list[@index].parameters)
265
+ when 103 # Input Number
266
+ @index += 1
267
+ setup_num_input(@list[@index].parameters)
268
+ when 104 # Select Item
269
+ @index += 1
270
+ setup_item_choice(@list[@index].parameters)
271
+ end
272
+ wait_for_message
273
+ end
274
+ #--------------------------------------------------------------------------
275
+ # * Show Choices
276
+ #--------------------------------------------------------------------------
277
+ def command_102
278
+ wait_for_message
279
+ setup_choices(@params)
280
+ Fiber.yield while $game_message.choice?
281
+ end
282
+ #--------------------------------------------------------------------------
283
+ # * Setup Choices
284
+ #--------------------------------------------------------------------------
285
+ def setup_choices(params)
286
+ params[0].each {|s| $game_message.choices.push(s) }
287
+ $game_message.choice_cancel_type = params[1]
288
+ $game_message.choice_proc = Proc.new {|n| @branch[@indent] = n }
289
+ end
290
+ #--------------------------------------------------------------------------
291
+ # * When [**]
292
+ #--------------------------------------------------------------------------
293
+ def command_402
294
+ command_skip if @branch[@indent] != @params[0]
295
+ end
296
+ #--------------------------------------------------------------------------
297
+ # * When Cancel
298
+ #--------------------------------------------------------------------------
299
+ def command_403
300
+ command_skip if @branch[@indent] != 4
301
+ end
302
+ #--------------------------------------------------------------------------
303
+ # * Input Number
304
+ #--------------------------------------------------------------------------
305
+ def command_103
306
+ wait_for_message
307
+ setup_num_input(@params)
308
+ Fiber.yield while $game_message.num_input?
309
+ end
310
+ #--------------------------------------------------------------------------
311
+ # * Number Input Setup
312
+ #--------------------------------------------------------------------------
313
+ def setup_num_input(params)
314
+ $game_message.num_input_variable_id = params[0]
315
+ $game_message.num_input_digits_max = params[1]
316
+ end
317
+ #--------------------------------------------------------------------------
318
+ # * Select Item
319
+ #--------------------------------------------------------------------------
320
+ def command_104
321
+ wait_for_message
322
+ setup_item_choice(@params)
323
+ Fiber.yield while $game_message.item_choice?
324
+ end
325
+ #--------------------------------------------------------------------------
326
+ # * Set Up Item Selection
327
+ #--------------------------------------------------------------------------
328
+ def setup_item_choice(params)
329
+ $game_message.item_choice_variable_id = params[0]
330
+ end
331
+ #--------------------------------------------------------------------------
332
+ # * Show Scrolling Text
333
+ #--------------------------------------------------------------------------
334
+ def command_105
335
+ Fiber.yield while $game_message.visible
336
+ $game_message.scroll_mode = true
337
+ $game_message.scroll_speed = @params[0]
338
+ $game_message.scroll_no_fast = @params[1]
339
+ while next_event_code == 405
340
+ @index += 1
341
+ $game_message.add(@list[@index].parameters[0])
342
+ end
343
+ wait_for_message
344
+ end
345
+ #--------------------------------------------------------------------------
346
+ # * Comment
347
+ #--------------------------------------------------------------------------
348
+ def command_108
349
+ @comments = [@params[0]]
350
+ while next_event_code == 408
351
+ @index += 1
352
+ @comments.push(@list[@index].parameters[0])
353
+ end
354
+ end
355
+ #--------------------------------------------------------------------------
356
+ # * Conditional Branch
357
+ #--------------------------------------------------------------------------
358
+ def command_111
359
+ result = false
360
+ case @params[0]
361
+ when 0 # Switch
362
+ result = ($game_switches[@params[1]] == (@params[2] == 0))
363
+ when 1 # Variable
364
+ value1 = $game_variables[@params[1]]
365
+ if @params[2] == 0
366
+ value2 = @params[3]
367
+ else
368
+ value2 = $game_variables[@params[3]]
369
+ end
370
+ case @params[4]
371
+ when 0 # value1 is equal to value2
372
+ result = (value1 == value2)
373
+ when 1 # value1 is greater than or equal to value2
374
+ result = (value1 >= value2)
375
+ when 2 # value1 is less than or equal to value2
376
+ result = (value1 <= value2)
377
+ when 3 # value1 is greater than value2
378
+ result = (value1 > value2)
379
+ when 4 # value1 is less than value2
380
+ result = (value1 < value2)
381
+ when 5 # value1 is not equal to value2
382
+ result = (value1 != value2)
383
+ end
384
+ when 2 # Self switch
385
+ if @event_id > 0
386
+ key = [@map_id, @event_id, @params[1]]
387
+ result = ($game_self_switches[key] == (@params[2] == 0))
388
+ end
389
+ when 3 # Timer
390
+ if $game_timer.working?
391
+ if @params[2] == 0
392
+ result = ($game_timer.sec >= @params[1])
393
+ else
394
+ result = ($game_timer.sec <= @params[1])
395
+ end
396
+ end
397
+ when 4 # Actor
398
+ actor = $game_actors[@params[1]]
399
+ if actor
400
+ case @params[2]
401
+ when 0 # in party
402
+ result = ($game_party.members.include?(actor))
403
+ when 1 # name
404
+ result = (actor.name == @params[3])
405
+ when 2 # Class
406
+ result = (actor.class_id == @params[3])
407
+ when 3 # Skills
408
+ result = (actor.skill_learn?($data_skills[@params[3]]))
409
+ when 4 # Weapons
410
+ result = (actor.weapons.include?($data_weapons[@params[3]]))
411
+ when 5 # Armors
412
+ result = (actor.armors.include?($data_armors[@params[3]]))
413
+ when 6 # States
414
+ result = (actor.state?(@params[3]))
415
+ end
416
+ end
417
+ when 5 # Enemy
418
+ enemy = $game_troop.members[@params[1]]
419
+ if enemy
420
+ case @params[2]
421
+ when 0 # appear
422
+ result = (enemy.alive?)
423
+ when 1 # state
424
+ result = (enemy.state?(@params[3]))
425
+ end
426
+ end
427
+ when 6 # Character
428
+ character = get_character(@params[1])
429
+ if character
430
+ result = (character.direction == @params[2])
431
+ end
432
+ when 7 # Gold
433
+ case @params[2]
434
+ when 0 # Greater than or equal to
435
+ result = ($game_party.gold >= @params[1])
436
+ when 1 # Less than or equal to
437
+ result = ($game_party.gold <= @params[1])
438
+ when 2 # Less than
439
+ result = ($game_party.gold < @params[1])
440
+ end
441
+ when 8 # Item
442
+ result = $game_party.has_item?($data_items[@params[1]])
443
+ when 9 # Weapon
444
+ result = $game_party.has_item?($data_weapons[@params[1]], @params[2])
445
+ when 10 # Armor
446
+ result = $game_party.has_item?($data_armors[@params[1]], @params[2])
447
+ when 11 # Button
448
+ result = Input.press?(@params[1])
449
+ when 12 # Script
450
+ result = eval(@params[1])
451
+ when 13 # Vehicle
452
+ result = ($game_player.vehicle == $game_map.vehicles[@params[1]])
453
+ end
454
+ @branch[@indent] = result
455
+ command_skip if !@branch[@indent]
456
+ end
457
+ #--------------------------------------------------------------------------
458
+ # * Else
459
+ #--------------------------------------------------------------------------
460
+ def command_411
461
+ command_skip if @branch[@indent]
462
+ end
463
+ #--------------------------------------------------------------------------
464
+ # * Loop
465
+ #--------------------------------------------------------------------------
466
+ def command_112
467
+ end
468
+ #--------------------------------------------------------------------------
469
+ # * Repeat Above
470
+ #--------------------------------------------------------------------------
471
+ def command_413
472
+ begin
473
+ @index -= 1
474
+ end until @list[@index].indent == @indent
475
+ end
476
+ #--------------------------------------------------------------------------
477
+ # * Break Loop
478
+ #--------------------------------------------------------------------------
479
+ def command_113
480
+ loop do
481
+ @index += 1
482
+ return if @index >= @list.size - 1
483
+ return if @list[@index].code == 413 && @list[@index].indent < @indent
484
+ end
485
+ end
486
+ #--------------------------------------------------------------------------
487
+ # * Exit Event Processing
488
+ #--------------------------------------------------------------------------
489
+ def command_115
490
+ @index = @list.size
491
+ end
492
+ #--------------------------------------------------------------------------
493
+ # * Common Event
494
+ #--------------------------------------------------------------------------
495
+ def command_117
496
+ common_event = $data_common_events[@params[0]]
497
+ if common_event
498
+ child = Game_Interpreter.new(@depth + 1)
499
+ child.setup(common_event.list, same_map? ? @event_id : 0)
500
+ child.run
501
+ end
502
+ end
503
+ #--------------------------------------------------------------------------
504
+ # * Label
505
+ #--------------------------------------------------------------------------
506
+ def command_118
507
+ end
508
+ #--------------------------------------------------------------------------
509
+ # * Jump to Label
510
+ #--------------------------------------------------------------------------
511
+ def command_119
512
+ label_name = @params[0]
513
+ @list.size.times do |i|
514
+ if @list[i].code == 118 && @list[i].parameters[0] == label_name
515
+ @index = i
516
+ return
517
+ end
518
+ end
519
+ end
520
+ #--------------------------------------------------------------------------
521
+ # * Control Switches
522
+ #--------------------------------------------------------------------------
523
+ def command_121
524
+ (@params[0]..@params[1]).each do |i|
525
+ $game_switches[i] = (@params[2] == 0)
526
+ end
527
+ end
528
+ #--------------------------------------------------------------------------
529
+ # * Control Variables
530
+ #--------------------------------------------------------------------------
531
+ def command_122
532
+ value = 0
533
+ case @params[3] # Operand
534
+ when 0 # Constant
535
+ value = @params[4]
536
+ when 1 # Variable
537
+ value = $game_variables[@params[4]]
538
+ when 2 # Random
539
+ value = @params[4] + rand(@params[5] - @params[4] + 1)
540
+ when 3 # Game Data
541
+ value = game_data_operand(@params[4], @params[5], @params[6])
542
+ when 4 # Script
543
+ value = eval(@params[4])
544
+ end
545
+ (@params[0]..@params[1]).each do |i|
546
+ operate_variable(i, @params[2], value)
547
+ end
548
+ end
549
+ #--------------------------------------------------------------------------
550
+ # * Get Game Data for Variable Operand
551
+ #--------------------------------------------------------------------------
552
+ def game_data_operand(type, param1, param2)
553
+ case type
554
+ when 0 # Items
555
+ return $game_party.item_number($data_items[param1])
556
+ when 1 # Weapons
557
+ return $game_party.item_number($data_weapons[param1])
558
+ when 2 # Armor
559
+ return $game_party.item_number($data_armors[param1])
560
+ when 3 # Actors
561
+ actor = $game_actors[param1]
562
+ if actor
563
+ case param2
564
+ when 0 # Level
565
+ return actor.level
566
+ when 1 # EXP
567
+ return actor.exp
568
+ when 2 # HP
569
+ return actor.hp
570
+ when 3 # MP
571
+ return actor.mp
572
+ when 4..11 # Parameter
573
+ return actor.param(param2 - 4)
574
+ end
575
+ end
576
+ when 4 # Enemies
577
+ enemy = $game_troop.members[param1]
578
+ if enemy
579
+ case param2
580
+ when 0 # HP
581
+ return enemy.hp
582
+ when 1 # MP
583
+ return enemy.mp
584
+ when 2..9 # Parameter
585
+ return enemy.param(param2 - 2)
586
+ end
587
+ end
588
+ when 5 # Character
589
+ character = get_character(param1)
590
+ if character
591
+ case param2
592
+ when 0 # x-coordinate
593
+ return character.x
594
+ when 1 # y-coordinate
595
+ return character.y
596
+ when 2 # direction
597
+ return character.direction
598
+ when 3 # screen x-coordinate
599
+ return character.screen_x
600
+ when 4 # screen y-coordinate
601
+ return character.screen_y
602
+ end
603
+ end
604
+ when 6 # Party
605
+ actor = $game_party.members[param1]
606
+ return actor ? actor.id : 0
607
+ when 7 # Other
608
+ case param1
609
+ when 0 # map ID
610
+ return $game_map.map_id
611
+ when 1 # number of party members
612
+ return $game_party.members.size
613
+ when 2 # gold
614
+ return $game_party.gold
615
+ when 3 # steps
616
+ return $game_party.steps
617
+ when 4 # play time
618
+ return Graphics.frame_count / Graphics.frame_rate
619
+ when 5 # timer
620
+ return $game_timer.sec
621
+ when 6 # save count
622
+ return $game_system.save_count
623
+ when 7 # battle count
624
+ return $game_system.battle_count
625
+ end
626
+ end
627
+ return 0
628
+ end
629
+ #--------------------------------------------------------------------------
630
+ # * Execute Variable Operation
631
+ #--------------------------------------------------------------------------
632
+ def operate_variable(variable_id, operation_type, value)
633
+ begin
634
+ case operation_type
635
+ when 0 # Set
636
+ $game_variables[variable_id] = value
637
+ when 1 # Add
638
+ $game_variables[variable_id] += value
639
+ when 2 # Sub
640
+ $game_variables[variable_id] -= value
641
+ when 3 # Mul
642
+ $game_variables[variable_id] *= value
643
+ when 4 # Div
644
+ $game_variables[variable_id] /= value
645
+ when 5 # Mod
646
+ $game_variables[variable_id] %= value
647
+ end
648
+ rescue
649
+ $game_variables[variable_id] = 0
650
+ end
651
+ end
652
+ #--------------------------------------------------------------------------
653
+ # * Control Self Switch
654
+ #--------------------------------------------------------------------------
655
+ def command_123
656
+ if @event_id > 0
657
+ key = [@map_id, @event_id, @params[0]]
658
+ $game_self_switches[key] = (@params[1] == 0)
659
+ end
660
+ end
661
+ #--------------------------------------------------------------------------
662
+ # * Control Timer
663
+ #--------------------------------------------------------------------------
664
+ def command_124
665
+ if @params[0] == 0 # Start
666
+ $game_timer.start(@params[1] * Graphics.frame_rate)
667
+ else # Stop
668
+ $game_timer.stop
669
+ end
670
+ end
671
+ #--------------------------------------------------------------------------
672
+ # * Change Gold
673
+ #--------------------------------------------------------------------------
674
+ def command_125
675
+ value = operate_value(@params[0], @params[1], @params[2])
676
+ $game_party.gain_gold(value)
677
+ end
678
+ #--------------------------------------------------------------------------
679
+ # * Change Items
680
+ #--------------------------------------------------------------------------
681
+ def command_126
682
+ value = operate_value(@params[1], @params[2], @params[3])
683
+ $game_party.gain_item($data_items[@params[0]], value)
684
+ end
685
+ #--------------------------------------------------------------------------
686
+ # * Change Weapons
687
+ #--------------------------------------------------------------------------
688
+ def command_127
689
+ value = operate_value(@params[1], @params[2], @params[3])
690
+ $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
691
+ end
692
+ #--------------------------------------------------------------------------
693
+ # * Change Armor
694
+ #--------------------------------------------------------------------------
695
+ def command_128
696
+ value = operate_value(@params[1], @params[2], @params[3])
697
+ $game_party.gain_item($data_armors[@params[0]], value, @params[4])
698
+ end
699
+ #--------------------------------------------------------------------------
700
+ # * Change Party Member
701
+ #--------------------------------------------------------------------------
702
+ def command_129
703
+ actor = $game_actors[@params[0]]
704
+ if actor
705
+ if @params[1] == 0 # Add
706
+ if @params[2] == 1 # Initialize
707
+ $game_actors[@params[0]].setup(@params[0])
708
+ end
709
+ $game_party.add_actor(@params[0])
710
+ else # Remove
711
+ $game_party.remove_actor(@params[0])
712
+ end
713
+ end
714
+ end
715
+ #--------------------------------------------------------------------------
716
+ # * Change Battle BGM
717
+ #--------------------------------------------------------------------------
718
+ def command_132
719
+ $game_system.battle_bgm = @params[0]
720
+ end
721
+ #--------------------------------------------------------------------------
722
+ # * Change Battle End ME
723
+ #--------------------------------------------------------------------------
724
+ def command_133
725
+ $game_system.battle_end_me = @params[0]
726
+ end
727
+ #--------------------------------------------------------------------------
728
+ # * Change Save Access
729
+ #--------------------------------------------------------------------------
730
+ def command_134
731
+ $game_system.save_disabled = (@params[0] == 0)
732
+ end
733
+ #--------------------------------------------------------------------------
734
+ # * Change Menu Access
735
+ #--------------------------------------------------------------------------
736
+ def command_135
737
+ $game_system.menu_disabled = (@params[0] == 0)
738
+ end
739
+ #--------------------------------------------------------------------------
740
+ # * Change Encounter Disable
741
+ #--------------------------------------------------------------------------
742
+ def command_136
743
+ $game_system.encounter_disabled = (@params[0] == 0)
744
+ $game_player.make_encounter_count
745
+ end
746
+ #--------------------------------------------------------------------------
747
+ # * Change Formation Access
748
+ #--------------------------------------------------------------------------
749
+ def command_137
750
+ $game_system.formation_disabled = (@params[0] == 0)
751
+ end
752
+ #--------------------------------------------------------------------------
753
+ # * Change Window Color
754
+ #--------------------------------------------------------------------------
755
+ def command_138
756
+ $game_system.window_tone = @params[0]
757
+ end
758
+ #--------------------------------------------------------------------------
759
+ # * Transfer Player
760
+ #--------------------------------------------------------------------------
761
+ def command_201
762
+ return if $game_party.in_battle
763
+ Fiber.yield while $game_player.transfer? || $game_message.visible
764
+ if @params[0] == 0 # Direct designation
765
+ map_id = @params[1]
766
+ x = @params[2]
767
+ y = @params[3]
768
+ else # Designation with variables
769
+ map_id = $game_variables[@params[1]]
770
+ x = $game_variables[@params[2]]
771
+ y = $game_variables[@params[3]]
772
+ end
773
+ $game_player.reserve_transfer(map_id, x, y, @params[4])
774
+ $game_temp.fade_type = @params[5]
775
+ Fiber.yield while $game_player.transfer?
776
+ end
777
+ #--------------------------------------------------------------------------
778
+ # * Set Vehicle Location
779
+ #--------------------------------------------------------------------------
780
+ def command_202
781
+ if @params[1] == 0 # Direct designation
782
+ map_id = @params[2]
783
+ x = @params[3]
784
+ y = @params[4]
785
+ else # Designation with variables
786
+ map_id = $game_variables[@params[2]]
787
+ x = $game_variables[@params[3]]
788
+ y = $game_variables[@params[4]]
789
+ end
790
+ vehicle = $game_map.vehicles[@params[0]]
791
+ vehicle.set_location(map_id, x, y) if vehicle
792
+ end
793
+ #--------------------------------------------------------------------------
794
+ # * Set Event Location
795
+ #--------------------------------------------------------------------------
796
+ def command_203
797
+ character = get_character(@params[0])
798
+ if character
799
+ if @params[1] == 0 # Direct designation
800
+ character.moveto(@params[2], @params[3])
801
+ elsif @params[1] == 1 # Designation with variables
802
+ new_x = $game_variables[@params[2]]
803
+ new_y = $game_variables[@params[3]]
804
+ character.moveto(new_x, new_y)
805
+ else # Exchange with another event
806
+ character2 = get_character(@params[2])
807
+ character.swap(character2) if character2
808
+ end
809
+ character.set_direction(@params[4]) if @params[4] > 0
810
+ end
811
+ end
812
+ #--------------------------------------------------------------------------
813
+ # * Scroll Map
814
+ #--------------------------------------------------------------------------
815
+ def command_204
816
+ return if $game_party.in_battle
817
+ Fiber.yield while $game_map.scrolling?
818
+ $game_map.start_scroll(@params[0], @params[1], @params[2])
819
+ end
820
+ #--------------------------------------------------------------------------
821
+ # * Set Move Route
822
+ #--------------------------------------------------------------------------
823
+ def command_205
824
+ $game_map.refresh if $game_map.need_refresh
825
+ character = get_character(@params[0])
826
+ if character
827
+ character.force_move_route(@params[1])
828
+ Fiber.yield while character.move_route_forcing if @params[1].wait
829
+ end
830
+ end
831
+ #--------------------------------------------------------------------------
832
+ # * Getting On and Off Vehicles
833
+ #--------------------------------------------------------------------------
834
+ def command_206
835
+ $game_player.get_on_off_vehicle
836
+ end
837
+ #--------------------------------------------------------------------------
838
+ # * Change Transparency
839
+ #--------------------------------------------------------------------------
840
+ def command_211
841
+ $game_player.transparent = (@params[0] == 0)
842
+ end
843
+ #--------------------------------------------------------------------------
844
+ # * Show Animation
845
+ #--------------------------------------------------------------------------
846
+ def command_212
847
+ character = get_character(@params[0])
848
+ if character
849
+ character.animation_id = @params[1]
850
+ Fiber.yield while character.animation_id > 0 if @params[2]
851
+ end
852
+ end
853
+ #--------------------------------------------------------------------------
854
+ # * Show Balloon Icon
855
+ #--------------------------------------------------------------------------
856
+ def command_213
857
+ character = get_character(@params[0])
858
+ if character
859
+ character.balloon_id = @params[1]
860
+ Fiber.yield while character.balloon_id > 0 if @params[2]
861
+ end
862
+ end
863
+ #--------------------------------------------------------------------------
864
+ # * Temporarily Erase Event
865
+ #--------------------------------------------------------------------------
866
+ def command_214
867
+ $game_map.events[@event_id].erase if same_map? && @event_id > 0
868
+ end
869
+ #--------------------------------------------------------------------------
870
+ # * Change Player Followers
871
+ #--------------------------------------------------------------------------
872
+ def command_216
873
+ $game_player.followers.visible = (@params[0] == 0)
874
+ $game_player.refresh
875
+ end
876
+ #--------------------------------------------------------------------------
877
+ # * Gather Followers
878
+ #--------------------------------------------------------------------------
879
+ def command_217
880
+ return if $game_party.in_battle
881
+ $game_player.followers.gather
882
+ Fiber.yield until $game_player.followers.gather?
883
+ end
884
+ #--------------------------------------------------------------------------
885
+ # * Fadeout Screen
886
+ #--------------------------------------------------------------------------
887
+ def command_221
888
+ Fiber.yield while $game_message.visible
889
+ screen.start_fadeout(30)
890
+ wait(30)
891
+ end
892
+ #--------------------------------------------------------------------------
893
+ # * Fadein Screen
894
+ #--------------------------------------------------------------------------
895
+ def command_222
896
+ Fiber.yield while $game_message.visible
897
+ screen.start_fadein(30)
898
+ wait(30)
899
+ end
900
+ #--------------------------------------------------------------------------
901
+ # * Tint Screen
902
+ #--------------------------------------------------------------------------
903
+ def command_223
904
+ screen.start_tone_change(@params[0], @params[1])
905
+ wait(@params[1]) if @params[2]
906
+ end
907
+ #--------------------------------------------------------------------------
908
+ # * Screen Flash
909
+ #--------------------------------------------------------------------------
910
+ def command_224
911
+ screen.start_flash(@params[0], @params[1])
912
+ wait(@params[1]) if @params[2]
913
+ end
914
+ #--------------------------------------------------------------------------
915
+ # * Screen Shake
916
+ #--------------------------------------------------------------------------
917
+ def command_225
918
+ screen.start_shake(@params[0], @params[1], @params[2])
919
+ wait(@params[1]) if @params[2]
920
+ end
921
+ #--------------------------------------------------------------------------
922
+ # * Wait
923
+ #--------------------------------------------------------------------------
924
+ def command_230
925
+ wait(@params[0])
926
+ end
927
+ #--------------------------------------------------------------------------
928
+ # * Show Picture
929
+ #--------------------------------------------------------------------------
930
+ def command_231
931
+ if @params[3] == 0 # Direct designation
932
+ x = @params[4]
933
+ y = @params[5]
934
+ else # Designation with variables
935
+ x = $game_variables[@params[4]]
936
+ y = $game_variables[@params[5]]
937
+ end
938
+ screen.pictures[@params[0]].show(@params[1], @params[2],
939
+ x, y, @params[6], @params[7], @params[8], @params[9])
940
+ end
941
+ #--------------------------------------------------------------------------
942
+ # * Move Picture
943
+ #--------------------------------------------------------------------------
944
+ def command_232
945
+ if @params[3] == 0 # Direct designation
946
+ x = @params[4]
947
+ y = @params[5]
948
+ else # Designation with variables
949
+ x = $game_variables[@params[4]]
950
+ y = $game_variables[@params[5]]
951
+ end
952
+ screen.pictures[@params[0]].move(@params[2], x, y, @params[6],
953
+ @params[7], @params[8], @params[9], @params[10])
954
+ wait(@params[10]) if @params[11]
955
+ end
956
+ #--------------------------------------------------------------------------
957
+ # * Rotate Picture
958
+ #--------------------------------------------------------------------------
959
+ def command_233
960
+ screen.pictures[@params[0]].rotate(@params[1])
961
+ end
962
+ #--------------------------------------------------------------------------
963
+ # * Tint Picture
964
+ #--------------------------------------------------------------------------
965
+ def command_234
966
+ screen.pictures[@params[0]].start_tone_change(@params[1], @params[2])
967
+ wait(@params[2]) if @params[3]
968
+ end
969
+ #--------------------------------------------------------------------------
970
+ # * Erase Picture
971
+ #--------------------------------------------------------------------------
972
+ def command_235
973
+ screen.pictures[@params[0]].erase
974
+ end
975
+ #--------------------------------------------------------------------------
976
+ # * Set Weather
977
+ #--------------------------------------------------------------------------
978
+ def command_236
979
+ return if $game_party.in_battle
980
+ screen.change_weather(@params[0], @params[1], @params[2])
981
+ wait(@params[2]) if @params[3]
982
+ end
983
+ #--------------------------------------------------------------------------
984
+ # * Play BGM
985
+ #--------------------------------------------------------------------------
986
+ def command_241
987
+ @params[0].play
988
+ end
989
+ #--------------------------------------------------------------------------
990
+ # * Fadeout BGM
991
+ #--------------------------------------------------------------------------
992
+ def command_242
993
+ RPG::BGM.fade(@params[0] * 1000)
994
+ end
995
+ #--------------------------------------------------------------------------
996
+ # * Save BGM
997
+ #--------------------------------------------------------------------------
998
+ def command_243
999
+ $game_system.save_bgm
1000
+ end
1001
+ #--------------------------------------------------------------------------
1002
+ # * Resume BGM
1003
+ #--------------------------------------------------------------------------
1004
+ def command_244
1005
+ $game_system.replay_bgm
1006
+ end
1007
+ #--------------------------------------------------------------------------
1008
+ # * Play BGS
1009
+ #--------------------------------------------------------------------------
1010
+ def command_245
1011
+ @params[0].play
1012
+ end
1013
+ #--------------------------------------------------------------------------
1014
+ # * Fadeout BGS
1015
+ #--------------------------------------------------------------------------
1016
+ def command_246
1017
+ RPG::BGS.fade(@params[0] * 1000)
1018
+ end
1019
+ #--------------------------------------------------------------------------
1020
+ # * Play ME
1021
+ #--------------------------------------------------------------------------
1022
+ def command_249
1023
+ @params[0].play
1024
+ end
1025
+ #--------------------------------------------------------------------------
1026
+ # * Play SE
1027
+ #--------------------------------------------------------------------------
1028
+ def command_250
1029
+ @params[0].play
1030
+ end
1031
+ #--------------------------------------------------------------------------
1032
+ # * Stop SE
1033
+ #--------------------------------------------------------------------------
1034
+ def command_251
1035
+ RPG::SE.stop
1036
+ end
1037
+ #--------------------------------------------------------------------------
1038
+ # * Play Movie
1039
+ #--------------------------------------------------------------------------
1040
+ def command_261
1041
+ Fiber.yield while $game_message.visible
1042
+ Fiber.yield
1043
+ name = @params[0]
1044
+ Graphics.play_movie('Movies/' + name) unless name.empty?
1045
+ end
1046
+ #--------------------------------------------------------------------------
1047
+ # * Change Map Name Display
1048
+ #--------------------------------------------------------------------------
1049
+ def command_281
1050
+ $game_map.name_display = (@params[0] == 0)
1051
+ end
1052
+ #--------------------------------------------------------------------------
1053
+ # * Change Tileset
1054
+ #--------------------------------------------------------------------------
1055
+ def command_282
1056
+ $game_map.change_tileset(@params[0])
1057
+ end
1058
+ #--------------------------------------------------------------------------
1059
+ # * Change Battle Background
1060
+ #--------------------------------------------------------------------------
1061
+ def command_283
1062
+ $game_map.change_battleback(@params[0], @params[1])
1063
+ end
1064
+ #--------------------------------------------------------------------------
1065
+ # * Change Parallax Background
1066
+ #--------------------------------------------------------------------------
1067
+ def command_284
1068
+ $game_map.change_parallax(@params[0], @params[1], @params[2],
1069
+ @params[3], @params[4])
1070
+ end
1071
+ #--------------------------------------------------------------------------
1072
+ # * Get Location Info
1073
+ #--------------------------------------------------------------------------
1074
+ def command_285
1075
+ if @params[2] == 0 # Direct designation
1076
+ x = @params[3]
1077
+ y = @params[4]
1078
+ else # Designation with variables
1079
+ x = $game_variables[@params[3]]
1080
+ y = $game_variables[@params[4]]
1081
+ end
1082
+ case @params[1]
1083
+ when 0 # Terrain Tag
1084
+ value = $game_map.terrain_tag(x, y)
1085
+ when 1 # Event ID
1086
+ value = $game_map.event_id_xy(x, y)
1087
+ when 2..4 # Tile ID
1088
+ value = $game_map.tile_id(x, y, @params[1] - 2)
1089
+ else # Region ID
1090
+ value = $game_map.region_id(x, y)
1091
+ end
1092
+ $game_variables[@params[0]] = value
1093
+ end
1094
+ #--------------------------------------------------------------------------
1095
+ # * Battle Processing
1096
+ #--------------------------------------------------------------------------
1097
+ def command_301
1098
+ return if $game_party.in_battle
1099
+ if @params[0] == 0 # Direct designation
1100
+ troop_id = @params[1]
1101
+ elsif @params[0] == 1 # Designation with variables
1102
+ troop_id = $game_variables[@params[1]]
1103
+ else # Map-designated troop
1104
+ troop_id = $game_player.make_encounter_troop_id
1105
+ end
1106
+ if $data_troops[troop_id]
1107
+ BattleManager.setup(troop_id, @params[2], @params[3])
1108
+ BattleManager.event_proc = Proc.new {|n| @branch[@indent] = n }
1109
+ $game_player.make_encounter_count
1110
+ SceneManager.call(Scene_Battle)
1111
+ end
1112
+ Fiber.yield
1113
+ end
1114
+ #--------------------------------------------------------------------------
1115
+ # * If Win
1116
+ #--------------------------------------------------------------------------
1117
+ def command_601
1118
+ command_skip if @branch[@indent] != 0
1119
+ end
1120
+ #--------------------------------------------------------------------------
1121
+ # * If Escape
1122
+ #--------------------------------------------------------------------------
1123
+ def command_602
1124
+ command_skip if @branch[@indent] != 1
1125
+ end
1126
+ #--------------------------------------------------------------------------
1127
+ # * If Lose
1128
+ #--------------------------------------------------------------------------
1129
+ def command_603
1130
+ command_skip if @branch[@indent] != 2
1131
+ end
1132
+ #--------------------------------------------------------------------------
1133
+ # * Shop Processing
1134
+ #--------------------------------------------------------------------------
1135
+ def command_302
1136
+ return if $game_party.in_battle
1137
+ goods = [@params]
1138
+ while next_event_code == 605
1139
+ @index += 1
1140
+ goods.push(@list[@index].parameters)
1141
+ end
1142
+ SceneManager.call(Scene_Shop)
1143
+ SceneManager.scene.prepare(goods, @params[4])
1144
+ Fiber.yield
1145
+ end
1146
+ #--------------------------------------------------------------------------
1147
+ # * Name Input Processing
1148
+ #--------------------------------------------------------------------------
1149
+ def command_303
1150
+ return if $game_party.in_battle
1151
+ if $data_actors[@params[0]]
1152
+ SceneManager.call(Scene_Name)
1153
+ SceneManager.scene.prepare(@params[0], @params[1])
1154
+ Fiber.yield
1155
+ end
1156
+ end
1157
+ #--------------------------------------------------------------------------
1158
+ # * Change HP
1159
+ #--------------------------------------------------------------------------
1160
+ def command_311
1161
+ value = operate_value(@params[2], @params[3], @params[4])
1162
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1163
+ next if actor.dead?
1164
+ actor.change_hp(value, @params[5])
1165
+ actor.perform_collapse_effect if actor.dead?
1166
+ end
1167
+ SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
1168
+ end
1169
+ #--------------------------------------------------------------------------
1170
+ # * Change MP
1171
+ #--------------------------------------------------------------------------
1172
+ def command_312
1173
+ value = operate_value(@params[2], @params[3], @params[4])
1174
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1175
+ actor.mp += value
1176
+ end
1177
+ end
1178
+ #--------------------------------------------------------------------------
1179
+ # * Change State
1180
+ #--------------------------------------------------------------------------
1181
+ def command_313
1182
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1183
+ already_dead = actor.dead?
1184
+ if @params[2] == 0
1185
+ actor.add_state(@params[3])
1186
+ else
1187
+ actor.remove_state(@params[3])
1188
+ end
1189
+ actor.perform_collapse_effect if actor.dead? && !already_dead
1190
+ end
1191
+ $game_party.clear_results
1192
+ end
1193
+ #--------------------------------------------------------------------------
1194
+ # * Recover All
1195
+ #--------------------------------------------------------------------------
1196
+ def command_314
1197
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1198
+ actor.recover_all
1199
+ end
1200
+ end
1201
+ #--------------------------------------------------------------------------
1202
+ # * Change EXP
1203
+ #--------------------------------------------------------------------------
1204
+ def command_315
1205
+ value = operate_value(@params[2], @params[3], @params[4])
1206
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1207
+ actor.change_exp(actor.exp + value, @params[5])
1208
+ end
1209
+ end
1210
+ #--------------------------------------------------------------------------
1211
+ # * Change Level
1212
+ #--------------------------------------------------------------------------
1213
+ def command_316
1214
+ value = operate_value(@params[2], @params[3], @params[4])
1215
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1216
+ actor.change_level(actor.level + value, @params[5])
1217
+ end
1218
+ end
1219
+ #--------------------------------------------------------------------------
1220
+ # * Change Parameters
1221
+ #--------------------------------------------------------------------------
1222
+ def command_317
1223
+ value = operate_value(@params[3], @params[4], @params[5])
1224
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1225
+ actor.add_param(@params[2], value)
1226
+ end
1227
+ end
1228
+ #--------------------------------------------------------------------------
1229
+ # * Change Skills
1230
+ #--------------------------------------------------------------------------
1231
+ def command_318
1232
+ iterate_actor_var(@params[0], @params[1]) do |actor|
1233
+ if @params[2] == 0
1234
+ actor.learn_skill(@params[3])
1235
+ else
1236
+ actor.forget_skill(@params[3])
1237
+ end
1238
+ end
1239
+ end
1240
+ #--------------------------------------------------------------------------
1241
+ # * Change Equipment
1242
+ #--------------------------------------------------------------------------
1243
+ def command_319
1244
+ actor = $game_actors[@params[0]]
1245
+ actor.change_equip_by_id(@params[1], @params[2]) if actor
1246
+ end
1247
+ #--------------------------------------------------------------------------
1248
+ # * Change Name
1249
+ #--------------------------------------------------------------------------
1250
+ def command_320
1251
+ actor = $game_actors[@params[0]]
1252
+ actor.name = @params[1] if actor
1253
+ end
1254
+ #--------------------------------------------------------------------------
1255
+ # * Change Class
1256
+ #--------------------------------------------------------------------------
1257
+ def command_321
1258
+ actor = $game_actors[@params[0]]
1259
+ actor.change_class(@params[1]) if actor && $data_classes[@params[1]]
1260
+ end
1261
+ #--------------------------------------------------------------------------
1262
+ # * Change Actor Graphic
1263
+ #--------------------------------------------------------------------------
1264
+ def command_322
1265
+ actor = $game_actors[@params[0]]
1266
+ if actor
1267
+ actor.set_graphic(@params[1], @params[2], @params[3], @params[4])
1268
+ end
1269
+ $game_player.refresh
1270
+ end
1271
+ #--------------------------------------------------------------------------
1272
+ # * Change Vehicle Graphic
1273
+ #--------------------------------------------------------------------------
1274
+ def command_323
1275
+ vehicle = $game_map.vehicles[@params[0]]
1276
+ vehicle.set_graphic(@params[1], @params[2]) if vehicle
1277
+ end
1278
+ #--------------------------------------------------------------------------
1279
+ # * Change Nickname
1280
+ #--------------------------------------------------------------------------
1281
+ def command_324
1282
+ actor = $game_actors[@params[0]]
1283
+ actor.nickname = @params[1] if actor
1284
+ end
1285
+ #--------------------------------------------------------------------------
1286
+ # * Change Enemy HP
1287
+ #--------------------------------------------------------------------------
1288
+ def command_331
1289
+ value = operate_value(@params[1], @params[2], @params[3])
1290
+ iterate_enemy_index(@params[0]) do |enemy|
1291
+ return if enemy.dead?
1292
+ enemy.change_hp(value, @params[4])
1293
+ enemy.perform_collapse_effect if enemy.dead?
1294
+ end
1295
+ end
1296
+ #--------------------------------------------------------------------------
1297
+ # * Change Enemy MP
1298
+ #--------------------------------------------------------------------------
1299
+ def command_332
1300
+ value = operate_value(@params[1], @params[2], @params[3])
1301
+ iterate_enemy_index(@params[0]) do |enemy|
1302
+ enemy.mp += value
1303
+ end
1304
+ end
1305
+ #--------------------------------------------------------------------------
1306
+ # * Change Enemy State
1307
+ #--------------------------------------------------------------------------
1308
+ def command_333
1309
+ iterate_enemy_index(@params[0]) do |enemy|
1310
+ already_dead = enemy.dead?
1311
+ if @params[1] == 0
1312
+ enemy.add_state(@params[2])
1313
+ else
1314
+ enemy.remove_state(@params[2])
1315
+ end
1316
+ enemy.perform_collapse_effect if enemy.dead? && !already_dead
1317
+ end
1318
+ end
1319
+ #--------------------------------------------------------------------------
1320
+ # * Enemy Recover All
1321
+ #--------------------------------------------------------------------------
1322
+ def command_334
1323
+ iterate_enemy_index(@params[0]) do |enemy|
1324
+ enemy.recover_all
1325
+ end
1326
+ end
1327
+ #--------------------------------------------------------------------------
1328
+ # * Enemy Appear
1329
+ #--------------------------------------------------------------------------
1330
+ def command_335
1331
+ iterate_enemy_index(@params[0]) do |enemy|
1332
+ enemy.appear
1333
+ $game_troop.make_unique_names
1334
+ end
1335
+ end
1336
+ #--------------------------------------------------------------------------
1337
+ # * Enemy Transform
1338
+ #--------------------------------------------------------------------------
1339
+ def command_336
1340
+ iterate_enemy_index(@params[0]) do |enemy|
1341
+ enemy.transform(@params[1])
1342
+ $game_troop.make_unique_names
1343
+ end
1344
+ end
1345
+ #--------------------------------------------------------------------------
1346
+ # * Show Battle Animation
1347
+ #--------------------------------------------------------------------------
1348
+ def command_337
1349
+ iterate_enemy_index(@params[0]) do |enemy|
1350
+ enemy.animation_id = @params[1] if enemy.alive?
1351
+ end
1352
+ end
1353
+ #--------------------------------------------------------------------------
1354
+ # * Force Action
1355
+ #--------------------------------------------------------------------------
1356
+ def command_339
1357
+ iterate_battler(@params[0], @params[1]) do |battler|
1358
+ next if battler.death_state?
1359
+ battler.force_action(@params[2], @params[3])
1360
+ BattleManager.force_action(battler)
1361
+ Fiber.yield while BattleManager.action_forced?
1362
+ end
1363
+ end
1364
+ #--------------------------------------------------------------------------
1365
+ # * Abort Battle
1366
+ #--------------------------------------------------------------------------
1367
+ def command_340
1368
+ BattleManager.abort
1369
+ Fiber.yield
1370
+ end
1371
+ #--------------------------------------------------------------------------
1372
+ # * Open Menu Screen
1373
+ #--------------------------------------------------------------------------
1374
+ def command_351
1375
+ return if $game_party.in_battle
1376
+ SceneManager.call(Scene_Menu)
1377
+ Window_MenuCommand::init_command_position
1378
+ Fiber.yield
1379
+ end
1380
+ #--------------------------------------------------------------------------
1381
+ # * Open Save Screen
1382
+ #--------------------------------------------------------------------------
1383
+ def command_352
1384
+ return if $game_party.in_battle
1385
+ SceneManager.call(Scene_Save)
1386
+ Fiber.yield
1387
+ end
1388
+ #--------------------------------------------------------------------------
1389
+ # * Game Over
1390
+ #--------------------------------------------------------------------------
1391
+ def command_353
1392
+ SceneManager.goto(Scene_Gameover)
1393
+ Fiber.yield
1394
+ end
1395
+ #--------------------------------------------------------------------------
1396
+ # * Return to Title Screen
1397
+ #--------------------------------------------------------------------------
1398
+ def command_354
1399
+ SceneManager.goto(Scene_Title)
1400
+ Fiber.yield
1401
+ end
1402
+ #--------------------------------------------------------------------------
1403
+ # * Script
1404
+ #--------------------------------------------------------------------------
1405
+ def command_355
1406
+ script = @list[@index].parameters[0] + "\n"
1407
+ while next_event_code == 655
1408
+ @index += 1
1409
+ script += @list[@index].parameters[0] + "\n"
1410
+ end
1411
+ eval(script)
1412
+ end
1413
+ end