The Ancient's Tomb (WIP Dungeon. No download)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Alino
Posts: 33
Joined: Sun Jan 03, 2016 10:13 pm

The Ancient's Tomb (WIP Dungeon. No download)

Post by Alino »

Image

Greetings all, it's Alino here. I've made a few small test dungeons that I've never fully released before, but now I've decided that I'm going to make one that I think is worthy of submitting here.

The Story
The two of you are explorers, and have set out for an old temple known as 'The Ancient's Tomb'. Inside of it is a rumored statue of the ancient residing within the tomb. Said to be made of solid gold and worth thousands, you two have decided to set forth into the tomb. But, as you entered the tomb, the iron doors slammed shut behind you and were impossible to pry open. A trap? Maybe. A ghost? Possibly. Perhaps you had angered the being residing in the old crypt, but the only thing you could know for certain, was that the two of you would need to keep your wits about you as you venture into the tomb, where you'll receive alot more than you bargained for.

The Characters
There is Nat Rootswood, a young and ambitious explorer that grew up in a city of filth with his lifelong friend, a lizardman known as Slythe 'Redskin' who's an expert swordsman and adept with fire magic. The two of them are who you shall control as you uncover the deadly truth of The Ancient's Tomb.
Image Image

Mods Used
Deep Dungeon - Created By Daniv/Sutekh
Last edited by Alino on Thu Nov 10, 2016 10:44 pm, edited 2 times in total.
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: The Ancient's Tomb (WIP Dungeon. No download)

Post by Isaac »

Alino wrote:1 - How to have dialogue set at moments so I can have the two talk to eachother.
Here is one way to do it:

Code: Select all

-- dialog_script object        


function dialog(id, actors)
	local c = {}			--c.conv_1 c.conv_2 c.conv_3 ...... c.conv_50...
	
	--conversation table. (The "conv_#" names can actually be anything you like; they are manually called.)
	
	c.conv_1 = {	-- Number entries are the intended speaker's given position in the "converse" function's actors array.
					2, "Want hear new recipe "..actors[1].."?",
					1, "What kind?",
					2, "Rat surprise.",
					1, "Sound good. How me make?",
					2, "Catch rat. Careful no squish too much.",
					1, "How no squish? Every time I club them, they pop. Very messy.",
					2, "You want hear recipe or not? Catch rat your problem.",
					1, "Me sorry.",
					2, "Like said, catch rat. Hang by tail on wall.",
					   "Let hang til tail fall off. It ready then. Eat quickly",
					   "if let sit too long, the surprise crawl out and fly away.",
					1, "Sound yummy.",
					3, "That sounds disgusting!",
					0, actors[1].." and "..actors[2].." both scream with fright!"
				}
	-- c.conv_2 = {}
	-- c.conv_3 = {}
	
	--validity test			
	for keys in pairs(c) do
		if keys == id then
			return c[id]
		end
	end	
	
	--default							
	print("Invalid conversation id given to "..self.id, ">>function dialog(id)", "Key does not exist.")
	return "Error: See Console Output"
end

-- counts the existing PCs
function number_of_PCs()
	local count = 0
	for x = 1, 4 do
		if party:getChampion(x):getName() then
			count = count + 1
		end
	end
	return count
end
number_of_PCs = number_of_PCs()

-- accepts ordinal, returns the correct champion
function getChampionByOrdinal(ordinal)
	for x = 1, number_of_PCs do
		if party:getChampion(x):getOrdinal() == ordinal then
			return party:getChampion(x)
		end
	end
end


-- setup delayed calls to displayText()
function delayedHudPrint(text, delay)	
	local ID = "timer"..getStatistic("play_time").."@"..text
	if not findEntity(ID) then
		spawn("timer",party.level,0,0,0, ID):setTimerInterval(delay):addConnector("activate",self.id,"displayText"):addConnector("activate",ID,"destroy"):activate()
	end
end

function converse(id, ...) -- "..." becomes the actors array, and holds either the PC ordinals, or the names of the speakers.
						   -- For specific party positions, or the names of random PC's, you must supply their names. EG. converse( "conv_1", "Jack", "Jill", party:getChampion(4):getName() )					
	local actors = {...}
 
	--process actors
		--convert names & ordinals to id-numbers
	for x = 1, #actors do
		if type(actors[x]) == "number" then 
				actors[x] = getChampionByOrdinal(actors[x]):getName()
		end
	end	
	local dialog = dialog(id, actors)
	local line = 1		

	-- display dialog
	local speaker = ''
	local time_delay = 4 -- Uniform delay (in seconds) between each line of dialog 
	
	for t = 1, #dialog, 2 do
		speaker = string.rep(" ", #speaker)  --once aligned printed console output
		line = t
		if type(dialog[line]) == "number" and dialog[line] >0 and dialog[line] <= #actors then    --Who is speaking; indicated by a number before the dialog
			speaker = actors[dialog[line]]..': '
			line = line + 1
		end
		local text = speaker..'"'..dialog[line]..'"'
		
		if dialog[line] == 0 then text = dialog[line+1] end  --narrative option (removes quotes, and speaker name)
		
		delayedHudPrint(text, t*(time_delay/2))
	end
end

-- wrapper for the hudPrint function; called by a timer.
function displayText(caller) playSound("click_down")
	hudPrint("") hudPrint("") 
	hudPrint(tostring(caller.id:sub(caller.id:find("@")+1)))
	hudPrint("") hudPrint("") 
end

--Example usage:

converse("conv_1", 2, party:getChampion(1):getName(), "A nearby ghost")

-- Example usage input description [for the above]:

-- "conv_1" The conversation to be printed out
-- 2 The ordinal of the first PC. [Will always be that PC, no matter what slot they occupy in the party]
-- party:getChampion(1):getName()  The name of the PC who is in the #1 party position
-- "A nearby ghost" A forced name for a 3rd speaker.
Alino wrote:2 - How to set up the custom classes/custom starting level/starting gear/etc[?]
The scripting reference for Grimrock has most of the functions that you might need for this; see the Champion section.
http://www.grimrock.net/modding_log1/sc ... reference/
User avatar
Alino
Posts: 33
Joined: Sun Jan 03, 2016 10:13 pm

Re: The Ancient's Tomb (WIP Dungeon. No download)

Post by Alino »

Thanks. I'll try to memorize what all that means once I start up later today/tonight.
Post Reply