Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Issue with VX Title Screen Sound Effects by SephirothSpawn

I get this error when I don't edit the script to play a sound when you choose, New game:

Script 'Vocab' line 213: NoMethodError occurred.
undefined method 'terms' for nil:NilClass

I get this error when I edit the script to play a sound when you choose the option, New Game:

Script 'VX Title Screen Sound Effects' line 14: SyntaxError occurred.

Here is the original script.
Code:
#==============================================================================
# ** VX Title Screen Sound Effects
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-09-19
#==============================================================================

module Sound
  Title_Screen_SE = {}
  Title_Screen_SE[Vocab::new_game] = [
    # [filename, volume, pitch]
  ]
  Title_Screen_SE[Vocab::continue] = [
    # [filename, volume, pitch]
  ]
  Title_Screen_SE[Vocab::shutdown] = [
    # [filename, volume, pitch]
  ]
  def self.play_title_scene_se(command)
    array = Title_Screen_SE[command]
    item = array[rand(array.size)]
    Audio.se_play(*item) 
  end
end

class Scene_Title
  alias_method :seph_scnttlse_scnttl_ccw, :create_command_window
  alias_method :seph_scnttlse_scnttl_update, :update
  def create_command_window
    seph_scnttlse_scnttl_ccw
    @last_index = @command_window.index
  end
  def update
    seph_scnttlse_scnttl_update
    if @last_index != @command_window.index
      @last_index = @command_window.index
      c = @command_window.commands[@command_window.index]
      Audio.play_title_scene_se(c)
    end
  end
end

Here is the script, modified to play the sounds I want.
Code:
#==============================================================================
# ** VX Title Screen Sound Effects
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-09-19
#==============================================================================

module Sound
  Title_Screen_SE = {}
  Title_Screen_SE[Vocab::new_game] = [
    # [filename, volume, pitch]
    ['areyouafraid', 100, 100]
    ['Let us begin', 100, 100]
    ['thisworld', 100, 100]
  ]
  Title_Screen_SE[Vocab::continue] = [
    # [filename, volume, pitch]
  ]
  Title_Screen_SE[Vocab::shutdown] = [
    # [filename, volume, pitch]
  ]
  def self.play_title_scene_se(command)
    array = Title_Screen_SE[command]
    item = array[rand(array.size)]
    Audio.se_play(*item) 
  end
end

class Scene_Title
  alias_method :seph_scnttlse_scnttl_ccw, :create_command_window
  alias_method :seph_scnttlse_scnttl_update, :update
  def create_command_window
    seph_scnttlse_scnttl_ccw
    @last_index = @command_window.index
  end
  def update
    seph_scnttlse_scnttl_update
    if @last_index != @command_window.index
      @last_index = @command_window.index
      c = @command_window.commands[@command_window.index]
      Audio.play_title_scene_se(c)
    end
  end
end

Here is a list of my scripts that deal with sound:

VX Title Screen Sound Effects -SephirothSpawn
SG Start of Turn Sound          -sandgolem
[RMVX] Lomexi's Battle Theme Adjuster -Lomexi
Fade Battle End ME                -Kylock

It might be a compatibility issue. Can anyone help?
 
It's because the Vocab module uses the System data and this data isn't loaded.

Add this line of code right under module Sound.
Code:
$data_system = load_data("Data/System.rvdata")

Take care!
-Dargor
 
I tried to put that code under the module sound in SephirothSpawns' script and then The SOund script. Neither worked. What resulted was this:

Script 'VX Title Screen Sound Effects' line 15: SyntaxError occurred.

I put it here in his script:

Code:
#==============================================================================
# ** VX Title Screen Sound Effects
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-09-19
#==============================================================================

module Sound
  $data_system = load_data("Data/System.rvdata")
  Title_Screen_SE = {}
  Title_Screen_SE[Vocab::new_game] = [
    # [filename, volume, pitch]
    ['areyouafraid', 100, 100]
    ['Let us begin', 100, 100]
    ['thisworld', 100, 100]
  ]
  Title_Screen_SE[Vocab::continue] = [
    # [filename, volume, pitch]

I appreciate your effort and I thank you for it.
 
-_-'

Are you serious!? THAT was it? God, I'm so stupid...

Thank you very much for your patience Dargor.

Oh, wait! A new problem!

I'll put it up in a second!

Script 'VX Title Screen Sound Effects' line 43: NoMethodError
undefined method 'play_title_scene_se' for Audio: Module
 
Sorry. Change:
      Audio.play_title_scene_se(c)
to

      Sound.play_title_scene_se(c)


Offtopic: I really don't see the point of creating the terms thing in the database, then having a vocab module. I guess different VX language packs have different vocab settings and the terms let's people control whatever. I still don't see the point. Enterbrain should have made it so they can modify all vocab terms in the database and had it read/modify the vocab module instead of creating a data structure for terms.
 
It's almost done! There is only one more problem. Whenever I test play the game, it says it can't find the file I specified.

Project1 cannot find file areyouafraid

Whether the file comes with the program itself does not matter.

Thank you very much for your efforts.
 
SephirothSpawn":39wm5xmi said:
Offtopic: I really don't see the point of creating the terms thing in the database, then having a vocab module. I guess different VX language packs have different vocab settings and the terms let's people control whatever. I still don't see the point. Enterbrain should have made it so they can modify all vocab terms in the database and had it read/modify the vocab module instead of creating a data structure for terms.

I cannot agree more. Also, I haven't tried your script Seph but I'm not sure if your play_title_scene_se method would work in VX. There's a difference with XP and I've never had good results with Audio.se_play in VX.
I usually use
Code:
se = RPG::SE.new(name, voulme, pitch)
se.play
To play an SE. But I can be wrong.
 
Yeah, I haven't really tested this out. I do like what they did to make sound files play automatically (I actually added this to the MACL so it works in XP, in theory, by checking filenames). But the play method in the RPG::SE still just re-directs to the se_play method in the audiomodule. The difference is you aren't creating an object and wasting a memory.

And they should have used the Struct class for the data structure, if they didn't.

Code:
RPG::Map = Struct.new(:tileset_id, :width, :height, :autoplay_bgm, :bgm, :autoplay_bgs, :bgs, :encounter_list, :encounter_step, :data, :events)

I have never seen anyone use this (don't know if you've seen this), but that right there is a lot shorter than:
Code:
class RPG::Map
    attr_accessor :tileset_id
    attr_accessor :width
    attr_accessor :height
    attr_accessor :autoplay_bgm
    attr_accessor :bgm
    attr_accessor :autoplay_bgs
    attr_accessor :bgs
    attr_accessor :encounter_list
    attr_accessor :encounter_step
    attr_accessor :data
    attr_accessor :events
end
 
I just found it a month ago myself. I find it very useful for data-structure objects. And you can add methods to a Struct object, so no worries there:
Code:
Game_Map = Struct.new(:width, :height)
class Game_Map
  def say_hi
    p width, height
  end
end

$game_map = Game_Map.new(20, 15)
$game_map.say_hi # -> 20, 15
 
-_-' I am sorry.

For some reason, It still cannot find the file I put. If you wanna give up on it, go ahead. It's driving me crazy! All this just to play a sound at the beginning of a new game!
 
Ok, I will. It's HUGE though. I got to get rid of the songs that are not mine...(RMVX- Game creation device and also a music player! XD It's about 125+ MB I'll edit this post with the file once I'm done....
 
Code:
#==============================================================================
# ** VX Title Screen Sound Effects
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.1
# 2008-09-23
#==============================================================================

module Sound
  $data_system = load_data("Data/System.rvdata")
  Title_Screen_SE = {}
  Title_Screen_SE[Vocab::new_game] = [
    # [filename, volume, pitch]
    ['Audio/SE/Equip', 100, 100],
    ['Audio/SE/Save', 100, 100],
#    ['Audio/SE/Let us begin', 100, 100],
#    ['Audio/SE/thisworld', 100, 100]
  ]
  Title_Screen_SE[Vocab::continue] = [
    # [filename, volume, pitch]
    ['Audio/SE/Equip', 100, 100],
    ['Audio/SE/Save', 100, 100],
  ]
  Title_Screen_SE[Vocab::shutdown] = [
    # [filename, volume, pitch]
    ['Audio/SE/Equip', 100, 100],
    ['Audio/SE/Save', 100, 100],
  ]
  def self.play_title_scene_se(command)
    array = Title_Screen_SE[command]
    if array.size > 0
      item = array[rand(array.size)]
      Audio.se_play(*item)
    end
  end
end

class Scene_Title
  alias_method :seph_scnttlse_scnttl_ccw, :create_command_window
  alias_method :seph_scnttlse_scnttl_update, :update
  def create_command_window
    seph_scnttlse_scnttl_ccw
    @last_index = @command_window.index
  end
  def update
    seph_scnttlse_scnttl_update
    if @last_index != @command_window.index
      @last_index = @command_window.index
      c = @command_window.commands[@command_window.index]
      Sound.play_title_scene_se(c)
    end
  end
end

You probably aren't including the path in your filenames (I could be wrong).

['Audio/SE/Equip', 100, 100],

Make sure you put a comma after each of them too.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top