Category | Scripting |
Created | 10.03.2025 11:51 |
letmecook | 10.03.2025 11:51 |
---|---|
Guys, I need some help. I'm working on a global script-based mod for trailers. I've managed to stop and start the tipping animation, and now I need to do the same for the unload sound. In Trailer.lua or Dischargeable.lua, I can see that sounds are loaded from the XML file, but I’m not sure how to handle this in my mod. Should I load the XML file and retrieve the sounds in the onLoad function, or should I do it in initSpecialization? I need something similar to how it's done in FS25_LowerReverseBeepVol (Decrease Reverse Beep on modhub), where the .lua file uses g_soundManager:setSampleVolumeOffset to adjust the volume. I just can't figure out how to get the unload sound and apply it using g_soundManager. Since this is a global mod, it needs to work with all trailers, so manually specifying sound paths for each one isn't a viable solution. Any ideas? So far for example i have this --[[ -- @param spec - self.spec_manualTipping -- @param tipSide - self.spec_trailer.tipSides[self.spec_trailer.preferedTipSideIndex] ]] function ManualTipping:stopManualTipping(spec, tipSide) spec.currentTippingAnimTime = self:getAnimationTime(tipSide.animation.name) spec.currentDoorAnimTime = self:getAnimationTime(tipSide.doorAnimation.name) self:setAnimationSpeed(tipSide.animation.name, 0) self:setAnimationSpeed(tipSide.doorAnimation.name, 0) self:setAnimationTime(tipSide.animation.name, spec.currentTippingAnimTime, false) self:setAnimationTime(tipSide.doorAnimation.name, spec.currentDoorAnimTime, false) -- Unload sound stop / descrease volume g_soundmanager:setSampleVolumeOffset(tipSide.unloadSound, 0) end And here I think i need access to unloadSound from Trailer but its always nil. In Trailer.lua I can see sounds are imported? from xml file and I dont know how to get them via my mod. I would appreciate some help with this. |
Note: Log in to post. Create a new account here.