[DONE]: Working treasure chests - v1.4

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: WIP: Working treasure chests

Post by montagneyaya »

You can add an invisible altar like this

Code: Select all

defineObject{
	name = "xan_invisiblealtar",
	class = "Altar",
	model = "mod_assets/chest/null.fbx",
	placement = "floor",
	editorIcon = 52,
}
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: WIP: Working treasure chests

Post by montagneyaya »

For some reason I would use the chest based on the pressure plate, not on the pit.
I edit the file like this

Code: Select all

defineObject{
	name = "party",
	class = "Party",
	onPickUpItem  = function(party,item)
		if item.name == "open_chest" then
			return false
		else
			return true
		end
	end,
	editorIcon = 32,
}

defineObject{
	name = "open_chest",
	class = "Item",
	uiName = "Open Chest",
	model = "mod_assets/chest/null.fbx",
	slot = "Neck",
	gfxIndex = 219,
	weight = 0.4,
}

defineObject{
	name = "xan_chest",
	class = "PressurePlate",
	model = "mod_assets/chest/chest.fbx",
	activateAnim = "mod_assets/chest/chestopen.fbx",
	deactivateAnim = "mod_assets/chest/chestclose.fbx",
	placement = "floor",
	editorIcon = 0,
}

defineObject{
	name = "xan_chest2",
	class = "Button",
	model = "mod_assets/chest/chestbtn.fbx",
	pressAnim = "mod_assets/chest/chestclose.fbx",
	placement = "wall",
	editorIcon = 12,
}

defineObject{
	name = "xan_invisibleblocker",
	class = "Blockage",
	model = "mod_assets/chest/null.fbx",
	brokenModel = "mod_assets/chest/null.fbx",
	placement = "floor",
	health = 999999999,
	evasion = 999999999,
	hitSound = "barrel_hit",
	hitEffect = "hit_wood",
	editorIcon = 56,
	repelProjectiles = true,
	onDamage = function(p1, p2)
		return false
	end,
	onProjectileHit = function(p1, p2, p3, p4)
		return false
	end,
	onDie = function(p1)
		return false
	end,
}

defineObject{
	name = "xan_invisiblealtar",
	class = "Altar",
	model = "mod_assets/chest/null.fbx",
	placement = "floor",
	editorIcon = 52,
}

defineMaterial{
	name = "mtl_chest",
	diffuseMap = "mod_assets/chest/chest.tga",
	specularMap = "mod_assets/chest/chest.tga",
	normalMap = "mod_assets/chest/chest.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 40,
	depthBias = 0,
}


defineMaterial{
	name = "mtl_null",
	diffuseMap = "mod_assets/chest/null.tga",
	specularMap = "mod_assets/chest/null.tga",
	normalMap = "mod_assets/chest/null.tga",
	doubleSided = false,
	lighting = false,
	alphaTest = true,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 40,
	depthBias = 0,
}
and the lua script like this

Code: Select all

g_ChestCount = 0
g_ChestItems = {"scroll_light", "boiled_beetle", "blue_gem" }


function toggle()
	if (g_ChestCount == 0) then
		g_ChestCount = 1
		spawn ("open_chest",1,16,12,2,"open_chest_1")
	elseif (g_ChestCount >= 1 and g_ChestCount <= #g_ChestItems) then
		setMouseItem(spawn(g_ChestItems[g_ChestCount]))
		g_ChestCount = g_ChestCount + 1
	else
		if xan_chest_1:isDown() then
			open_chest_1:destroy()
		elseif xan_chest_1:isUp() then
			spawn ("open_chest",1,16,12,2,"open_chest_1")
			hudPrint("The chest is empty.")
		end
	end
end
But the chest becomes invisible when I open it and it stays invisible.
Problem with the activateAnim and deactivateAnim ?

edit : There are a problem with the chest display, the chest is always turn south and the lock is always turn west

Image
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: WIP: Working treasure chests

Post by Neikun »

Merethif wrote:I've just tested the chest and it looks really good so far. The invisible blocker works a bit strange though. I understand the need of bouncing thrown items if chest is placed in dead-end tunnel, but when placed in the centre of the room this item blocking looks awkward. Especially since you can shoot/throw items over the regular altars.
I was wondering if it wouldn't be easier to turn a chest into a sort of "wall mounted" container using the model of Goromog statues prop with removed statue and a chest placed instead (the chest would fit it really nicely I suppose).
You could make it look sensible if you attach the model to something like a dragon statue base :3
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: WIP: Working treasure chests

Post by Xanathar »

What a day - been at Ikea and Decathlon the whole day and now my body feels like a slime :lol:

@montagneyaya : I'll try your pressure plate solution asap. As per the lock and orienting things, the model file has wrong transformations in nodes, I left it as that as it didn't matter in the pit solution (the transformations in the animation files took precedence) but can be fixed in GMT.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: WIP: Working treasure chests

Post by Xanathar »

I've put an updated version with these fixes/changes: https://www.dropbox.com/s/mzcad88bp506j ... Chests.zip
  • Works if you throw a key or very small item
  • "Nice" sound
  • Trapped and locked versions
The problem of the bouncing items if you put a chest in the middle of a room remains - I don't know how to do otherwise since we must avoid items to land in the chest tile which at times is an open pit!

Tomorrow I'll try the pressure plate solution, but doesn't seem easy at first sight.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
LordYig
Posts: 175
Joined: Wed Jul 04, 2012 5:45 pm

Re: WIP: Working treasure chests

Post by LordYig »

First very nice chest ! This can be usefull in any dungeon.
montagneyaya wrote:For some reason I would use the chest based on the pressure plate, not on the pit.
Xanathar wrote:Tomorrow I'll try the pressure plate solution, but doesn't seem easy at first sight.
I have tried the pressure plate solution for a similar attempt to animate objects and it does not work properly for what i'm trying to achieve.

I have tried to animate a custom trap with spikes coming out of the floor.
While my custom 30 frames animation is working properly with a pit, the pressure plate only display the animation for a very brief second or less. I don't know if this is because I have done something wrong or if this is by design.

You can try it with the chest but if I'm not mistaken it would result in a very fast opening chest !
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: WIP: Working treasure chests

Post by montagneyaya »

Apparently, there is no animation and no facing for pressure plate.

The animation of pressure plate is only on frame 0 up or down.
And if I change the facing, the chest change not facing (default facing is north).

This is apparently not possible with pressure plate.
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: WIP: Working treasure chests

Post by Xanathar »

At this point I would go forward with this solution.
I've already prepared everything, in theory. I've sent a mail to the original model author asking for permission to use the models, as soon as I have it (or not and I redo the model) I will publish it on Nexus Mod and instructions also here and in the CAP.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [RELEASED!]: Working treasure chests

Post by Xanathar »

I have released the chests kit on Nexus:

http://grimrock.nexusmods.com/mods/108/

Includes:
  • Trapped chests
  • Locked chests
  • Mimics
I've received permission from Robin Wood for using her chest model; please anyone using it follow the credits procedure written in the readme.txt file! She was very kind to share the model, let's share the credit :)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [RELEASED!]: Working treasure chests

Post by Xanathar »

Mod updated to version 1.2:
  • Supports breakable chests, Lands-of-Lore style
  • If a chest is broke-open, with a custom chance contained items may break
http://grimrock.nexusmods.com/mods/108/
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
Post Reply