-
Notifications
You must be signed in to change notification settings - Fork 19
Templates
The Templates system is a powerful way to re-use effects for multiple parts rapidly and effectively. This section describes how to use it.
To use a template in a config file, create a ModuleWaterfallEffects
block as normal, with appropriate Controllers. However, instead of adding EFFECT
nodes from the ingame editor, add TEMPLATE
nodes, as shown below. Any number of these nodes can be added.
MODULE
{
name = ModuleWaterfallFX
// This is a custom name
moduleID = ionFX
// This links the effects to a given ModuleEngines if desired. If not, it will use the basic one.
engineID = basicEngine
// List out all controllers we want available
// This controller scales with atmosphere depth
CONTROLLER
{
name = atmosphereDepth
linkedTo = atmosphere_density
}
// This controller scales with effective throttle
CONTROLLER
{
name = throttle
linkedTo = throttle
}
TEMPLATE
{
// This is the name of the template to use
templateName = ionEngineTemplate
// This field allows you to override the parentTransform name in the EFFECTS contained in the template
overrideParentTransform = thrustTransform
// scale the templated effect
scale = 1,1,1
// rotate the templated effect
rotation = 0,0,0
// reposition the templated effect
position = 0,0,0
}
}
The various fields above in the example allow you to modify the position, rotation and scale of the template. In addition, it is possible to override the parentTransform
field in the EFFECT
block from the template. This is needed if your EFFECT
specifies a parentTransform
that does not exist in the config's model.
For example, you create a cool ion engine effect for one of your engines, and attach it to the myEngineEffect
transform, a transform you created in your engine model. You create a template so you can use it elsewhere. However, if you want to use it on the stock ion engine - which does not have this transform, you will have to use the overrideParentTransform
field in the TEMPLATE
block to select a transform which does exist on the stock model .
You can make new templates and distribute them with your mod, using them in your own effects or allowing others to use them.
To get started, create a blank config file somewhere in GameData. In this file, you can place EFFECTTEMPLATE
nodes, each of which defines a template. Templates should have a unique name, so that they can be referenced in part config files
EFFECTTEMPLATE
{
// name of the template
templateName = ionEngineGreenTemplate
}
To create the actual effect for your template, you first will want to use the ingame editor to create an Effect normally. However, instead of copying the EFFECTS into the node, you can use the Template Export button to export the template. Before you do this, fill in the template name form so the template will accurately generate.
Clicking Template Export will copy the entire EFFECTTEMPLATE
to the clipboard so you have paste it directly into the config file. It should look like this:
EFFECTTEMPLATE
{
// name of the template
templateName = ionEngineGreenTemplate
EFFECT
{
name = mainEffect
parentName = thrustTransform
MODEL
{
...
}