Shadowgate 2014 "Inspired" (Resource Pack)

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
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by THOM »

vanblam wrote: Wed Apr 24, 2019 4:50 pm I did have one little problem with it tho (honestly not that big a deal). But when you "place" the keys in the slot it automatically places them from the order I have the sockets listed in the object definition, so you can't place them in any slot you want until you fill them all.
Mh - maybe the clickable zone is too big? Or do it already just cover one of your slots?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by minmay »

vanblam wrote: Wed Apr 24, 2019 4:50 pmI did have one little problem with it tho (honestly not that big a deal). But when you "place" the keys in the slot it automatically places them from the order I have the sockets listed in the object definition, so you can't place them in any slot you want until you fill them all.
Here's how to make multiple sockets on one object work properly:

Code: Select all

-- 1. The game has no way of knowing which ClickableComponent corresponds to
-- which SocketComponent. Well, that's easy, just use a temporary variable and
-- SocketComponent.onAcceptItem. No, this can't cause any savegame issues (the
-- player cannot possibly save with the temporary variable being extant). We
-- stuff it in GameMode because we don't want to make the modder place extra
-- script entities or whatever...
--
-- 2. If your mouse click hits a ClickableComponent before it hits an item, it
-- won't pick up the item, meaning the gems get stuck in the sockets by default.
-- Well, that's also easy; disable the ClickableComponents when the gem goes in,
-- and enable them again when it gets taken out.
--
-- 3. (what the hell) When the player picks up an item from a SocketComponent,
-- the onRemoveItem hooks for ALL SocketComponents on that SocketComponent's
-- parent GameObject get called. So we...check if the socket is actually empty
-- when the item gets taken out, and check if the ClickableComponent was
-- actually disabled when the item gets taken out. If either one is false, we
-- return false - this is necessary because it prevents the connector from
-- triggering (removing from the left eye shouldn't trigger onRemoveItem
-- connectors on the right eye).
--
-- Note: the onRemoveItem hook also gets called if the socket's item is
-- destroyed, so it's perfectly fine to destroy gems that are in the sockets
-- without removing them first.
defineObject{
	name = "g1_daemon_head_eye_slots",
	baseObject = "base_wall_decoration",
	components = {
		{
			class = "Model",
			model = "assets/models/env/demon_head_puzzle.fbx",
			staticShadow = true,
			material = "g1_daemon_head",
		},
		{
			class = "Socket",
			name = "leftEye",
			offset = vec(0.21,1.58,-0.45),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 1 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("gem") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.leftClick:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.leftClick:isEnabled() then self.go.leftClick:enable() else return false end end,
		},
		{
			class = "Socket",
			name = "rightEye",
			offset = vec(-0.21,1.58,-0.45),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 2 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("gem") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.rightClick:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.rightClick:isEnabled() then self.go.rightClick:enable() else return false end end,
		},
		{
			class = "Socket",
			name = "mouth",
			offset = vec(0,1.1,-0.38),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 3 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("gem") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem")) then
						self.go.mouthClick:disable()
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.mouthClick:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.mouthClick:isEnabled() then self.go.mouthClick:enable() else return false end end,
		},
		{
			class = "Clickable",
			name = "leftClick",
			offset = vec(0.21,1.63,-0.45),
			size = vec(0.15, 0.15, 0.15),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 1 end
			end,
		},
		{
			class = "Clickable",
			name = "rightClick",
			offset = vec(-0.21,1.63,-0.45),
			size = vec(0.15, 0.15, 0.15),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 2 end
			end,
		},
		{
			class = "Clickable",
			name = "mouthClick",
			offset = vec(0,1.15,-0.38),
			size = vec(0.25, 0.25, 0.25),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 3 end
			end,
		},
	},
	editorIcon = 92,
}
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
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by vanblam »

minmay wrote: Wed Apr 24, 2019 8:35 pm
vanblam wrote: Wed Apr 24, 2019 4:50 pmI did have one little problem with it tho (honestly not that big a deal). But when you "place" the keys in the slot it automatically places them from the order I have the sockets listed in the object definition, so you can't place them in any slot you want until you fill them all.
Here's how to make multiple sockets on one object work properly:

Code: Select all

-- 1. The game has no way of knowing which ClickableComponent corresponds to
-- which SocketComponent. Well, that's easy, just use a temporary variable and
-- SocketComponent.onAcceptItem. No, this can't cause any savegame issues (the
-- player cannot possibly save with the temporary variable being extant). We
-- stuff it in GameMode because we don't want to make the modder place extra
-- script entities or whatever...
--
-- 2. If your mouse click hits a ClickableComponent before it hits an item, it
-- won't pick up the item, meaning the gems get stuck in the sockets by default.
-- Well, that's also easy; disable the ClickableComponents when the gem goes in,
-- and enable them again when it gets taken out.
--
-- 3. (what the hell) When the player picks up an item from a SocketComponent,
-- the onRemoveItem hooks for ALL SocketComponents on that SocketComponent's
-- parent GameObject get called. So we...check if the socket is actually empty
-- when the item gets taken out, and check if the ClickableComponent was
-- actually disabled when the item gets taken out. If either one is false, we
-- return false - this is necessary because it prevents the connector from
-- triggering (removing from the left eye shouldn't trigger onRemoveItem
-- connectors on the right eye).
--
-- Note: the onRemoveItem hook also gets called if the socket's item is
-- destroyed, so it's perfectly fine to destroy gems that are in the sockets
-- without removing them first.
defineObject{
	name = "g1_daemon_head_eye_slots",
	baseObject = "base_wall_decoration",
	components = {
		{
			class = "Model",
			model = "assets/models/env/demon_head_puzzle.fbx",
			staticShadow = true,
			material = "g1_daemon_head",
		},
		{
			class = "Socket",
			name = "leftEye",
			offset = vec(0.21,1.58,-0.45),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 1 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("gem") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.leftClick:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.leftClick:isEnabled() then self.go.leftClick:enable() else return false end end,
		},
		{
			class = "Socket",
			name = "rightEye",
			offset = vec(-0.21,1.58,-0.45),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 2 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("gem") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.rightClick:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.rightClick:isEnabled() then self.go.rightClick:enable() else return false end end,
		},
		{
			class = "Socket",
			name = "mouth",
			offset = vec(0,1.1,-0.38),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 3 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("gem") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem")) then
						self.go.mouthClick:disable()
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.mouthClick:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.mouthClick:isEnabled() then self.go.mouthClick:enable() else return false end end,
		},
		{
			class = "Clickable",
			name = "leftClick",
			offset = vec(0.21,1.63,-0.45),
			size = vec(0.15, 0.15, 0.15),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 1 end
			end,
		},
		{
			class = "Clickable",
			name = "rightClick",
			offset = vec(-0.21,1.63,-0.45),
			size = vec(0.15, 0.15, 0.15),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 2 end
			end,
		},
		{
			class = "Clickable",
			name = "mouthClick",
			offset = vec(0,1.15,-0.38),
			size = vec(0.25, 0.25, 0.25),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 3 end
			end,
		},
	},
	editorIcon = 92,
}
Thanks for this. But so far with the set up I have from using this script I can't get the keys to go into the socket. I have the keys set up with the trait "crystal_key". But I'm sure there is something I'm doing wrong :P. Here is my set up on it. But because I use the chest component it must have a surface component in there somewhere or it doesn't work. Not sure if that effects the script in any way tho.

Code: Select all

defineObject{
	name = "rc_puz_pedestal_01",
	baseObject = "base_obstacle",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/env/rc_puz_pedestal_01.fbx",
			staticShadow = true,
		},
		{
			class = "Animation",
			animations = {
				open = "assets/animations/env/treasure_chest_open.fbx",
				close = "assets/animations/env/treasure_chest_close.fbx",
			},
			onAnimationEvent = function(self, event)
			if event == "open" then
			playSound ("gen_body_motion")
			self.go.controller:open()
			elseif event == "close" then
			playSound ("gen_body_motion")
			self.go.controller:close()
				end
			end,
			playOnInit = "close",
		},
		{
			class = "Socket",
			name = "socket_top_right",
			offset = vec(-0.23, 0.98, 0.10),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 1 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_tr:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_tr:isEnabled() then self.go.click_tr:enable() else return false end end,
			debugDraw = false,
		},
		{
			class = "Socket",
			name = "socket_top_middle",
			offset = vec(-0.02, 0.98, 0.10),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 2 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_tm:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_tm:isEnabled() then self.go.click_tm:enable() else return false end end,
			debugDraw = false,
		},
		{
			class = "Socket",
			name = "socket_top_left",
			offset = vec(0.21, 0.98, 0.10),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 3 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_tl:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_tl:isEnabled() then self.go.click_tl:enable() else return false end end,
			debugDraw = false,
		},	
		{
			class = "Socket",
			name = "socket_mid_left",
			offset = vec(0.21, 0.88, 0.39),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 4 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_ml:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_ml:isEnabled() then self.go.click_ml:enable() else return false end end,
			debugDraw = false,
		},
{
			class = "Socket",
			name = "socket_mid",
			offset = vec(-0.02, 0.88, 0.39),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 5 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_m:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_m:isEnabled() then self.go.click_m:enable() else return false end end,
			debugDraw = false,
		},						
{
			class = "Socket",
			name = "socket_mid_right",
			offset = vec(-0.23, 0.88, 0.39),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 6 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_mr:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_mr:isEnabled() then self.go.click_mr:enable() else return false end end,
			debugDraw = false,
		},
		{
			class = "Socket",
			name = "socket_bot_left",
			offset = vec(0.21, 0.78, 0.69),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 7 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_bl:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_bl:isEnabled() then self.go.click_bl:enable() else return false end end,
			debugDraw = false,
		},
{
			class = "Socket",
			name = "socket_bot_mid",
			offset = vec(-0.02, 0.78, 0.69),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 8 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_bm:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_bm:isEnabled() then self.go.click_bm:enable() else return false end end,
			debugDraw = false,
		},						
{
			class = "Socket",
			name = "socket_bot_right",
			offset = vec(-0.23, 0.78, 0.69),
			rotation = vec(-100, 0,0),
			onAcceptItem = function(self,item)
				if GameMode.g1_tempSurface == 9 then
					GameMode.g1_tempSurface = nil
					if self:count() == 0 and item:hasTrait("crystal_key") and not (item:hasTrait("yig_gem") or item:hasTrait("dm_gem") or item:hasTrait("gem")) then
						return true
					end
				end
				return false
			end,
			onInsertItem = function(self,item) self.go.click_br:disable() end,
			onRemoveItem = function(self,item) if self:isEnabled() and self:count() == 0 and not self.go.click_br:isEnabled() then self.go.click_br:enable() else return false end end,
			debugDraw = false,
		},
		{
			class = "Clickable",
			name = "click_tr",
			offset = vec(-0.22, 0.98, 0.18),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 1 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_tm",
			offset = vec(0, 0.98, 0.18),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 2 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_tl",
			offset = vec(0.22, 0.98, 0.18),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 3 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_ml",
			offset = vec(-0.22, 0.88, 0.47),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 4 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_m",
			offset = vec(0, 0.88, 0.47),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 5 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_mr",
			offset = vec(0.22, 0.88, 0.47),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 6 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_bl",
			offset = vec(-0.22, 0.78, 0.76),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 7 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_bm",
			offset = vec(0, 0.78, 0.76),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 8 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "click_br",
			offset = vec(0.22, 0.78, 0.76),
			size = vec(0.12, 0.12, 0.12),
			onClick = function(self)
				if getMouseItem() then GameMode.g1_tempSurface = 9 end
			end,
			debugDraw = true,
		},
		{
			class = "Clickable",
			name = "chest_move",
			offset = vec(0,0.4,0.45),
			size = vec(0.9, 0.4, 0.9),
			maxDistance = 1,
			debugDraw = true,
		},		
		{
			class = "Chest",
		},
		{
			class = "Surface",
			offset = vec(0,1,0),
			size = vec(0,0,0),
			debugDraw = true,
			onAcceptItem = function(self, item)
				return (item.go.name == "island_map") and self:count() == 0
			end,
			debugDraw = false,
		},
		{
			class = "Controller",
			onOpen = function(self)
				self.go.controller:activate()
			end,
			onClose = function(self)
				self.go.controller:deactivate()
			end,
		},
	},
	editorIcon = 8,
	tags = { "shadowgate", "red cave", "vanblam", "puzzel" },
}
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by minmay »

The SurfaceComponent shouldn't mess anything up as long as you always return false from its onAcceptItem hook.

It would be a lot easier to figure out why the crystal keys won't go in if you would share the definition for the crystal keys...
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
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by vanblam »

minmay wrote: Thu Apr 25, 2019 9:10 am The SurfaceComponent shouldn't mess anything up as long as you always return false from its onAcceptItem hook.

It would be a lot easier to figure out why the crystal keys won't go in if you would share the definition for the crystal keys...
Opps I was going to post that and forgot O.o

Code: Select all

defineObject{
	name = "rc_crystal_key_blue",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/items/rc_crystal_key_01.fbx",
		},
		{
			class = "Item",
			uiName = "Arcane Crystal Key",
			gfxAtlas = "mod_assets/stotp_textures/red_cave/gui/rc_icons_grid_01.tga",
			gfxIndex = 0,
			gfxIndexContainer = 0,
			weight = 2.0,
			traits = { "crystal_key" },
		},
		-- {
			-- class = "Particle",
			-- particleSystem = "glitter_gold",
		-- },
	},
	tags = { "shadowgate", "red cave", "vanblam", "key" },
}

defineObject{
	name = "rc_crystal_key_red",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/items/rc_crystal_key_01.fbx",
			materialOverrides = {["rc_crystal_key_blue"] = "rc_crystal_key_red"},
		},
		{
			class = "Item",
			uiName = "Blood Crystal Key",
			gfxAtlas = "mod_assets/stotp_textures/red_cave/gui/rc_icons_grid_01.tga",
			gfxIndex = 1,
			gfxIndexContainer = 0,
			weight = 2.0,
			traits = { "crystal_key" },
		},
		
		-- {
			-- class = "Particle",
			-- particleSystem = "glitter_gold",
		-- },
	},
	tags = { "shadowgate", "red cave", "vanblam", "key" },
}

defineObject{
	name = "rc_crystal_key_green",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/items/rc_crystal_key_01.fbx",
			materialOverrides = {["rc_crystal_key_blue"] = "rc_crystal_key_green"},
		},
		{
			class = "Item",
			uiName = "Orge Crystal Key",
			gfxAtlas = "mod_assets/stotp_textures/red_cave/gui/rc_icons_grid_01.tga",
			gfxIndex = 2,
			gfxIndexContainer = 0,
			weight = 2.0,
			traits = { "crystal_key" },
		},
		
		-- {
			-- class = "Particle",
			-- particleSystem = "glitter_gold",
		-- },
	},
	tags = { "shadowgate", "red cave", "vanblam", "key" },
}

defineObject{
	name = "rc_crystal_key_yellow",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/items/rc_crystal_key_01.fbx",
			materialOverrides = {["rc_crystal_key_blue"] = "rc_crystal_key_yellow"},
		},
		{
			class = "Item",
			uiName = "Solar Crystal Key",
			gfxAtlas = "mod_assets/stotp_textures/red_cave/gui/rc_icons_grid_01.tga",
			gfxIndex = 3,
			gfxIndexContainer = 0,
			weight = 2.0,
			traits = { "crystal_key" },
		},
		
		-- {
			-- class = "Particle",
			-- particleSystem = "glitter_gold",
		-- },
	},
	tags = { "shadowgate", "red cave", "vanblam", "key" },
}

defineObject{
	name = "rc_crystal_key_purple",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/items/rc_crystal_key_01.fbx",
			materialOverrides = {["rc_crystal_key_blue"] = "rc_crystal_key_purple"},
		},
		{
			class = "Item",
			uiName = "Shadow Crystal Key",
			gfxAtlas = "mod_assets/stotp_textures/red_cave/gui/rc_icons_grid_01.tga",
			gfxIndex = 4,
			gfxIndexContainer = 0,
			weight = 2.0,
			traits = { "crystal_key" },
		},
		
		-- {
			-- class = "Particle",
			-- particleSystem = "glitter_gold",
		-- },
	},
	tags = { "shadowgate", "red cave", "vanblam", "key" },
}

defineObject{
	name = "rc_crystal_key_black",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/items/rc_crystal_key_01.fbx",
			materialOverrides = {["rc_crystal_key_blue"] = "rc_crystal_key_black"},
		},
		{
			class = "Item",
			uiName = "Vile Crystal Key",
			gfxAtlas = "mod_assets/stotp_textures/red_cave/gui/rc_icons_grid_01.tga",
			gfxIndex = 5,
			gfxIndexContainer = 0,
			weight = 2.0,
			traits = { "crystal_key" },
		},
		
		-- {
			-- class = "Particle",
			-- particleSystem = "glitter_gold",
		-- },
	},
	tags = { "shadowgate", "red cave", "vanblam", "key" },
}

defineObject{
	name = "rc_crystal_key_white",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/stotp_models/red_cave/items/rc_crystal_key_01.fbx",
			materialOverrides = {["rc_crystal_key_blue"] = "rc_crystal_key_white"},
		},
		{
			class = "Item",
			uiName = "Holy Crystal Key",
			gfxAtlas = "mod_assets/stotp_textures/red_cave/gui/rc_icons_grid_01.tga",
			gfxIndex = 6,
			gfxIndexContainer = 0,
			weight = 2.0,
			traits = { "crystal_key" },
		},
		
		-- {
			-- class = "Particle",
			-- particleSystem = "glitter_gold",
		-- },
	},
	tags = { "shadowgate", "red cave", "vanblam", "key" },
}
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by minmay »

Ok, thanks, the problem isn't the keys. I think there are two issues here:
1. the clickables for the sockets need to have maxDistance = 1, since the party isn't on the same square as the object.
2. the chest_move clickable is probably getting in the way of the other clickables. Try using the onAnimationEvent hook to disable it while the "chest" is open.
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
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by vanblam »

minmay wrote: Thu Apr 25, 2019 6:47 pm Ok, thanks, the problem isn't the keys. I think there are two issues here:
1. the clickables for the sockets need to have maxDistance = 1, since the party isn't on the same square as the object.
2. the chest_move clickable is probably getting in the way of the other clickables. Try using the onAnimationEvent hook to disable it while the "chest" is open.
Hell yea.. that did the trick. Thank you so much :D.
My OCD is now satisfied haha.
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by vanblam »

Little update:

1. Added a custom button and lever. Because of minmays change to the blender model exporter, creating custom animations was a piece of cake, so thank you so much for that minmay :D

You can get his modified exporter here: minmays local version of bitcpy's Blender plugin

2. Changed a pillar to accommodate one of the door frames, so the level feels more uniformed.

Image

Image

Image
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by vanblam »

Another update:

Added a unique pull switch that is animated :) There is a video link at the bottom.

Image

Video Here!

Only thing I need to do to it is have it disable the clickable on activation. Then I need to set a delay for the intended target (so the door or what ever your targeting doesn't open before the switch does its thing :P).
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Shadowgate 2014 "Inspired" (Resource Pack)

Post by vanblam »

I decided to add some chests :P. 5 chests of the same type with different colors and 3 other chests with 3 different colors.

Image

Image

Image

Image

Image
Post Reply