Okay, this time I'm having a problem with making a sound play when you damage something.
This system I made is pretty nice if you like to explode the dung out of monsters, I just have this flavor sound not playing irritate me, even though it's not important in the sense of functionality... (The system works just fine otherwise.)
So this placeable item "Barrel of Gunpowder". You guessed it, I'm having it explode if shot with a gun, which works fine with the spell fireball instantly cast at itself OnDamaged event. But I seem to get the spell sound override the sound I gave it, even though I set that sound play first in code and the spell cast with 0.1 sec delay.
Anyone got expertise on sounds etc. so they could tell me how to disable the fireball sound on this script, or atleast make this sound play ("zep_explosion")
Here's the script:
void main()
{
effect eVFX;
object oSelf = OBJECT_SELF;
// Get the creature who triggered this event.
object oPC = GetLastHostileActor();
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
// Abort if the PC does not have the item A gun equipped.
if ((GetStringLeft(GetResRef(oWeapon), 4)== "gun_"))
{
PlaySound("zep_explosion");
//Cast Fireball.
DelayCommand(0.1, ActionCastSpellAtObject(SPELL_FIREBALL, oSelf, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
// Apply some visual effects.
eVFX = EffectVisualEffect(VFX_FNF_SCREEN_SHAKE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSelf);
eVFX = EffectVisualEffect(620);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSelf);
// Destroy an object
eVFX = EffectVisualEffect(VFX_IMP_DUST_EXPLOSION);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSelf);
DestroyObject(oSelf, 3.0);
}
else SendMessageToPC(oPC, "You should shoot it with a gun.");
return;
}
Modifié par JerrodAmolyan, 11 août 2013 - 10:44 .