Jump to content

How do you stop an effect?


Recommended Posts

I've found that Part.Effect will play one of the effects specified in the part's EFFECTS node, but how do you turn off the effect? For instance:

	EFFECTS
	{		
		running_thrust
		{			
			AUDIO
			{
				channel = Ship
				clip = sound_jet_deep
				volume = 0.0 0.0
				volume = 0.05 0.4
				volume = 1.0 1.0
				pitch = 0.0 0.6
				pitch = 1.0 1.0
				loop = true
			}
			PREFAB_PARTICLE
			{
				prefabName = fx_smokeTrail_light
				transformName = thrustTransformFX
				emission = 0.0 0.0
				emission = 0.05 0.0
				emission = 0.075 0.25
				emission = 1.0 1.25
				speed = 0.0 0.25
				speed = 1.0 1.0
				localOffset = 0, 0, 1
				localRotation = 1, 0, 0, -90
			}					
		}
	}

the running_thrust effect can be played by this.part.Effect("running_thrust") and the sound will be looped (loop = true). But how do you stop the looping sound, or stop the effect?

Link to comment
Share on other sites

For my own sanity: I made an engine that works in game. I was having trouble with it, until I deleted the fx parts of it. It then worked perfectly, but when I went to add the fx back in, they won't show up. 

Help?

Spoiler

//Ludicrous Propulsion Systems 0.1.0
//Small Hybrid Engine 1.25m

PART
{
	name = hybridSmall
	module = Part
	author = Benjamin Cronin
	
	mesh = model.mu
	scale = 1.0
	rescaleFactor = 1
	
	node_stack_top = 0.0, 0.625, 0.0, 0.0, 1.0, 0.0, 1
	node_stack_bottom = 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 1
	node_attach = 0.0, 0.0, -0.625, 0.0, 0.0, 1.0
	
	category = Propulsion
	subcategory = 0
	title = TD-7 "Mite" Hybrid Engine
	manufacturer = Benjamin Kerman's Welding Supply Co
	description = A repurposed RT-5 "Flea" Solid Fuel Booster, this hybrid solid fuel and oxidizer fueled motor is the first of its kind. Throttleable and with more control, this engine has revolutionized at least a small part of the space industry.
	
	TechRequired = generalRocketry
	entryCost = 7500
	cost = 1750
	
	attachRules = 1,1,1,1,0
	
	mass = 0.6
	heatConductivity = 0.06
	skinInternalConductionMult = 4.0
	emissiveConstant = 0.7
	dragModelType = default
	maximum_drag = 0.3
	minimum_drag = 0.2
	angularDrag = 2
	crashTolerance = 7
	breakingForce = 200
	breakingTorque = 200
	maxTemp = 2000
	stagingIcon = SOLID_BOOSTER
	bulkheadProfiles = size1, srf
	tags = mite (motor rocket engine srb hybrid lps oxidizer
	
	EFFECTS
	{
		running_closed
		{
			AUDIO
			{
				channel = Ship
				clip = sound_rocket_hard
				volume = 0.0 0.0
				volume = 1.0 1.0
				pitch = 0.0 0.2
				pitch = 1.0 1.0
				loop = true
			}
			PREFAB_PARTICLE
			{
				prefabName = fx_smokeTrail_veryLarge
				transformName = smokePoint
				emission = 0.0 0.0
				emission = 0.05 0.0
				emission = 0.075 0.25
				emission = 1.0 1.25
				speed = 0.0 0.25
				speed = 1.0 1.0
				localOffset = 0, 0, 1
			}
			MODEL_MULTI_PARTICLE
			{
				modelName = Squad/FX/SRB_Large
				transformName = fxPoint
				emission = 0.0 0.0
				emission = 0.05 0.0
				emission = 0.075 0.25
				emission = 1.0 1.25
				speed = 0.0 0.5
				speed = 1.0 1.2
			}
			MODEL_PARTICLE
			{
				modelName = Squad/FX/SRB_LargeSparks
				transformName = fxPoint
				emission = 0.0 0.0
				emission = 0.05 0.0
				emission = 0.075 0.25
				emission = 1.0 1.25
				speed = 0.0 0.5
				speed = 1.0 1.2
			}
		}
		engage
		{
			AUDIO
			{
				channel = Ship
				clip = sound_vent_medium
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
		flameout
		{
			PREFAB_PARTICLE
			{
				prefabName = fx_exhaustSparks_flameout_2
				transformName = fxPoint
				oneShot = true
			}
			AUDIO
			{
				channel = Ship
				clip = sound_explosion_low
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
	}
	MODULE
	{
		name = ModuleEnginesFX
		thrustVectorTransformName = thrustTransform
		engineID = MTSRB
		powerEffectName = running_closed
		throttleLocked = False
		exhaustDamage = True
		ignitionThreshold = 0.1
		minThrust = 0
		maxThrust = 246
		heatProduction = 495
		useEngineResponseTime = False
		engineAccelerationSpeed = 8.0
		allowShutdown = True
		fxOffset = 0, 0, 0.35
		EngineType = SolidBooster
		exhaustDamageDistanceOffset = 0.8
		PROPELLANT
		{
			name = SolidFuel
			ratio = 0.8
			DrawGauge = True
		}
		PROPELLANT
		{
			name = Oxidizer
			ratio = 1.2
			DrawGauge = False
		}
		atmosphereCurve
		{
			key = 0 195
			key = 1 160
			key = 7 0.001
		}
	}
	MODULE
	{
		name = ModuleGimbal
		gimbalTransformName = thrustTransform
		gimbalRange = 2.5
	}
	MODULE
	{
		name = FXModuleAnimateThrottle
		animationName = HeatAnimationSRB
		responseSpeed = 0.002
		dependOnEngineState = True
		dependOnThrottle = True
	}
	RESOURCE
	{
		name = SolidFuel
		amount = 80
		maxAmount = 80
	}
	RESOURCE
	{
		name = Oxidizer
		amount = 120
		maxAmount = 120
	}
	MODULE
	{
		name = ModuleTestSubject
		useStaging = True
		useEvent = True
		situationMask = 60
		CONSTRAINT
		{
			// disable all but home
			type = SITUATION
			value = 0
			body = _NotHome
			prestige = Trivial
		}
		CONSTRAINT
		{
			// disable all but home
			type = SITUATION
			value = 0
			body = _NotHome
			prestige = Significant
		}
		CONSTRAINT
		{
			type = REPEATABILITY
			value = ALWAYS
			prestige = Trivial
		}
		CONSTRAINT
		{
			type = REPEATABILITY
			value = BODYANDSITUATION
			prestige = Significant
		}
		CONSTRAINT
		{
			type = REPEATABILITY
			value = ONCEPERPART
			prestige = Exceptional
		}
		CONSTRAINT
		{
			type = ALTITUDEENV
			test = GT
			value = 4000
			prestige = Trivial
		}
		CONSTRAINT
		{
			type = ALTITUDEENV
			test = LT
			value = 8000
			prestige = Trivial
		}
		CONSTRAINT
		{
			type = ALTITUDEENV
			test = GT
			value = 2000
			prestige = Significant
		}
		CONSTRAINT
		{
			type = ALTITUDEENV
			test = LT
			value = 4000
			prestige = Significant
		}
		CONSTRAINT
		{
			type = ALTITUDEENV
			test = GT
			value = 1000
			prestige = Exceptional
		}
		CONSTRAINT
		{
			type = ALTITUDEENV
			test = LT
			value = 2000
			prestige = Exceptional
		}
		CONSTRAINT
		{
			type = ALTITUDE
			test = GT
			value = 0 // this just registers altitude as something to care about
			situationMask = 8
		}
		CONSTRAINT
		{
			type = ALTITUDE
			test = LT
			value = 300000
			situationMask = 16
			body = _NotSun
		}
		CONSTRAINT
		{
			type = ALTITUDE
			test = LT
			value = 600000
			situationMask = 32
			body = _NotSun
		}
		CONSTRAINT
		{
			type = SPEED
			test = GT
			value = 0
			situationMask = 8
			prestige = Trivial
		}
		CONSTRAINT
		{
			type = SPEED
			test = LT
			value = 600
			situationMask = 8
			prestige = Trivial
		}
		CONSTRAINT
		{
			type = SPEED
			test = GT
			value = 0
			situationMask = 8
			prestige = Significant
		}
		CONSTRAINT
		{
			type = SPEED
			test = LT
			value = 900
			situationMask = 8
			prestige = Significant
		}
		CONSTRAINT
		{
			type = SPEED
			test = GT
			value = 300
			situationMask = 8
			prestige = Exceptional
		}
		CONSTRAINT
		{
			type = SPEED
			test = LT
			value = 1200
			situationMask = 8
			prestige = Exceptional
		}
		CONSTRAINT
		{
			type = SPEEDENV
			test = LT
			value = 200
			prestige = Trivial
		}
		CONSTRAINT
		{
			type = SPEEDENV
			test = GT
			value = 100
			prestige = Trivial
		}
		CONSTRAINT
		{
			type = SPEEDENV
			test = LT
			value = 100
			prestige = Significant
		}
		CONSTRAINT
		{
			type = SPEEDENV
			test = GT
			value = 50
			prestige = Significant
		}
		CONSTRAINT
		{
			type = SPEEDENV
			test = LT
			value = 50
			prestige = Exceptional
		}
		CONSTRAINT
		{
			type = SPEEDENV
			test = GT
			value = 20
			prestige = Exceptional
		}
	}
	MODULE
	{
		name = ModuleSurfaceFX
		thrustProviderModuleIndex = 0
		fxMax = 1
		maxDistance = 50
		falloff = 2
		thrustTransformName = thrustTransform
	}
}

 

Link to comment
Share on other sites

15 hours ago, Benjamin Kerman said:

For my own sanity: I made an engine that works in game. I was having trouble with it, until I deleted the fx parts of it. It then worked perfectly, but when I went to add the fx back in, they won't show up. 

Help?

I've tried to highlight a few things the might be wrong (not 100% sure).

  • I think you thrustTransformName need to be correctly referenced in the effects node (see bold italic).
  • Secandly you use "powerEffectName" in the moduleEnginesFX. This could be ok, but try using "runningEffectName" which is usually used for non jet engines. I think powerEffectName is tied to "useEngineResponseTime" which you have to false.

Again I can be wrong, I have not figured out all the effects stuff yet. But might be that this can help you.

  Hide contents

PART
{
	name = hybridSmall
	module = Part
        //....stuff
	
	EFFECTS
	{
		running_closed
		{
                        //effect stuff
			PREFAB_PARTICLE
			{
				prefabName = fx_smokeTrail_veryLarge
				transformName = smokePoint
				emission = 0.0 0.0
				emission = 0.05 0.0
				emission = 0.075 0.25
				emission = 1.0 1.25
				speed = 0.0 0.25
				speed = 1.0 1.0
				localOffset = 0, 0, 1
			}
			MODEL_MULTI_PARTICLE
			{
				modelName = Squad/FX/SRB_Large
				transformName = fxPoint
				emission = 0.0 0.0
				emission = 0.05 0.0
				emission = 0.075 0.25
				emission = 1.0 1.25
				speed = 0.0 0.5
				speed = 1.0 1.2
			}
			MODEL_PARTICLE
			{
				modelName = Squad/FX/SRB_LargeSparks
				transformName = fxPoint
				emission = 0.0 0.0
				emission = 0.05 0.0
				emission = 0.075 0.25
				emission = 1.0 1.25
				speed = 0.0 0.5
				speed = 1.0 1.2
			}
		}
                //Effect stuff
	}
	MODULE
	{
		name = ModuleEnginesFX
		thrustVectorTransformName = thrustTransform
		engineID = MTSRB
		powerEffectName = running_closed
                //stuff
	}
        //.....stuff
	MODULE
	{
		name = ModuleSurfaceFX
		thrustProviderModuleIndex = 0
		fxMax = 1
		maxDistance = 50
		falloff = 2
		thrustTransformName = thrustTransform
	}
}
Link to comment
Share on other sites

@Benjamin Kerman,these are the stuff you need to correct:

Transform name for effect is usually the same as is for thrust,unless there is additional transform created in unity for that purpose.This applies for both "MODEL_MULTI_PARTICLE" and "PREFAB_PARTICLE"
If you have two identical effects (MODEL_MULTI_PARTICLE),each one needs to have unique name
it's "MODEL_MULTI_PARTICLE" not "MODEL_PARTICLE"!

MODEL_MULTI_PARTICLE
{
name = effect1  //unique name for every effect
transformName = thrustTransform

}

There is also no need for "fxOffset" in "ModuleEnginesFX" since it has no effect.If you want to adjust position of the effect you need to use:

MODEL_MULTI_PARTICLE
{
localOffset = 0,0,0 //x,y,z
localRotation = 0,0,0 //x,y,z
}

 

Link to comment
Share on other sites

4 hours ago, sebi.zzr said:

@Benjamin Kerman,these are the stuff you need to correct:

Transform name for effect is usually the same as is for thrust,unless there is additional transform created in unity for that purpose.This applies for both "MODEL_MULTI_PARTICLE" and "PREFAB_PARTICLE"
If you have two identical effects (MODEL_MULTI_PARTICLE),each one needs to have unique name
it's "MODEL_MULTI_PARTICLE" not "MODEL_PARTICLE"!

Hey sebi.zzr, you seem to have a good grasp of how the effects nodes are actually working - and thank for the hint of unique name for each fx! A while back I posted a question of how to convert engines to used effects node structure using moduleEnginesFX from the moduleEngines structure without the effects node. Would you maybe know the answer to that question by any chance?

Link to comment
Share on other sites

2 hours ago, Warezcrawler said:

 A while back I posted a question of how to convert engines to used effects node structure using moduleEnginesFX from the moduleEngines structure without the effects node.

I hope that OP wouldn't mind that we hijacket the thread.Can you point me to the post you made?

Link to comment
Share on other sites

9 hours ago, sebi.zzr said:

I hope that OP wouldn't mind that we hijacket the thread.Can you point me to the post you made?

wow, that was a long while back.... It was this below thread.

Sorry OP, we will leave this thread to the core question again.

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...