Failed.Bard wrote...
Leurnid wrote...
Failed.Bard wrote...
If GetObjectByTag is working for selecting them, you would just need to standardize the naming so that you can get them using a loop on that function instead. Area tag + sound + night/day, perhaps, so you can toggle on/off certain sound placeables based on time of day as well.
Using the GetObjectByTag script snip of GoG's, you don't need area or day/night checks: Place the sound objects, then on the advanced tab, uncheck 'active' but set the time the sound should play. When the script runs, those sounds turn active until you use another script similar to it to deactive them, but they will only play according to the time params. So when the object with the script event is tripped, all the correctly tagged sounds will activate, but only play based on time of day. '>
I'm just not personally a fan of global switching, since it implies being HB driven. Area tagged day/night specific sounds can be easily turned on or off in an areas OnEnter script, and the mods HB script can toggle them twice a day in the areas currently occupied by PCs if needed.
That way, short of putting 5000+ sounds in a given area, you're never risking a TMI error or noticeable lag to the script.
Now, if you're planning to have some sounds that only play during a specific hour, then you'd be best with on and off time ints stored to the sound objects, but tagging them Area Tag + sound (or sound + area tag) allows for them to be toggled specifically where needed off a single compact generic script.
If you are planning to have sounds play at specific hours, just tell the
sounds to play at specific hours, no script, no HB, no fuss. Running a script to do what the engine is designed to do natively is less efficent.
If you use the sound's default time settings, you never need to use a HB Event to fire them, on the mod, on the area, on the anything.
In this case, I am talking about toggling sounds to 'active' with switches, doors, or triggers, in the on-enter, on-open, or on-use events, but again, no HB involved. I spare myself a lot of scripting headache trying to determine the time by simply toggling sound 'active', then letting the built in functionality of the sound determine when it actually makes noise. I am not trying to turn every sound object in a mod on/off, just a few local to the activating object with the script, and the time-to-play settings on the sound objects circumvent the need to run HB scripts to fire sounds at specific times.
This arrangement seems the ideal case for when you open a door, you have sound objects parked right behind it play.
For example:
You have a door tagged 'OgreLair', and 5 'inactive' sound objects tagged 'OgreLair_sound'.
When the door opens, it cycles and activates all 5 sound with the door's tag +'_sound' using a generic script.
All 5 sounds turn on, but using the built in times on sounds, only the ones you want will play at specific times, so you hear ogre grunts, ominous evil entrance, and wailing women at night, but during the day, you hear ominous evil entrance, snoring, and wimpering women.
A no script use of the built in sound timing function, that never requires scripts, let alone HB, is blacksmith's shop... set all the sounds to daytime only, when the smithy and apprentice are supposed to be present; place sound objects for the bellows, hammering, the fire, and one or two random bump-thump-and-scrape, all set in the sound properties to only play during the day.
Modifié par Leurnid, 22 mai 2012 - 04:06 .