Hey all,
I found this simple plugin from a user who hasn't been online in 9 years (Mr. Trivel), so I figured I'd ask for help here. This plugin has a simple function which is that it will play a selected sound when an enemy/actor dies. It seems he didn't take into account multi-hit skills which will cause the sound to play multiple times (or perhaps another plugin of mine makes it function this way?).
His other plugin HitSounds functions on execute damage, so I found that easy to mod by adding checks for the target's current HP etc. However this plugin functions on play collapse, which I can't wrap my head around.
Here's the part where the sound is played:
My thought is to add some kind of simple temporary switch that turns on when the function is played, and then I just add a check to the "if" statement to make sure it's off. The problem is I have no clue how to make a variable tethered to the target being called because I'm a 3/100 level Javascripter lol. There also seems to be added issues because this function works on both actors and enemies, because the clumsy things I've tried make it so actors get the switch permanently turned on so they can only die once ever.
I found this simple plugin from a user who hasn't been online in 9 years (Mr. Trivel), so I figured I'd ask for help here. This plugin has a simple function which is that it will play a selected sound when an enemy/actor dies. It seems he didn't take into account multi-hit skills which will cause the sound to play multiple times (or perhaps another plugin of mine makes it function this way?).
His other plugin HitSounds functions on execute damage, so I found that easy to mod by adding checks for the target's current HP etc. However this plugin functions on play collapse, which I can't wrap my head around.
Here's the part where the sound is played:
JavaScript:
var _GameBattler_performCollapse = Game_Battler.prototype.performCollapse;
Game_Battler.prototype.performCollapse = function() {
_GameBattler_performCollapse.call(this)
if (this._deathSounds.length > 0)
{
var sound = AudioManager.makeEmptyAudioObject();
var randomDeathSound = this._deathSounds[Math.floor(Math.random()*this._deathSounds.length)];
sound.name = randomDeathSound[0];
sound.volume = randomDeathSound[1];
sound.pitch = randomDeathSound[2];
AudioManager.loadStaticSe(sound);
AudioManager.playStaticSe(sound);
}
};
My thought is to add some kind of simple temporary switch that turns on when the function is played, and then I just add a check to the "if" statement to make sure it's off. The problem is I have no clue how to make a variable tethered to the target being called because I'm a 3/100 level Javascripter lol. There also seems to be added issues because this function works on both actors and enemies, because the clumsy things I've tried make it so actors get the switch permanently turned on so they can only die once ever.