fill a dungeon dug out with water?

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
Mentok
Posts: 5
Joined: Sat Dec 27, 2014 6:34 am

Re: fill a dungeon dug out with water?

Post by Mentok »

Drakkan wrote:actually it is possible... :)

Code: Select all

    defineObject{
        name = "user_water_surface",
        base_object = "water_surface",
        components = {
            {
            class = "WaterSurface",
            fogColor = vec(0.021,0.045,0.13,0),
            fogDensity = 0.2,
            planeY = -0.4,
            reflectionColor = vec(0.693,0.81,0.9,0),
            refractionColor = vec(1,1,1,0),
            },
            {
            class = "WaterSurfaceMesh",
          -- There you'll have to modify the Y offset to up/down the water level
          offset = vec(0,0,0,0),
            material = "water_surface_calm",
            underwaterMaterial = "water_surface_underwater",
          },
        },
        placement = "floor",
        editorIcon = 264,
    }
the problem is curently that if you use this inside dungeon, water surface is black. seems like some problems with shaders... Doridion was investigating it, perhpas he will find yout some solution. As for outdoor areas, its working ok. Hope it helped you a little.
I noticed that this code only seems to change where the water appears to be, you will still technically be underwater as soon as you step over it (rather than falling into it) as the "WaterSurface" is still set to 0. Hopefully, there is a way to offset the "WaterSurface", I tried myself but it said it did not support offset. :(
minmay
Posts: 2789
Joined: Mon Sep 23, 2013 2:24 am

Re: fill a dungeon dug out with water?

Post by minmay »

Mentok wrote:
Drakkan wrote:actually it is possible... :)

Code: Select all

    defineObject{
        name = "user_water_surface",
        base_object = "water_surface",
        components = {
            {
            class = "WaterSurface",
            fogColor = vec(0.021,0.045,0.13,0),
            fogDensity = 0.2,
            planeY = -0.4,
            reflectionColor = vec(0.693,0.81,0.9,0),
            refractionColor = vec(1,1,1,0),
            },
            {
            class = "WaterSurfaceMesh",
          -- There you'll have to modify the Y offset to up/down the water level
          offset = vec(0,0,0,0),
            material = "water_surface_calm",
            underwaterMaterial = "water_surface_underwater",
          },
        },
        placement = "floor",
        editorIcon = 264,
    }
the problem is curently that if you use this inside dungeon, water surface is black. seems like some problems with shaders... Doridion was investigating it, perhpas he will find yout some solution. As for outdoor areas, its working ok. Hope it helped you a little.
I noticed that this code only seems to change where the water appears to be, you will still technically be underwater as soon as you step over it (rather than falling into it) as the "WaterSurface" is still set to 0. Hopefully, there is a way to offset the "WaterSurface", I tried myself but it said it did not support offset. :(
I think both of you are encountering a similar problem.
black surface: I believe water reflection/refraction is not updated if no underwater tiles are visible.
"only seems to change where the water appears to be" - that's because handling the appearance of water is all that WaterSurfaceComponent and WaterSurfaceMeshComponent do. I believe that whether the party is underwater does not depend on any of that, it simply depends on whether or not they are in an underwater tile.
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
Mentok
Posts: 5
Joined: Sat Dec 27, 2014 6:34 am

Re: fill a dungeon dug out with water?

Post by Mentok »

In an underwater tile and above elevation 0. I do hope someone figures how to change that. I just went ahead and pulled the water from a couple levels I had. I guess nobody has figured out how to change the elevation you spawn in the level below after falling down a pit either... These two things are really my only two irritations with what is otherwise a fantastic editor. :?
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: fill a dungeon dug out with water?

Post by Granamir »

Mentok wrote:In an underwater tile and above elevation 0. I do hope someone figures how to change that. I just went ahead and pulled the water from a couple levels I had. I guess nobody has figured out how to change the elevation you spawn in the level below after falling down a pit either... These two things are really my only two irritations with what is otherwise a fantastic editor. :?
1st question: i guess is not possible unless we discover which variable tell u'r underwater and where it is ...and obviously can overwrite it
2nd question: if i remember well from skugg videos u just need to set height of level where u'r fallinig (top lef window, where level names and positions are)


btw i did some try changing height of water using setWorldPositionY() with no good results, but still results
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: fill a dungeon dug out with water?

Post by Isaac »

Mentok wrote:In an underwater tile and above elevation 0. I do hope someone figures how to change that. I just went ahead and pulled the water from a couple levels I had. I guess nobody has figured out how to change the elevation you spawn in the level below after falling down a pit either... These two things are really my only two irritations with what is otherwise a fantastic editor. :?
The water surface [model] can be moved easy enough; certainly raised or lowered within the cell... but when the party is below elevation 0, the engine assumes they are below the water level, and the refractions appear on the underside of the surface [looking up]. This happens even if the party is above the [user-altered] water level; from above, the water appears as transparent black with no highlights.

*But for the starting location issue... :)
Add this to a script object on the initial map where the game starts.

Code: Select all

delayedCall(self.go.id, 0.001, "placeParty")
function placeParty()
   party:setPosition(party.x,party.y,party.facing,-7, party.level)
end  
Note: Setting the elevation below floor level is handled by the engine, but setting it above the ceiling can spawn the party in the void.
Post Reply