Looking for some expert advice for exhaust smoke

Discussion of rolling-stock creation & re-painting.

Looking for some expert advice for exhaust smoke

Unread postby railmaster » Mon Jan 20, 2020 5:48 am

Hi,
I am fairly new to Train sim and just recently i started modeling and testing out some models of my own( not very good at this point). Can someone please provide me a script to control exhaust smoke. I want my loco to not emit exhaust when it is in idle mode and puff out smoke only when the throttle is increased. I tried to find if anyone had previously posted, but couldn't find any.
Any one please?
railmaster
 

Re: Looking for some expert advice for exhaust smoke

Unread postby GreatNortherner » Mon Jan 20, 2020 11:41 am

Hi,

Have a look at the engine script of the Kuju\RailSimulatorUS F7. It includes load dependent smoke (if I remember correctly) and should be present in uncompiled .lua format.

Cheers
Michael
User avatar
GreatNortherner
 
Posts: 1584
Joined: Sun Feb 15, 2009 11:19 am
Location: Czech Republic

Re: Looking for some expert advice for exhaust smoke

Unread postby railmaster » Tue Jan 21, 2020 2:44 am

Thank you for the reply. But there is no RailsimulatorUS folder inside KUJU. All i have is RailsimulatorCore and Shapeviewer !*hp*!
railmaster
 

Re: Looking for some expert advice for exhaust smoke

Unread postby GreatNortherner » Tue Jan 21, 2020 3:42 am

Ah yes, you mentioned that you were new to train sim. The RailSimulatorUS assets originally were the default content of the game in its early years, and are now the content of the US Loco and Assets Pack on Steam -- I didn't consider the chance that you may not actually have that one. It is a requirement for many freeware add-ons and I'd recommend that you pick it up some day -- but wait for a sale and also check before, which older routes it is bundled with. Maybe you can get it with one of them.

Edit: I realize this doesn't help you much in your current situation. But looking at the script, it seems fairly "plug and play" to me, so you should be able to build your engine and then add the script at any point later on.

Cheers
Michael
User avatar
GreatNortherner
 
Posts: 1584
Joined: Sun Feb 15, 2009 11:19 am
Location: Czech Republic

Re: Looking for some expert advice for exhaust smoke

Unread postby railmaster » Tue Jan 21, 2020 2:51 pm

*!!thnx!!* I will see if i can get the loco itself on steam.
railmaster
 

Re: Looking for some expert advice for exhaust smoke

Unread postby buzz456 » Tue Jan 21, 2020 2:57 pm

Do you have any of the hood units from RSC or DTG? They all basically use the same scripting for the smoke.
Buzz
39 and holding.
"Some people find fault like there's a reward for it."- Zig Ziglar
"If you can dream it you can do it."- Walt Disney
Image
User avatar
buzz456
Site Admin
 
Posts: 20977
Joined: Sun Mar 21, 2010 8:30 am
Location: SW Florida

Re: Looking for some expert advice for exhaust smoke

Unread postby TheR62Fan » Tue Jan 21, 2020 4:08 pm

GreatNortherner wrote:It is a requirement for many freeware add-ons and I'd recommend that you pick it up some day -- but wait for a sale and also check before, which older routes it is bundled with. Maybe you can get it with one of them.


Yes, the original RailSimulator Content is one of the most important items you can ever pick up. Highly recommended. I picked up my copy from the original Cajon Pass and Northeast Corridor routes. In fact, the amount of 3rd party content available for these locomotives is just stunning. (I have over 50 different kinds of SD40-2s).
"Let them be your reminder that we've combined the best of two railroads. But from now on, call us Penn Central."
User avatar
TheR62Fan
 
Posts: 278
Joined: Mon Jun 24, 2019 6:39 am
Location: New York, United States

Re: Looking for some expert advice for exhaust smoke

Unread postby railmaster » Wed Jan 22, 2020 10:12 am

buzz456 wrote:Do you have any of the hood units from RSC or DTG? They all basically use the same scripting for the smoke.

I do have SD40s but the script files are in .out format.
railmaster
 

Re: Looking for some expert advice for exhaust smoke

Unread postby buzz456 » Wed Jan 22, 2020 10:36 am

Hood units I was referring to the RSC Empire builder or DTG feather River like f-units or e-units.
Buzz
39 and holding.
"Some people find fault like there's a reward for it."- Zig Ziglar
"If you can dream it you can do it."- Walt Disney
Image
User avatar
buzz456
Site Admin
 
Posts: 20977
Joined: Sun Mar 21, 2010 8:30 am
Location: SW Florida

Re: Looking for some expert advice for exhaust smoke

Unread postby bnsfsubdivision » Wed Jan 22, 2020 10:37 am

Code: Select all
--------------------------------------------------------------------------------------
-- Engine Script for SD40-2
--
-- (c) Railsimulator.com 2011
--
-- Provides script for variable exhaust smoke.
--
--------------------------------------------------------------------------------------


-- maximum tractive effort for determining smoke density. Acceleration rate for AI.

MAXTE = 0.5
ACCELRATE = 0.25

gSmokeColourR = 1.0
gSmokeColourG = 1.0
gSmokeColourB = 1.0
gEmitRate = 0.05

-------------------------------------------------------------------------------------

function Initialise ()


-- Get emitter values.

   gSmokeColourR, gSmokeColourG, gSmokeColourB = Call( "Exhaust01:GetEmitterColour" )


-- Stores for checking when values have changed.

   gDriven = 0

   Call( "BeginUpdate" )
   
end

-------------------------------------------------------------------------------------

function OnControlValueChange ( name, index, value )

   if Call( "*:ControlExists", name, index ) then

      Call( "*:SetControlValue", name, index, value );

   end

end

-------------------------------------------------------------------------------------

function Update ( time )


-- Check for player train.

   if Call( "GetIsPlayer" ) == 1 then

-- Check if player is driving this engine.

      if ( Call( "GetIsEngineWithKey" ) == 1 ) then
         if gDriven == 0 then
            gDriven = 1
            Call( "*:SetControlValue", "Active", 0, 1 )
         end
      else
         if gDriven == 1 then
            gDriven = 0
            Call( "*:SetControlValue", "Active", 0, 0 )
         end
      end

-- Get tractive effort values for this vehicle.
      TractiveEffort = Call ( "GetTractiveEffort" )
      TractiveEffort = math.abs ( TractiveEffort )

   else -- This is an AI train.

-- Tractive effort doesn't work for AI, so use acceleration.

      Accel = Call( "GetAcceleration" )
      Speed = Call( "GetSpeed" )

-- Unfortunately acceleration is signed based on direction loco is facing (sic).
      if Speed < 0 then
         Accel = Accel * -1
      end

      if Accel > ACCELRATE then
         TractiveEffort = MAXTE
      elseif ( math.abs(Speed) > 1 ) and ( Accel > -0.1 ) then
         TractiveEffort = MAXTE/2
      else
         TractiveEffort = MAXTE/11
      end

   end


   if TractiveEffort < MAXTE/10 then
                  
      gSmokeColourR = 0.8
      gSmokeColourG = 0.8
      gSmokeColourB = 0.8
      Call ( "Exhaust:SetEmitterColour", gSmokeColourR, gSmokeColourG, gSmokeColourB )
      Call ( "Exhaust:SetEmitterRate", gEmitRate )

   end
            
   if ( TractiveEffort <= MAXTE/2 ) and ( TractiveEffort >= MAXTE/10 ) then
            
      gSmokeColourR = 0.25
      gSmokeColourG = 0.25
      gSmokeColourB = 0.25
      Call ( "Exhaust:SetEmitterColour", gSmokeColourR, gSmokeColourG, gSmokeColourB )
      Call ( "Exhaust:SetEmitterRate", 0.01 )

   end
      
   if TractiveEffort > MAXTE/2 then
   
      gSmokeColourR = 0.0
      gSmokeColourG = 0.0
      gSmokeColourB = 0.0
      Call ( "Exhaust:SetEmitterColour", gSmokeColourR, gSmokeColourG, gSmokeColourB )
      Call ( "Exhaust:SetEmitterRate", 0.005 )

   end

end

Kevin Schulz
Artist - Searchlight Simulations
User avatar
bnsfsubdivision
 
Posts: 822
Joined: Sun Feb 20, 2011 5:27 am

Re: Looking for some expert advice for exhaust smoke

Unread postby railmaster » Thu Jan 23, 2020 1:39 am

bnsfsubdivision wrote:
Code: Select all
--------------------------------------------------------------------------------------
-- Engine Script for SD40-2
--
-- (c) Railsimulator.com 2011
--
-- Provides script for variable exhaust smoke.
--
--------------------------------------------------------------------------------------


-- maximum tractive effort for determining smoke density. Acceleration rate for AI.

MAXTE = 0.5
ACCELRATE = 0.25

gSmokeColourR = 1.0
gSmokeColourG = 1.0
gSmokeColourB = 1.0
gEmitRate = 0.05

-------------------------------------------------------------------------------------

function Initialise ()


-- Get emitter values.

   gSmokeColourR, gSmokeColourG, gSmokeColourB = Call( "Exhaust01:GetEmitterColour" )


-- Stores for checking when values have changed.

   gDriven = 0

   Call( "BeginUpdate" )
   
end

-------------------------------------------------------------------------------------

function OnControlValueChange ( name, index, value )

   if Call( "*:ControlExists", name, index ) then

      Call( "*:SetControlValue", name, index, value );

   end

end

-------------------------------------------------------------------------------------

function Update ( time )


-- Check for player train.

   if Call( "GetIsPlayer" ) == 1 then

-- Check if player is driving this engine.

      if ( Call( "GetIsEngineWithKey" ) == 1 ) then
         if gDriven == 0 then
            gDriven = 1
            Call( "*:SetControlValue", "Active", 0, 1 )
         end
      else
         if gDriven == 1 then
            gDriven = 0
            Call( "*:SetControlValue", "Active", 0, 0 )
         end
      end

-- Get tractive effort values for this vehicle.
      TractiveEffort = Call ( "GetTractiveEffort" )
      TractiveEffort = math.abs ( TractiveEffort )

   else -- This is an AI train.

-- Tractive effort doesn't work for AI, so use acceleration.

      Accel = Call( "GetAcceleration" )
      Speed = Call( "GetSpeed" )

-- Unfortunately acceleration is signed based on direction loco is facing (sic).
      if Speed < 0 then
         Accel = Accel * -1
      end

      if Accel > ACCELRATE then
         TractiveEffort = MAXTE
      elseif ( math.abs(Speed) > 1 ) and ( Accel > -0.1 ) then
         TractiveEffort = MAXTE/2
      else
         TractiveEffort = MAXTE/11
      end

   end


   if TractiveEffort < MAXTE/10 then
                  
      gSmokeColourR = 0.8
      gSmokeColourG = 0.8
      gSmokeColourB = 0.8
      Call ( "Exhaust:SetEmitterColour", gSmokeColourR, gSmokeColourG, gSmokeColourB )
      Call ( "Exhaust:SetEmitterRate", gEmitRate )

   end
            
   if ( TractiveEffort <= MAXTE/2 ) and ( TractiveEffort >= MAXTE/10 ) then
            
      gSmokeColourR = 0.25
      gSmokeColourG = 0.25
      gSmokeColourB = 0.25
      Call ( "Exhaust:SetEmitterColour", gSmokeColourR, gSmokeColourG, gSmokeColourB )
      Call ( "Exhaust:SetEmitterRate", 0.01 )

   end
      
   if TractiveEffort > MAXTE/2 then
   
      gSmokeColourR = 0.0
      gSmokeColourG = 0.0
      gSmokeColourB = 0.0
      Call ( "Exhaust:SetEmitterColour", gSmokeColourR, gSmokeColourG, gSmokeColourB )
      Call ( "Exhaust:SetEmitterRate", 0.005 )

   end

end


*!!thnx!!*
railmaster
 


Return to Rolling-Stock Design

Who is online

Users browsing this forum: No registered users and 1 guest