New account registration is temporarily disabled.

[RMVX ACE] MULTIPLE SOUNDS FOR ENEMY DAMAGE

Posts

Pages: 1
I have a sharp metallic sound which is suitable for physical attacks but unsuitable for magic attacks.
So I found another sound for the magic attacks but I can't use multiple sounds for Enemy Damage...
Does anyone know how to use multiple sounds for Enemy Damage?
This might work...
class Game_Actor < Game_Battler
  def perform_damage_effect2
    # The order is ('NAME', Volume [0, 100], Pitch [-100, 100])
    Audio.se_play('Audio/SE/NameOfFileHere', 80, 0)
  end
end

class Game_Actor < Game_Battler
  def perform_damage_effect2
    # The order is ('NAME', Volume [0, 100], Pitch [-100, 100])
    Audio.se_play('Audio/SE/NameOfFileHere', 80, 0)
  end
end

class Window_BattleLog < Window_Selectable
  def display_hp_damage(target, item)
    return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
    if target.result.hp_damage > 0 && target.result.hp_drain == 0
      if item.physical?
        target.perform_damage_effect
      elsif item.magical?
        target.perform_damage_effect2
      end
    end
    Sound.play_recovery if target.result.hp_damage < 0
    add_text(target.result.hp_damage_text)
    wait
  end
end
Thanks for your help.
I prepared for a new project and tried your script with it.
It didn't make any errors but didn't make any sounds,either...
I don't think I pasted the script on wrong places because no error occurred.
Please let me know if you have other ideas.
Did you specify the name of the audio file (and placed it in the SE folder of your game)?
Audio.se_play('Audio/SE/NameOfFileHere', 80, 0) #<= Here?
The script just checks if the attack is physical or magical. If it's physical, it should play the default damage SE (as specified in the database). If it's magical, it should play the SE you specified within it.

If that's not it, then maybe my if statement's borked up..
Corfaisus
"It's frustrating because - as much as Corf is otherwise an irredeemable person - his 2k/3 mapping is on point." ~ psy_wombats
7874
You could always use skills for enemy attacks instead of the default attack command and in the battle animation that the enemy attack would use, include a specific sound effect.
author=karins_soulkeeper
Did you specify the name of the audio file (and placed it in the SE folder of your game)?


Yes,I did.
And I tried with many different files and projects but couldn't solve the problem...
But I really appreciate your help!

author=Corfaisus
You could always use skills for enemy attacks instead of the default attack command and in the battle animation that the enemy attack would use, include a specific sound effect.


Thank you for giving me the advice.
But I want to fix the sounds of hitting enemies,not the sounds of swinging swords or throwing spears.
I appreciate your suggestion,though.
Please let me know if you have other ideas.
I've figured out a way to do it, but it might not be a very practical method.

You would need to go into scripts: Modules: Sound and then go to line 65-68 and make the following change in line 67 from this:
# Enemy Damage
  def self.play_enemy_damage
    play_system_sound(10)
  end

to this
# Enemy Damage
  def self.play_enemy_damage
    play_system_sound($game_variables[1])
  end


Now the sound made when an enemy takes damage will correspond to variable one. That would be the sounds in the database system tab starting in the top left and going down each row (cursor counts as slot zero). (i.e. variable 1 = 0 then enemy damage will use default cursor sound, variable 1 = 5 then enemy damage will use default save sound). You would need to change the variable before every attack to which sound you wanted to use via a common event (which you could simply add to the effects of a given move). However, in order to get the common event to run before the move connects, you would need to use this script. You would also need to forfeit a system sound to use as your second enemy damage sound.

Like I said, this isn't a very elegant method. karins_soulkeeper's method is probably better, but if you absolutely can't get that to work, you could try mine.
What do you want to trigger the different enemy damage sound effect to play? Is it based on the skill they were hit with? Physical skill = one enemy sound, magic skill = another enemy sound?
Darkstar> That method will work, but you (the developer) will have to manually assign the enemy damaged sound effect every single time a skill (or item) that deals damage is used.

Though you don't have to run a common event for it. Just put a \v='Audio/SE/NameOfFile'; at the start in the damage formula boxes.

GRS> Yeah, that's exactly it. I couldn't get why item.physical? and item.magical? never works the way I think they should. I'm guessing that's the only problem in the script I put up previously...
author=karins_soulkeeper
Darkstar> That method will work, but you (the developer) will have to manually assign the enemy damaged sound effect every single time a skill (or item) that deals damage is used.
Yeah, that's why I thought it might not be practical.

author=karins_soulkeeper
Though you don't have to run a common event for it. Just put a \v='Audio/SE/NameOfFile'; at the start in the damage formula boxes.
I never knew you could do that...

How does that work, exactly? I'm trying it in a new project, but it isn't cooperating.

Script 'Game_Battler' line 352: SyntaxError occurred.

unexpected $undefined
\v[1]='Audio/SE/Damage1'
I messed up ><
Take the slash out
v[1]='Audio/SE/Damage1'
I asked the same question on a BBS which is like Yahoo Answers in my country.
And someone gave me a script which perfectly works.
Please click the link below if you want to have a look at the script.
I appreciate all your help!

http://blog-imgs-82.fc2.com/g/y/m/gymaterials/201510021857029b9.txt
That's... practically the same as what I put up. The only diff being that I didn't include the item.certain? part. So why didn't mine work? :(

Oh well. It's a good thing you found that script.
author=karins_soulkeeper
I messed up ><
Take the slash out
v[1]='Audio/SE/Damage1'

It doesn't crash the game anymore, but the move with the code in it never does any damage for some reason, and the SE doesn't change.

Oh, well. It's most likely due to something else in the main scripting that I don't know how to properly modify. I probably won't ever need to do this, but thanks anyway.
Pages: 1