Making the dungeon darker

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
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Making the dungeon darker

Post by kelly1111 »

Is there a way to make the standard light in the dungeon darker ?
Does the party carry a standard lightsource with it, that I have to alter to make it seem more dark?

fiddling with the range in the parry object from the generic.lua doesnt seem to do anything at al ....

Code: Select all

defineObject{
	name = "party",
	components = {
		{
			class = "Party",
		},
		{
			class = "Light",
			name = "torch",
			range = 4,
		},
	},
	editorIcon = 32,
	placement = "floor",
}

Any suggestions?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Making the dungeon darker

Post by minmay »

There's some hardcoded stuff in the game that controls the torch component. If you want to change it, you are better off disabling it and using your own:

Code: Select all

defineObject{
   name = "party",
   components = {
      {
         class = "Party",
      },
      {
         class = "Light",
         name = "torch",
         enabled = false,
      },
      {
         class = "Light",
         color = vec(0.25,1,0.5),
         range = 9,
         onUpdate = function(self)
           -- torch still updates when disabled so you can get its offset, color, brightness, range, etc. and they will be accurate
           self:setOffset(self.go.torch:getOffset())
         end
      },
   },
   editorIcon = 32,
   placement = "floor",
}
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Making the dungeon darker

Post by kelly1111 »

Thanks minmay,

I used your code and the dungeon does indeed get darker with it. But now when I use the torch in a players hand, the dungeon gets even darker instead of casting light...
any idea why this is happening? Same code you used below here, adjusted the color only

Code: Select all

    defineObject{
       name = "party",
       components = {
          {
             class = "Party",
          },
          {
             class = "Light",
             name = "torch",
             enabled = false,
          },
          {
             class = "Light",
             color = vec(0.1,0.1,0.1),
             range = 8,
             onUpdate = function(self)
               -- torch still updates when disabled so you can get its offset, color, brightness, range, etc. and they will be accurate
               self:setOffset(self.go.torch:getOffset())
             end
          },
       },
       editorIcon = 32,
       placement = "floor",
    }
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Making the dungeon darker

Post by zimberzimber »

Color is way too dark.
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Making the dungeon darker

Post by minmay »

The code I posted was just a stub, not something suitable to use as-is. At a minimum you'll want to adjust the brightness, color, and range of the new LightComponent to correspond to that of torch so that wielding a TorchItemComponent or casting Light still makes things brighter.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Making the dungeon darker

Post by kelly1111 »

Tried with a higher value in colors, but when I equip a torch the dungeon still gets darker instead of brighter...
can someone please try it out in a test dungeon?

I did use minmay exact code in a small test dungeon with the same results... I am unable to use a torch with it. The torch makes the light get darker ...strange

ooo just now see that you answered my question already... will try to adjust range and brightness
Post Reply