henesua, my module is very big could be it the problem? The sound have delay and isn't playing immediately:
object oSom = CreateObject(OBJECT_TYPE_PLACEABLE,"somfogueira",GetLocation(OBJECT_SELF));
SetLocalString(oSom,"som","al_cv_firepit1");
ExecuteScript("sound_ex", oSom);
DelayCommand(60.0, DeleteLocalString(oSom,"som"));
//::///////////////////////////////////////////////
//:: sound_ex
//:://////////////////////////////////////////////
/*
Use: Executed by an object
Recursive script function that plays a sound.
Local string: SOUND
if the local string is empty recursion stops
--> that is how you turn it off
*/
//:://////////////////////////////////////////////
//:: Created By: The Magus (2012 mar 11)
//:: Modified:
//:://////////////////////////////////////////////
float GetSoundLength(string sSom)
{
if(sSom=="") //none
return 0.0;
else if(sSom=="al_cv_firepit1")
return 5.0;
else if(sSom=="al_cv_firecppot1")
return 5.6;
else
return 5.9;
}
void main()
{
string sSom = GetLocalString(OBJECT_SELF,"som");
float fDelay = GetSoundLength(sSom);
if(fDelay > 0.0)
{
PlaySound(sSom);
DelayCommand(fDelay, ExecuteScript("sound_ex", OBJECT_SELF));
}
else DestroyObject(OBJECT_SELF);
}