How timer and counter works ?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Sefarion
Posts: 2
Joined: Thu Sep 13, 2012 5:51 pm

How timer and counter works ?

Post by Sefarion »

Hello guys:)
First i want to thanks for great job..
I try to make my own dungeon (on steamworks "Agalons") and i want to make some difficult traps and puzzles but for it i need timers and counters. Can anyone explain how it works ? Oh and also why this script doesnt work ? :(

-- magic pool
function whyitdontwork()
if dungeon_alcove_3:containedItems() == "orb" then
secretdoor21:open()
else
secretdoor21:close()
end
end

I'm really bad programmer :(
Thanks all :)
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: How timer and counter works ?

Post by Komag »

You can find the info on Timers and Counters here (near the bottom):

http://www.grimrock.net/modding/inspect ... onnectors/
Finished Dungeons - complete mods to play
User avatar
antti
Posts: 688
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

Re: How timer and counter works ?

Post by antti »

Yeah, using the containedItems() is a little more involved than that. Here's a script where I iterate through all the items on an alcove, checking for any daggers. You can use this with very little modifications to get what you want:

Code: Select all

function checkAlcoveForItems()
	-- change these variables to match your alcove's ID and the item you want to test for
	local itemName = "dagger"
	local alcoveID = dungeon_alcove_1
	
	-- iterate through all the contained items on alcove, checking for a matching name
	for i in alcoveID:containedItems() do
		if i.name == itemName then
			itemFound()
		else
			itemNotFound()
		end
	end
end

-- run this script _once for each item_ with a matching name
function itemFound()
	playSound("level_up")
end

-- run this script _once for each item_ without a matching name
function itemNotFound()
	spawn("poison_cloud", party.level, party.x, party.y, 0)
end
Steven Seagal of gaming industry
Sefarion
Posts: 2
Joined: Thu Sep 13, 2012 5:51 pm

Re: How timer and counter works ?

Post by Sefarion »

Thanks so much ! :)
Post Reply