Darker world

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!
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Darker world

Post by Emera Nova »

During one of my fights I'm looking to darken the screen of the player to make it harder for them to see. Just making the room dark doesn't work right since we have a soft natural blue glow that gives some light to the party. Anyone know of a script I could run during a fight that would just darken up the screen some more?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Darker world

Post by minmay »

I don't think this is a good idea in the first place, since your players' displays are going to have varying brightness levels, and what's "hard to see" is going to vary a great deal between them. Also, the way Grimrock renders shadows has an extreme color depth problem such that sufficiently dark places are going to look awful - or be completely black - anyway.

But that aside, in Grimrock 2 that blue glow is from a LightComponent attached to the party object named "torch". You can disable it and add your own LightComponent with the brightness/color/etc that you want. (Changing the brightness/color of torch doesn't work very well because the game just overwrites it with new values immediately.)

Someone will probably suggest drawing a translucent rectangle in PartyComponent.onDrawGui, but onDrawGui doesn't execute if the player is free-looking, the game is paused, etc., which makes it pretty unsuitable for this sort of thing.
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.
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Darker world

Post by Azel »

Emera Nova wrote:During one of my fights I'm looking to darken the screen of the player to make it harder for them to see. Just making the room dark doesn't work right since we have a soft natural blue glow that gives some light to the party. Anyone know of a script I could run during a fight that would just darken up the screen some more?
Just spawn some Dark Bolts, it does a great job of darkening the screen. I like to spawn the occasional eyctopus, who casts Dark Bolt by default.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Darker world

Post by kelly1111 »

Minmay or anyone:
I need an example of this lightsource torch thing: cant seem to find it in the scripting reference ... what and how do I need to change class "light" to get a darker lightsource?

defineObject{
name = "party",
components = {
{
class = "Party",
},
{
class = "Light",
name = "torch",
range = 12,
},
},
editorIcon = 32,
placement = "floor",
}
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Darker world

Post by Azel »

Here is the code for the Torch particle (the "glow" section is in it) :

Code: Select all

defineParticleSystem{
	name = "torch",
	emitters = {
		-- smoke
		{
			emissionRate = 5,
			emissionTime = 0,
			maxParticles = 50,
			boxMin = {-0.03, 0.1, -0.03},
			boxMax = { 0.03, 0.1,  0.03},
			sprayAngle = {0,30},
			velocity = {0.1,0.5},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {1,1.75},
			color0 = {0.15, 0.15, 0.15},
			opacity = 1,
			fadeIn = 0.5,
			fadeOut = 0.5,
			size = {0.3, 0.6},
			gravity = {0,0,0},
			airResistance = 0.1,
			rotationSpeed = 0.6,
			blendMode = "Translucent",
		},

		-- flames
		{
			emissionRate = 50,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {-0.03, -0.03, 0.03},
			boxMax = { 0.03, 0.03,  -0.03},
			sprayAngle = {0,10},
			velocity = {0.2, 1},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.25, 0.85},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.35, 0.015},
			gravity = {0,0,0},
			airResistance = 1.0,
			rotationSpeed = 1,
			blendMode = "Additive",
			depthBias = 0.1,
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,-0.1},
			boxMax = {0,0,-0.1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {1000000, 1000000},
			colorAnimation = false,
			color0 = {0.23, 0.11, 0.08},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.1,
			size = {2, 2},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Additive",
			depthBias = 0.1,
		}
	}
}
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Darker world

Post by minmay »

...That is completely and utterly unrelated to everything in this thread. We're talking about the LightComponent on the party called "torch". Not the particle system that happens to be called "torch" or the object that happens to be called "torch".
kelly1111 wrote:I need an example of this lightsource torch thing: cant seem to find it in the scripting reference ... what and how do I need to change class "light" to get a darker lightsource?
It's just a regular LightComponent like any other, with the exception that the game changes its brightness/color/range automatically every frame. You can find the LightComponent methods here, but again, you probably just want to disable torch (just use the disable() method that all components have) and add your own LightComponent instead, because you can't usefully change the brightness/color/range of torch.
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.
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Darker world

Post by Azel »

minmay wrote:That is completely and utterly unrelated to everything in this thread. We're talking about the LightComponent on the party called "torch". Not the particle system that happens to be called "torch" or the object that happens to be called "torch".
minmay wrote:It's just a regular LightComponent like any other
mmhhmm, is it one specific thing or is it like any other thing? lol

I posted it because it has script for addressing the color and frame properties which may help kelly1111 in her task. It may not, but it is certainly far from "completely and utterly unrelated to everything in this thread." Although I do like how you completely and utterly contradicted yourself.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Darker world

Post by minmay »

Ffs. A particle system is not a LightComponent. It's not even a component. None of those fields correspond in any useful way to any field on any component, let alone LightComponent.
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.
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Darker world

Post by Azel »

Do you mean to say that the frame and color properties of the Particle System cannot be applied to a Light Component?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Darker world

Post by minmay »

Yes!
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.
Post Reply