More then 1 of the same class?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

More then 1 of the same class?

Post by vanblam »

Is there a way to add a second light and particle to an object?

Code: Select all

defineObject{
	name = "ud_chandelier",
	components = {
		{
			class = "Model",
			model = "mod_assets/vb_models/models_under_d/env/ud_chandelier.fbx",
			staticShadow = true,
		},
		{
			class = "Light",
			range = 3.5,
			color = vec(1.3, 0.68, 0.35),
			brightness = 6,
			castShadow = true,
			staticShadows = true,
			offset = vec(0, 1.7, -0.63),
			onUpdate = function(self)
				local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9
				self:setBrightness(noise * 9)
			end,
		},
		{
			class = "Particle",
			particleSystem = "ud_candle",
			offset = vec(0, 1.7, -0.63),
		},
	},
	placement = "floor",
	editorIcon = 88,
	minimalSaveState = true,
	tags = { "VB","Under Dungeon" },
}
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: More then 1 of the same class?

Post by zimberzimber »

Define any component as you would normally, and give it a different name.

Code: Select all

       components = {
          {
             class = "Light",
             range = 3.5,
             color = vec(1.3, 0.68, 0.35),
             brightness = 6,
             castShadow = true,
             staticShadows = true,
             offset = vec(0, 1.7, -0.63),
             onUpdate = function(self)
                local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9
                self:setBrightness(noise * 9)
             end,
          },
          {
             class = "Light",
             name = "secondLight",
             range = 5,
             color = vec(1.3, 0.68, 0.35),
             brightness = 6,
             castShadow = true,
             staticShadows = true,
          },
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: More then 1 of the same class?

Post by vanblam »

Awesome thank you :) .. Had a feeling it was something simple :P
Post Reply