Silencing ship spline.lua for FS19

Your forum for all discussions around Modding.
petorious
Posts: 73
Joined: Thu Oct 25, 2012 10:05 am

Silencing ship spline.lua for FS19

Post by petorious »

Afternoon all

Putting this out there if anyone is looking for a fix or knows a fix for a small part of a script in FS17 which was added to the map.lua to silence sound at screen load up.

I am working on a map for FS19 which has three various trains running across the map as visual moving scenery, they all have custom sounds added to them. How ever the models load up at 0,0,0 which means when you load the game up you get a crazy amount of sounds at the start until you click play.

This was the same issue in FS17, I am pretty sure it was Decker who provided the sound fix.

Below is the full map.lua from FS17 and the new one for FS19 which works fine bar the sound silence part.
P.S the majority of the map.lua has not changed so im not sure as to the reason its not working.

Pete.

FS17 CODE

Knuston = {}
local Knuston_mt = Class(Knuston, Mission00)

function Knuston:new(baseDirectory, customMt)
local mt = customMt
if mt == nil then
mt = Knuston_mt
end
local self = Knuston:superClass():new(baseDirectory, mt)

-- Number of additional channels that are used compared to the original setting (2)
local numAdditionalAngleChannels = 3;

self.terrainDetailAngleNumChannels = self.terrainDetailAngleNumChannels + numAdditionalAngleChannels;
self.terrainDetailAngleMaxValue = (2^self.terrainDetailAngleNumChannels) - 1;

self.sprayLevelFirstChannel = self.sprayLevelFirstChannel + numAdditionalAngleChannels;

self.ploughCounterFirstChannel = self.ploughCounterFirstChannel + numAdditionalAngleChannels;

return self
end

function ShipNewKeepQuietWhileLoading(self, superFunc, id)
local res = superFunc(self,id)
-- Move away from spawn (0,0,0), to "mute" sounds while loading...
for _,ship in pairs(res.shipIds) do
setTranslation(ship, 0,-1000,0);
end
--
return res
end
Ship.new = Utils.overwrittenFunction(Ship.new, ShipNewKeepQuietWhileLoading)

FS17 CODE

FS19 CODE

Knuston = {}
local Knuston_mt = Class(Knuston, Mission00)

function Knuston:new(baseDirectory, customMt, missionCollaborators)
local mt = customMt
if mt == nil then
mt = Knuston_mt
end
local self = Knuston:superClass():new(baseDirectory, mt, missionCollaborators)

-- Number of additional channels that are used compared to the original setting (2)
local numAdditionalAngleChannels = 3;

self.terrainDetailAngleNumChannels = self.terrainDetailAngleNumChannels + numAdditionalAngleChannels;
self.terrainDetailAngleMaxValue = (2^self.terrainDetailAngleNumChannels) - 1;

self.sprayLevelFirstChannel = self.sprayLevelFirstChannel + numAdditionalAngleChannels;

self.plowCounterFirstChannel = self.plowCounterFirstChannel + numAdditionalAngleChannels;
self.limeCounterFirstChannel = self.limeCounterFirstChannel + numAdditionalAngleChannels;

return self
end

function ShipNewKeepQuietWhileLoading(self, superFunc, id)
local res = superFunc(self,id)
-- Move away from spawn (0,0,0), to "mute" sounds while loading...
for _,ship in pairs(res.shipIds) do
setTranslation(ship, 0,-1000,0);
end
--
return res
end
Ship.new = Utils.overwrittenFunction(Ship.new, ShipNewKeepQuietWhileLoading)

FS19 CODE
Procobator
Posts: 337
Joined: Tue Aug 02, 2016 2:39 pm

Re: Silencing ship spline.lua for FS19

Post by Procobator »

I’ve not had the ship spline sound but in several occasions I’ve had a plane and bird chirping sounds at loading. I’ve found that as long as the sounds are not located in the last transform group in the scene graph tree I do not get the sounds at startup. This was for FS17. In 19 all my sounds I placed in a separate i3d file to be loaded. Have not had an issue in 19 yet.
petorious
Posts: 73
Joined: Thu Oct 25, 2012 10:05 am

Re: Silencing ship spline.lua for FS19

Post by petorious »

Procobator wrote: Wed Feb 13, 2019 3:24 pm I’ve not had the ship spline sound but in several occasions I’ve had a plane and bird chirping sounds at loading. I’ve found that as long as the sounds are not located in the last transform group in the scene graph tree I do not get the sounds at startup. This was for FS17. In 19 all my sounds I placed in a separate i3d file to be loaded. Have not had an issue in 19 yet.
In my case I can't do any of this due to its usage, can only hope someone may come up with a solution to my issue.
Appreciate the reply though. :)

Peter.
Post Reply