Jump to content

How to make an engine (Or edit the file)


Recommended Posts

So I'm working on a story/RP series thing involving a racing series and of course, someone's got to win the title. Well, when you win, you celebrate, right? And how do you do that in a car? Celebratory Doughnuts. Now I'd like this to look as awesome as possible, so I need tire smoke. Only problem? KSP tires don't make smoke when skidding. So I'm planning to put Junos into the rear wheels and they toggle on when I want. But of course, still problem. See, the Juno engine provides thrust, and its smoke goes out way too far. That's where my question comes in. I was wondering how to edit the code so that the engine 1) doesn't create thrust, and 2) The smoke effects don't shoot out; they stay stationary when exiting the engine.

I don't know if anyone can help (I.e. if this is even possible), but if someone could that would be really great. 

Link to comment
Share on other sites

You can find the Juno's cfg file in GameData\Squad\Parts\Engine\miniJet\SmallJetEngine.cfg. First module down is ModuleEnginesFX, which is what you want. In particular, you want maxThrust, which you can turn down to reduce or remove the thrust. I would set it to something really low instead of actually zero, just to be safe. 0.01 or something like that. Next, the smoke. At the bottom of the file you can find the engine's visual effect. You are looking for PREFAB_PARTICLE under the effect named running_thrust. The two entries named "speed" describe the speed at which the smoke should be emitted.

speed = 0.0 0.25
speed = 1.0 1.0

Turn them down and play around with their values until it looks right in the game. You want to edit the second values. The first values describe the percentage of throttle, so the speed can change as you throttle up. You might want to clone the Juno part (either manually by duplicating the cfg file or through module manager) so the original is kept intact.

Don't forget to post pics of your doughnut when you finish.

Link to comment
Share on other sites

19 minutes ago, Doxel said:

You can find the Juno's cfg file in GameData\Squad\Parts\Engine\miniJet\SmallJetEngine.cfg. First module down is ModuleEnginesFX, which is what you want. In particular, you want maxThrust, which you can turn down to reduce or remove the thrust. I would set it to something really low instead of actually zero, just to be safe. 0.01 or something like that. Next, the smoke. At the bottom of the file you can find the engine's visual effect. You are looking for PREFAB_PARTICLE under the effect named running_thrust. The two entries named "speed" describe the speed at which the smoke should be emitted.


speed = 0.0 0.25
speed = 1.0 1.0

Turn them down and play around with their values until it looks right in the game. You want to edit the second values. The first values describe the percentage of throttle, so the speed can change as you throttle up. You might want to clone the Juno part (either manually by duplicating the cfg file or through module manager) so the original is kept intact.

Don't forget to post pics of your doughnut when you finish.

Thanks :D I'll make sure to try this after playing some World of Warships (First time in a carrier :0.0:)

Link to comment
Share on other sites

@DarkOwl57 As a one-off this way is fine, but if you get into the habit of restatting parts, might I recommend Module Manager? :) 

Modifying the game's base files is generally a bad idea. It causes incompatibilities with mods (wich might aim to modify the same part); and anytime you have to verify the integrity of your files to fix a problem, or anytime the game updates to a new version, you lose all your changes. This may sound trivial with a single changed file, but can quickly become a problem once you modify more. Some mods ship hundreds of individual changes.

Module Manager is a mod that exists to circumvent these issues. Changes you make with MM patches are cumulative - any number of patches can be applied to the same part without breaking anything (assuming the patches themselves are functional). Additionally, the changes are stored in separate files, so they survive reinstalls and game updates without issue.

In order to solve your question with a Module Manager according to @Doxel's recommendations, download the latest MM release (if you don't already have it because it comes bundled with literally every mod ever), make a new plain text file somewhere inside /GameData/, change its extension to .cfg, and paste the following into the file:

+PART[miniJetEngine]:FINAL
{
    @name = customSmokeGenerator
    @Title = Custom Smoke Generator
    @mass = 0.01
    @rescaleFactor = 1        // Tweak me to your liking!
    @MODULE[ModuleEnginesFX]
    {
        @maxThrust = 0.001
    }
    @EFFECTS
    {
        @running_thrust
        {
            @PREFAB_PARTICLE
            {
                @speed,0 = 0.0 0.25       // Tweak me to your liking!
                @speed,1 = 1.0 1.0        // Tweak me to your liking!
            }
        }
    }
}

This should clone you a copy of the Juno engine named "Custom Smoke Generator" for your use.

 

Edited by Streetwind
Typos, typos everywhere!
Link to comment
Share on other sites

9 minutes ago, Urses said:

May i ask for a favor? Can you please add your small handy "Smoke Generator" to @Alshain 's MM-Patch tread additionaly? 

Hah, not so quickly, no. I don't actually have a KSP install on hand here, meaning I just wrote that off the top of my head. At minimum I would go and test it first to make sure it actually, you know, works :P The values for the effects speed still remain to be determined as well.

I won't be home for another eight hours. You can treat it as public domain, though. Test it, fix it, submit it!

 

Edited by Streetwind
Link to comment
Share on other sites

1 minute ago, Streetwind said:

Test it, fix it, submit it!

Prise to whom the prises belongs:wink:

But your workaround "from top off your head" looks and feels right. And the best part is, as you notified "Tweak me to your liking"!

Link to comment
Share on other sites

4 hours ago, Streetwind said:

@DarkOwl57 As a one-off this way is fine, but if you get into the habit of restatting parts, might I recommend Module Manager? :) 

Modifying the game's base files is generally a bad idea. It causes incompatibilities with mods (wich might aim to modify the same part); and anytime you have to verify the integrity of your files to fix a problem, or anytime the game updates to a new version, you lose all your changes. This may sound trivial with a single changed file, but can quickly become a problem once you modify more. Some mods ship hundreds of individual changes.

Module Manager is a mod that exists to circumvent these issues. Changes you make with MM patches are cumulative - any number of patches can be applied to the same part without breaking anything (assuming the patches themselves are functional). Additionally, the changes are stored in separate files, so they survive reinstalls and game updates without issue.

In order to solve your question with a Module Manager according to @Doxel's recommendations, download the latest MM release (if you don't already have it because it comes bundled with literally every mod ever), make a new plain text file somewhere inside /GameData/, change its extension to .cfg, and paste the following into the file:


+PART[miniJetEngine]:FINAL
{
    @name = customSmokeGenerator
    @Title = Custom Smoke Generator
    @mass = 0.01
    @rescaleFactor = 1        // Tweak me to your liking!
    @MODULE[ModuleEnginesFX]
    {
        @maxThrust = 0.001
    }
    @EFFECTS
    {
        @running_thrust
        {
            @PREFAB_PARTICLE
            {
                @speed,0 = 0.0 0.25       // Tweak me to your liking!
                @speed,1 = 1.0 1.0        // Tweak me to your liking!
            }
        }
    }
}

This should clone you a copy of the Juno engine named "Custom Smoke Generator" for your use.

 

Ah don't worry; I've got MM. In fact, it's kinda required for the RP modpack, which has.... *Inhale*

BDAC, Kerbinside, KerbalKonstructs, KAX, DCK, Kramax Autopilot, MechJeb, TakeCommand, and probably a few more I can't think o- Vessel Mover. I think that's it :wink:

Link to comment
Share on other sites

  • 2 weeks later...

Hmm... So I did what you said.. Good news: I finally got the engine to show up on the parts menu. Also good news: It provides 0 thrust! Bad news? Well...

1) @Azimech's 77I Indycar (The thing that will be burnt-out) Has too much grip. I've turned the FC on the rears to 0, turned the power on the fronts to 5.0, and jammed the gas. I can't do it on all-electric; I've got to use the main engine. Also...

2) The smoke is still shooting out at max speed... :/

Link to comment
Share on other sites

@DarkOwl57:

I can't speak to 1), but the reason the smoke still shoots out at full speed is because @Streetwind left those values unchanged.  You're going to have to modify them to get the right particle speed.

The way this works is through something called a float curve; mathematically, it's called a spline.  The idea is that the values you list are hard-coded and the game interpolates the intermediate values.

The lines of interest are the two that come after @PREFAB_PARTICLE:  what you have is a smoke effect that shoots at one-quarter speed when the throttle is zero and shoots at full speed when the throttle is at 100%.  Since the smoke machines are not actively moving the vessel, I suggest setting the effect speed values to be the same and some low value such as 0.05, so the lines look like this:

             @speed,0 = 0.0 0.05       // Tweak me to your liking!
             @speed,1 = 1.0 0.05       // Tweak me to your liking!

I haven't tried it myself; you will have to play with it.  That should give you slow-moving smoke that moves with no regard for the engine throttle.

Link to comment
Share on other sites

@Zhetaan

So from what I'm getting from above is that the first value is the throttle value. 0 is min throttle, 1 is max. Correct? If so, then the second value would be the speed that the smoke comes out. I'm hoping the smoke doesn't move at all, so maybe it should be like this.

 

@speed,0 = 0.0 0.00
@speed,1 = 1.0 0.00

Right? If I don't want it (The smoke) to move.. 

Note: I'm not hardly a programmer by any means; I can hardly build a rocket, much less edit .cfg files.

44 minutes ago, Azimech said:

I'll come back later to this. Please remind me, @DarkOwl57.

It's okay; I think you've made the car too good XD :P I can still loop it, just gotta get up to around 16 m/s

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...