Class: Game_System

Inherits:
Object show all
Defined in:
scripts/00600 Script_RMXP/02100 Game_System.rb

Overview

Class that manage Music playing, save and menu access, timer and interpreter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGame_System

Default initializer



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 17

def initialize
  @map_interpreter = Interpreter.new(0, true)
  @battle_interpreter = Interpreter.new(0, false)
  @timer = 0
  @timer_working = false
  @save_disabled = false
  @menu_disabled = false
  @encounter_disabled = false
  @message_position = 2
  @message_frame = 0
  @save_count = 0
  @magic_number = 0
end

Instance Attribute Details

#battle_interpreter (readonly)

バトルイベント用インタプリタ



6
7
8
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 6

def battle_interpreter
  @battle_interpreter
end

#encounter_disabled

エンカウント禁止



11
12
13
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 11

def encounter_disabled
  @encounter_disabled
end

#magic_number

マジックナンバー



15
16
17
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 15

def magic_number
  @magic_number
end

#map_interpreter (readonly)

マップイベント用インタプリタ



5
6
7
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 5

def map_interpreter
  @map_interpreter
end

メニュー禁止



10
11
12
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 10

def menu_disabled
  @menu_disabled
end

#message_frame

文章オプション ウィンドウ枠



13
14
15
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 13

def message_frame
  @message_frame
end

#message_position

文章オプション 表示位置



12
13
14
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 12

def message_position
  @message_position
end

#save_count

セーブ回数



14
15
16
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 14

def save_count
  @save_count
end

#save_disabled

セーブ禁止



9
10
11
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 9

def save_disabled
  @save_disabled
end

#timer

タイマー



7
8
9
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 7

def timer
  @timer
end

#timer_working

タイマー作動中フラグ



8
9
10
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 8

def timer_working
  @timer_working
end

Instance Method Details

#battle_bgmRPG::AudioFile

Returns the battle BGM descriptor

Returns:



146
147
148
149
150
151
152
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 146

def battle_bgm
  if @battle_bgm == nil
    return $data_system.battle_bgm
  else
    return @battle_bgm
  end
end

#battle_bgm=(battle_bgm)

Sets the battle BGM descriptor

Parameters:



155
156
157
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 155

def battle_bgm=(battle_bgm)
  @battle_bgm = battle_bgm
end

#battle_end_meRPG::AudioFile

Returns the battle end ME descriptor

Returns:



160
161
162
163
164
165
166
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 160

def battle_end_me
  if @battle_end_me == nil
    return $data_system.battle_end_me
  else
    return @battle_end_me
  end
end

#battle_end_me=(battle_end_me)

Sets the battle end ME descriptor

Parameters:



169
170
171
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 169

def battle_end_me=(battle_end_me)
  @battle_end_me = battle_end_me
end

#bgm_fade(time)

Fade the BGM out

Parameters:

  • time (Integer)

    the time in seconds it takes to the BGM to fade



52
53
54
55
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 52

def bgm_fade(time)
  @playing_bgm = nil
  Audio.bgm_fade(time * 1000)
end

#bgm_memorize

Memorize the BGM



57
58
59
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 57

def bgm_memorize
  @memorized_bgm = @playing_bgm
end

#bgm_memorize2

Memorize an other BGM with position

Author:

  • Nuri Yuri



66
67
68
69
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 66

def bgm_memorize2
  @bgm_position = Audio.bgm_position
  @memorized_bgm2 = @playing_bgm
end

#bgm_play(bgm)

Plays a BGM

Parameters:



37
38
39
40
41
42
43
44
45
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 37

def bgm_play(bgm)
  @playing_bgm = bgm
  if bgm and !bgm.name.empty?
    Audio.bgm_play(_utf8("Audio/BGM/" + bgm.name), bgm.volume, bgm.pitch)
  else
    Audio.bgm_stop
  end
  Graphics.frame_reset
end

#bgm_restore

Plays the Memorized BGM



61
62
63
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 61

def bgm_restore
  bgm_play(@memorized_bgm)
end

#bgm_restore2

Plays the other Memorized BGM at the right position (FmodEx Eclusive)

Author:

  • Nuri Yuri



72
73
74
75
76
77
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 72

def bgm_restore2
  bgm_play(@memorized_bgm2)
  if @bgm_position
    Audio.bgm_position = @bgm_position
  end
end

#bgm_stop

Stop the BGM



47
48
49
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 47

def bgm_stop
  Audio.bgm_stop
end

#bgs_fade(time)

Fade the BGS out

Parameters:

  • time (Integer)

    the time in seconds it takes to the BGS to fade



91
92
93
94
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 91

def bgs_fade(time)
  @playing_bgs = nil
  Audio.bgs_fade(time * 1000)
end

#bgs_memorize

Memorize the BGS



96
97
98
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 96

def bgs_memorize
  @memorized_bgs = @playing_bgs
end

#bgs_play(bgs)

Plays a BGS

Parameters:



80
81
82
83
84
85
86
87
88
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 80

def bgs_play(bgs)
  @playing_bgs = bgs
  if bgs and !bgs.name.empty?
    Audio.bgs_play(_utf8("Audio/BGS/" + bgs.name), bgs.volume, bgs.pitch)
  else
    Audio.bgs_stop
  end
  Graphics.frame_reset
end

#bgs_restore

Play the memorized BGS



100
101
102
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 100

def bgs_restore
  bgs_play(@memorized_bgs)
end

#cry_play(id)

play the cry of a Pokémon

Parameters:

  • id (Integer)

    the id of the Pokémon in the database



32
33
34
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 32

def cry_play(id)
  Audio.cry_play(sprintf("Audio/SE/Cries/%03dCry", id.to_i))
end

#me_play(me)

Plays a ME

Parameters:



105
106
107
108
109
110
111
112
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 105

def me_play(me)
  if me and !me.name.empty?
    Audio.me_play(_utf8("Audio/ME/" + me.name), me.volume, me.pitch)
  else
    Audio.me_stop
  end
  Graphics.frame_reset
end

#playing_bgmRPG::AudioFile

Returns the playing BGM descriptor

Returns:



126
127
128
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 126

def playing_bgm
  return @playing_bgm
end

#playing_bgsRPG::AudioFile

Returns the playing BGS descriptor

Returns:



131
132
133
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 131

def playing_bgs
  return @playing_bgs
end

#se_play(se)

Plays a SE

Parameters:



115
116
117
118
119
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 115

def se_play(se)
  if se and !se.name.empty?
    Audio.se_play(_utf8("Audio/SE/" + se.name), se.volume, se.pitch)
  end
end

#se_stop

Stops every SE



121
122
123
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 121

def se_stop
  Audio.se_stop
end

#update

Updates the Game System (timer)



173
174
175
176
177
178
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 173

def update
  # タイマーを 1 減らす
  if @timer_working and @timer > 0
    @timer -= 1
  end
end

#windowskin_nameString

Returns the name of the window skin

Returns:

  • (String)

    The name of the window skin



136
137
138
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 136

def windowskin_name
  return @windowskin_name || 'message'
end

#windowskin_name=(windowskin_name)

Sets the name of the window skin

Parameters:

  • windowskin_name (String)

    The name of the window skin



141
142
143
# File 'scripts/00600 Script_RMXP/02100 Game_System.rb', line 141

def windowskin_name=(windowskin_name)
  @windowskin_name = windowskin_name
end