Ask a simple question, get a simple answer

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!
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Is there a way to define a material with transparency without it being visible in the dark ? I tried to do it for a custom monster based on the summon_stone, replacing its material with an ice version. It seems no blendMode except Opaque (or Modulative which is also useless) works correctly in the dark.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Blend modes other than Opaque do not support lighting. Lighting wouldn't even be meaningful for blend modes other than Opaque and Translucent.

The alphaTest field in the material definition exists so that you can use 1-bit alpha with the Opaque blend mode; pixels with alpha at or below the threshold (I think it's 127) are treated as completely transparent, pixels with alpha above the threshold are treated as completely opaque. Shadowmaps take it into account too.
If you want to use the Translucent blend mode with lighting, then the answer is no, sorry, you can't. Yes, it's quite inconvenient.

If you want to use the Additive, Modulative, or Screen blend modes with lighting, you need to learn what those words actually mean, because it wouldn't make any sense to try to apply lighting to them; you should think of them as screens that do arithmetic on pixels behind them, not as physical surfaces.
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.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Well I never used modulative blending before, I know what the others do and why an additive mode will never be as dark as its background :)

So I see modulative is about multiplying colors noted as floats in range 0 to 1... So this one only makes things darker, not what I would need for ice.

I tested the 4 modes listed in the github wiki, just to see if the names fit them well! I never heard about a screen blend mode before, I guess it can be found in the assets pack.

Too bad we can't write shaders! I wrote one for opengl some time ago with lightning and transparency, so I thougth that would be included in grimrock... The only problem with it is not lightning but well planed rendering order, so...

But no problem, easy solution; my ice golem will get a light source to hide its misery :lol:

edit: I won't search into it too much for having messed with it before, but there is at least one shader with lightning and transparency in the game : water! (Unusable and the only one I guess...)
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

AndakRainor wrote:edit: I won't search into it too much for having messed with it before, but there is at least one shader with lightning and transparency in the game : water! (Unusable and the only one I guess...)
The water shader doesn't use lighting either. You're just seeing the reflections/refactions of things that do use lighting.
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.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

I am failing at defining a pit that should kill the party and does not lead to the map below (there is none).

Also, I would like it to be placed by a custom tile, with no model for the tile (like the void tile) nor for the pit (got bugs with shafts the required builder tries to place).

Is there any hope ?
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

The Shaman Staff item has this line:

Code: Select all

gameEffect = "Earthbound (Poison spells deal 20% more damage)",
I don't see anything else in the definition that implements this effect. I think gameEffect is only a gui description, so my question is, how does this work, and is there any other similar effect that can be used for a custom item ?
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

It's hardcoded. If the champion has an item defined as "shaman_staff" equipped when they cast a poison spell, they get the bonus. You'd have to reimplement the standard spells to make a similar effect for any other item.

Note that Zhandul's Orb actually has no special effect in Grimrock 2, it doesn't make fire spells any more powerful.
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.
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

Got two questions here:
1) Where are the condition definitions located in the asset pack? (like poisoned or diseased)
2) Is it possible for a condition to receive and store data, and do something based on the data stored upon its expiration?
For example - New condition named Hex. Upon receiving it, Hex checks the champions health and stores it. When it expires, it deals damage or heals the champion based on the difference between the health they had upon receiving the condition and their current health.
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

zimberzimber wrote:Got two questions here:
1) Where are the condition definitions located in the asset pack? (like poisoned or diseased)
They aren't. Custom conditions were added in 2.2.4.
zimberzimber wrote:2) Is it possible for a condition to receive and store data, and do something based on the data stored upon its expiration?
For example - New condition named Hex. Upon receiving it, Hex checks the champions health and stores it. When it expires, it deals damage or heals the champion based on the difference between the health they had upon receiving the condition and their current health.
Store the data in a ScriptComponent somewhere.
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.
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

minmay wrote:They aren't. Custom conditions were added in 2.2.4.
Alright, is there somewhere I can view an example of a condition to use as a reference for creating a new one? (if possible)
My asset pack [v1.10]
Features a bit of everything! :D
Post Reply