Jetpack with other particles

Hi all, I’m doing some modifications to the “3D Platformer Tutorial”. I added a mounted sword to the player, said sword has a particle effect attached, but because the “jetpack partial controller script” the sword particle only turns on when the played is jumping.

Is there a way to make it so the sword is going all the time and the flames to the jet pack only work when jumping?

Here is the code for the jump pack control for reference:

private var litAmount = 0.00;

function Start () {

	var playerController : ThirdPersonController = GetComponent(ThirdPersonController);
	
	// The script ensures an AudioSource component is always attached.
	
	// First, we make sure the AudioSource component is initialized correctly:
	audio.loop = false;
	audio.Stop();
	
	
	// Init the particles to not emit and switch off the spotlights:
	var particles : Component[] = GetComponentsInChildren(ParticleEmitter);
	var childLight : Light = GetComponentInChildren(Light);
	
	for (var p : ParticleEmitter in particles)
	{
		p.emit = false;
	}
	childLight.enabled = false;

	// Once every frame  update particle emission and lights
	while (true)
	{
		var isFlying = playerController.IsJumping();
				
		// handle thruster sound effect
		if (isFlying)
		{
			if (!audio.isPlaying)
			{
				audio.Play();
			}
		}
		else
		{
			audio.Stop();
		}
		
		
		for (var p : ParticleEmitter in particles)
		{
			p.emit = isFlying;
		}
		
		if(isFlying)
			litAmount = Mathf.Clamp01(litAmount + Time.deltaTime * 2);
		else
			litAmount = Mathf.Clamp01(litAmount - Time.deltaTime * 2);
		childLight.enabled = isFlying;
		childLight.intensity = litAmount;
					
		yield;
	}
}

@script RequireComponent(AudioSource)

Keep in mind I am totally new to scripting so the more hand holding you can do the better.

Probably easiest to use separate gameObjects for each particle system, at least for the sake of this example.

So create an empty gameObject as a child of your character. Position it where you want the particle effect to be.

Create a public static jumpBool for all your objects to easily read.

Attach a particle system to your new Child gameObject.

 public static bool jumpBool = false;

//if you want them both on the same object you could use this, and add in front of code;

    public ParticleSystem jumpParticles;

Start()
{
//can probably just use 2nd of these two statements for this gameObject
renderer.enabled = false;
renderer.particleSystem.enableEmission = false;

}


//in your script on the new gameObject:

    void Update()
    {
    if (jumpBool == true)
    {

    renderer.particleSystem.enableEmission = true;
//jumpParticles.renderer.particleSystem.enableEmission = true;

    }

else renderer.particleSystem.enableEmission = false;
// else jumpParticles.renderer.particleSystem.enableEmission = false;
    }