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.

Different character death noises

It's hard to believe... but I've got a question.
Can I make it so that each different character in my game has a different death/hurt sound effect? Like, can I do that with a simple script command, or is this harder to do?
Also I had another question but I can't remember what it was... :tongue:
 
I found it easy to believe. (none of us knows everything) :scruff:

This allows custom death noises.

In the database, under system, set "Actor Collapse SE" to "none"
(this is optional, it will work with both sounds)

Paste the following script above main

Code:
class Sprite_Battler
  def collapse
    super
    if @battler.is_a?(Game_Actor)
      sound = "Audio\\SE\\"
      sound.concat(@battler.name)
      sound.concat(".mp3")
      if FileTest.exist?(sound)
        Audio.se_play(sound)
      end
    end
  end
end

In line 7, change .mp3 to match the type of sound file you want to use.

In your Audio\SE\ folder, add a custom sound for each actor using the actors name.
(i.e.  Aluxes.ogg  or  Hilda.mp3)

Be Well
 
All right, awesome! Thanks, dude.
I'll start making death noises now...

wait... just their name? Could I make it so that it's "Name_death"? How would I do that? It's not important, but it's preferable.

Also one last thing. If I have the actor collapse sound on, will it play once the actor death sound is over? If not, how would I set that up?
 
Try editing line 7 to
sound.concat("_death.mp3")

Of course, I'm no RGSS expert so you might want a scripter to confirm/modify the code.

Not sure about the actor collapse, but I think both sounds would play at the same time.
 
The collapse method gets called AFTER the default collapse sound plays.
So, they will either play simultaneously, or in the opposite order you would like.
I'll see if I can switch the order. (later. gotta go cook steaks now. :scruff:)

[ edit ]

It looks like the play simultaneously.
I'm reluctant to put any kind of 'wait' command in the script, as it will
probably mess things up.
Your best bet is modifying the sound so it has a short delay at the beginning.

Here's a modified version of the default Actor Collapse sound...

http://www.box.net/shared/q8z0ng09v7

Be Well
 
I'm using the sound called 054-Cannon03 at about full tempo (.5 point off), actually. But, thanks for the idea, I'll try that, see if I like it, maybe exclude the sound or replace it...
 

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