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!
minmay
Posts: 2656
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay » Sat Jul 23, 2016 6:35 am

Here is the Grimrock 1 Mega Pack implementation of the tentacles in its entirety:

Code: Select all

import "assets/scripts/monsters/tentacles.lua"
defineObject{
	name = "tentacles",
	baseObject = "tentacles",
	components = {
		{
			class = "Animation",
			animations = {
				idle = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_idle.fbx",
				turnLeft = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_turn_left.fbx",
				turnRight = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_turn_right.fbx",
				hide = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_hide.fbx",
				reveal = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_raise.fbx",
				attack = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_attack.fbx",
				attackBack = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_attack_back.fbx",
				attackLeft = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_attack_left.fbx",
				attackRight = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_attack_right.fbx",
				getHitFrontLeft = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_get_hit_front_left.fbx",
				getHitFrontRight = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_get_hit_front_right.fbx",
				getHitBack = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_get_hit_front_left.fbx",
				getHitLeft = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_get_hit_front_right.fbx",
				getHitRight = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_get_hit_front_left.fbx",
				fall = "assets/animations/monsters/drainage_tentacles/drainage_tentacles_get_hit_front_left.fbx",
			},
			currentLevelOnly = true,
		},
	}
}
defineMaterial{
	name = "drainage_tentacles",
	diffuseMap = "assets/textures/monsters/drain_tentacles_dif.tga",
	specularMap = "assets/textures/monsters/drain_tentacles_spec.tga",
	normalMap = "assets/textures/monsters/drain_tentacles_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 35,
	depthBias = 0,
}
The one in the standard assets simply has the wrong filename for one of the animations. Everything else about them works fine afaik.
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
Isaac
Posts: 2949
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Sat Jul 23, 2016 7:22 am

That works great!
Now we need a suitable floor grill. Nothing I know of in the assets works decently with the tentacle monster. The closest being the castle_bridge_grating asset; but that clips badly, and fire-pit model clips far worse.

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 » Sat Jul 23, 2016 10:30 am

Isaac wrote:That works great!
Now we need a suitable floor grill. Nothing I know of in the assets works decently with the tentacle monster. The closest being the castle_bridge_grating asset; but that clips badly, and fire-pit model clips far worse.
You can add a particle effect for when they reveal themselves from ground tiles, kinda like the Viper Root.
I'm also using them on top of lava pools, and plan on adding them into murky pools of water. (Don't forget turning their gravity off if you do too)
My asset pack [v1.10]
Features a bit of everything! :D

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 » Sat Jul 23, 2016 2:10 pm

Why every time I export a model the textures are on the inside of a model, and how do I fix this without defining a new double sided material?
Here's what I mean: (ignore the mapping please)
SpoilerShow
Image
My asset pack [v1.10]
Features a bit of everything! :D

User avatar
Isaac
Posts: 2949
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Sat Jul 23, 2016 3:24 pm

It looks like the normals are flipped. If that's what it is, this is fixable in the 3D software [Blender/Max...]. Actually GMT will recalculate a model's normals, but John said it was pretty basic, and probably not as good.
If it looks correct in the 3D editor, then it might be your exporter; check the settings.

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 » Sat Jul 23, 2016 7:10 pm

Isaac wrote:It looks like the normals are flipped. If that's what it is, this is fixable in the 3D software [Blender/Max...]. Actually GMT will recalculate a model's normals, but John said it was pretty basic, and probably not as good.
If it looks correct in the 3D editor, then it might be your exporter; check the settings.
Flipped normals in Blender, textures were covered in black in most areas.
Flipped normals again but in GMT, did the trick.
wat :?
My asset pack [v1.10]
Features a bit of everything! :D

User avatar
Eleven Warrior
Posts: 726
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior » Tue Aug 02, 2016 11:01 am

Thxs Minmay for the Tentacles fix :)

Killcannon
Posts: 72
Joined: Sun Apr 12, 2015 2:57 pm

Re: Ask a simple question, get a simple answer

Post by Killcannon » Wed Aug 03, 2016 9:14 am

So this is probably dumb and the answer is already here on the forums and I'm just not finding the right keywords to pull it up.

I have a pushing block puzzle that also has the Castle Portcullis in it. The idea being you push a block over the trigger. The trigger locks down the door and keeps the block in place. I'm trying to use the portcullis as a blocker in a small room as a catalyst to make the player think about where which blocks go and force a block once used from being reused. (The trigger deals damage to a monster.) Except that because the pushable block floor is active you can simply push the block through the closed door. I.E. the block does not detect the door is down and will clip right through it. You can even push a block that is behind a closed portcullis door and it'll slide right through.

Is there any way to get the collision on these things to detect each other and not do this?

Edit: Spend some more time today on this and I figured out a simplistic work around. It's not elegant, and has other issues but it works.

My solution was to put a blocker on the other side of the gate that is active when the gate is closed and not active when it's open. Rather a pain in the butt way of doing it and if the party approaches the blocker from the other side it'll be an invisible wall that they cannot pass; but it's far better than trying to figure out a way to give the door itself the obstacle trait that is active only when the door is closed and is integrated with the door opening and closing.

User avatar
Isaac
Posts: 2949
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Fri Aug 05, 2016 10:45 am

Killcannon wrote:I'm trying to use the portcullis as a blocker in a small room as a catalyst to make the player think about where which blocks go and force a block once used from being reused. (The trigger deals damage to a monster.) Except that because the pushable block floor is active you can simply push the block through the closed door. I.E. the block does not detect the door is down and will clip right through it. You can even push a block that is behind a closed portcullis door and it'll slide right through.
This has been the way of it since the initial release. My first LoG2 map had a block puzzle that had closed doors in the path, and it suffered the same issue with the blocks just passing right through them. :cry:
My solution was to re-define the blocks, and include logic to force the blocks to behave around closed doors.

To use this: Remove the blockers you mentioned, and add just this definition to your object.lua file; it will replace the standard push_block with my new one. See if it works as intended in your puzzle.
I've tested it out with several door layouts, and it appears to work fine with them, but it is still experimental.

Code: Select all

defineObject{
	name = "pushable_block",
	baseObject = "pushable_block",
	components = {
{
			class = "Clickable",
			name = "clickNorth",
			offset = vec(0, 1.15, 1.2),
			size = vec(1.2, 1.2, 0.1),
			maxDistance = 1,
			--debugDraw = true,
			onClick = function(self)
				self.go.clicked:push()
			end,
		},
		{
			class = "Clickable",
			name = "clickEast",
			offset = vec(1.2, 1.15, 0),
			size = vec(0.1, 1.2, 1.2),
			maxDistance = 1,
			--debugDraw = true,
			onClick = function(self)
				self.go.clicked:push()
			end,
		},
		{
			class = "Clickable",
			name = "clickSouth",
			offset = vec(0, 1.15, -1.2),
			size = vec(1.2, 1.2, 0.1),
			maxDistance = 1,
			--debugDraw = true,
			onClick = function(self)
				self.go.clicked:push()
			end,
		},
		{
			class = "Clickable",
			name = "clickWest",
			offset = vec(-1.2, 1.15, 0),
			size = vec(0.1, 1.2, 1.2),
			maxDistance = 1,
			--debugDraw = true,
			onClick = function(self)
				self.go.clicked:push()
			end,
			onInit = function(self) 
				self.go.clicked:setSource([[
						previousState = nil
						function push()
								local block = false
								local dX,dY = getForward(party.facing)
								for x = 1,2 do 								--scan [2] cells in front of the party, looking for the two doors that (if present) could block the path
									local cell = {{self.go.x,self.go.y},{self.go.x+dX,self.go.y+dY}} 
									for object in party.map:entitiesAt(unpack(cell[x])) do 
										if x == 2 and object.name == "pushable_block" then  -- exit if adjacent block detected
											self.go.pushableblock:push(party.facing)
											return	
										end
										
										if x == 1 and object.door and object.door:isClosed() and object.facing == party.facing then	
											block = true
										end	
										if x == 2 and object.door and object.door:isClosed() and object.facing == (party.facing+2)%4 then	
											block = true
										end
									end
								end

								if block then
									blockCell(self.go.x+dX, self.go.y+dY)		
								end	
							self.go.pushableblock:push(party.facing)							
						end	

						function blockCell(X,Y)
							for floor in party.map:entitiesAt(X, Y) do
											if floor.name:match("pushable_block_floor") then
												previousState =  iff(floor.light:isEnabled(),"activate","deactivate")
												floor.controller:deactivate()
												floor.particle:enable()
												floor.light:enable()
												delayedCall(floor.id,.01, previousState)
											end
							end
						end								
					]])
			end,
		},
		{
			class = "Script",
			name = "clicked",
		},
	},
}

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 » Fri Aug 05, 2016 4:48 pm

How do I prevent/fix meshes getting deformed when importing an animation onto a model in Blender?
- or -
Is there a way to scale animations without going through Blender?
Tried doing it through the Grimrock Model Toolkit, but it either tells me I don't have a suitable reader, or spews an infinite spam of "out of memory" kind of errors if the animation doesn't go through Blender. Only way I got it to accept animations was by importing a model + animation, exporting as .FBX, then importing it into the toolkit.
My asset pack [v1.10]
Features a bit of everything! :D

Post Reply