Page 1 of 1

Help with fireflies

Posted: Mon Feb 01, 2016 9:58 pm
by devineus
Hey guys,

I have decided to resurrect my old map from 2013... I never finished it, and figured this time around I would have enough tools/toys to make my vision. If one of you could help me out with changing the color of the light model fire flies to orange I would really appreciate it. I plan to use them as an ambient effect on top of the fire grate floor panel. as the ones with fireflies will become traps and the ones without will be safe. So I just need them to glow orange nothing more, I hope this is possible.

Thanks for your help.

Re: Help with fireflies

Posted: Mon Feb 01, 2016 11:30 pm
by Sutekh
Maybe something like this?
I just copied the scripts from the asset pack and played around with the colours a bit.

You can alter the color0 = {r,g,b} line in the particle system to change the colour of the fireflies, and you can change the color = vec(r,g,b) line in the object definition's light component to alter the colour of the glow.

Code: Select all

defineParticleSystem{
	name = "orange_fireflies",
	emitters = {
				-- fireflies
		{
			emissionRate = 10,
			emissionTime = 0,
			maxParticles = 50,
			boxMin = {-0.75,-0.5,-0.75},
			boxMax = { 0.75,0.5, 0.75},
			sprayAngle = {0,360},
			velocity = {0.1,0.5},
			objectSpace = true,
			texture = "assets/textures/particles/firefly_dif.tga",
			lifetime = {0.5,1},
			color0 = {3,0.4,0},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.1,
			size = {0.03, 0.1},
			gravity = {0,0,0},
			airResistance = 0.01,
			rotationSpeed = 10,
			blendMode = "Additive",
		},

	}
}

defineObject{
	name = "orange_fireflies",
	components = {
		{
			class = "Particle",
			particleSystem = "orange_fireflies",
			offset = vec(0, 1.8, 0),
		},
		{
			class = "Light",
			offset = vec(0, 1.8, 0),
			range = 5,
			color = vec(0.7, 0.3, 0),
			brightness = 4,
			fillLight = true,
		},
			{
			class = "Controller",
			onActivate = function(self)
				self.go.light:enable()
				self.go.particle:enable()
			end,
			onDeactivate = function(self)
				self.go.light:disable()
				self.go.particle:disable()
			end,
			onToggle = function(self)
				if self.go.light:isEnabled() then
					self.go.light:disable()
					self.go.particle:disable()
				else
					self.go.light:enable()
					self.go.particle:enable()
				end
			end,
		},	
	},
	placement = "floor",
	editorIcon = 88,
}