Agnot2006 Posted May 28, 2009 Share Posted May 28, 2009 This scrip works attached to a trigger box but the sound is played on entering boxes all over the game. I removed the trigger but the sound still played. I found that it was the script once removed the problem stopped. The sound file ID is specific to my mod.What have I done wrong? scn ExpansionMySoundSB begin OnTriggerEnter Playsound MySoundSBEnd :confused: Link to comment Share on other sites More sharing options...
TGBlank Posted May 28, 2009 Share Posted May 28, 2009 Your sound was set as a loop perhaps? Link to comment Share on other sites More sharing options...
Agnot2006 Posted May 28, 2009 Author Share Posted May 28, 2009 No it was set to play at Once, but why does it play in other cells and other triggers?I’m obviously missing something Link to comment Share on other sites More sharing options...
BadPenney Posted May 28, 2009 Share Posted May 28, 2009 You did not include a DoOnce argument to your script, so the sound plays continuously once triggered, even though it is not set to loop: scn ExpansionMySoundSB short DoOnce begin OnTriggerEnterif DoOnce == 0Playsound MySoundSBSet DoOnce to 1endifEnd If you want the sound to play more than once, you will need a mechanism to reset DoOnce to 0. If you do not want NPCs or creatures to trigger the sound, then change to OnTriggerEnterPlayer. You need to create a unique trigger box. When you edited the trigger box and added your script to it, I am guessing that you did not rename the trigger box and save it as a unique ID. That would explain why the sound is playing in places that you did not intend. Link to comment Share on other sites More sharing options...
Agnot2006 Posted May 28, 2009 Author Share Posted May 28, 2009 Fantastic thank you. Do I have to set the DoOnce to 0 before the OnTriggerEnter will work again? Or is it automatically reset once the trigger condition is no longer present? Link to comment Share on other sites More sharing options...
BadPenney Posted May 28, 2009 Share Posted May 28, 2009 Fantastic thank you. Do I have to set the DoOnce to 0 before the OnTriggerEnter will work again? Or is it automatically reset once the trigger condition is no longer present?You will have to make a way for it to reset to 0. I have used proximity ( i.e. if player.getdistance > 120 ), changing cells ( i.e. if player.GetInWorldspace Wasteland ), timers, other trigger boxes, quest stages and scripts attached to packages and lines of dialogue to set conditions. I'm sure that more methods could be imagined, but your DoOnce condition will not reset to 0 without some sort of mechanism. Link to comment Share on other sites More sharing options...
Agnot2006 Posted May 29, 2009 Author Share Posted May 29, 2009 So I could use an OnTriggerLeave to set it back to zero then? Link to comment Share on other sites More sharing options...
BadPenney Posted May 29, 2009 Share Posted May 29, 2009 So I could use an OnTriggerLeave to set it back to zero then?It's worth a try. I found this script in vanilla FO3 that seems to change actor variables tat way: scn TrigCapitolBuildingBehemothHide04SCRIPT Begin onTriggerEnter Player if ( CapitolBehemothREF.IsInCombat == 1 ) if ( CapitolBehemothREF.GetCombatTarget == Player ) CapitolBehemothREF.setav Variable04 1 CapitolBehemothREF.evp endif endifEnd Begin onTriggerLeave Player CapitolBehemothREF.setav Variable04 0 CapitolBehemothREF.evpEnd Maybe change it to something like: scn ExpansionMySoundSB short DoOnce Begin onTriggerEnter Player if DoOnce == 0Playsound MySoundSBSet DoOnce to 1 endifEnd Begin onTriggerLeave Player if DoOnce == 1Set DoOnce to 0 endifEnd It might work fine. If it doesn't, just have to try something else.If you want NPCs or creatures to trigger the sound, just drop the "Player" part of the if statement. Have to try that myself. Thanks. :thumbsup: Link to comment Share on other sites More sharing options...
Agnot2006 Posted May 29, 2009 Author Share Posted May 29, 2009 Thank You I will give it a try as soon as I get home from work Link to comment Share on other sites More sharing options...
Agnot2006 Posted June 1, 2009 Author Share Posted June 1, 2009 Thank You BadPenny - KudosThis works great. I got a few sounds on exit initially, but I think that was down to the size and position of the trigger box which is almost the same size as an NPC. I few adjustments to the box and its fine now.Thank you again Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.