"Secret Found" simple setup tutorial

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Radar6590
Posts: 30
Joined: Thu Apr 26, 2012 5:27 pm
Location: Boston, MA

Re: "Secret Found" simple setup tutorial

Post by Radar6590 »

Damonya wrote:Ok I tested and it's fine. Very easy in fact.

- Create a counter (Initial value = 0)
- Connect all your pressure_plate_hidden to their S secret and to this counter. Check "Activate once" otherwise the counter increment several times.
- Calcul the number of all your secret. Example 10.
- Create a pressure_plate_hidden at the end of your level (or what you want) and connect to a script with this function :

Code: Select all

function CounterSecret()
	local number = counter:getValue()
	hudPrint(number.. " secrets to 10 found")
end
That's actually a really good idea...

Edit: The fact that this began the second page is awkward and I'm sorry for that. Quoted the post I'm talking about for clarity.
Check out my painted portraits here! Thanks for viewing. :)
Marble Mouth
Posts: 52
Joined: Sun Feb 10, 2013 12:46 am
Location: Dorchester, MA, USA

Re: "Secret Found" simple setup tutorial

Post by Marble Mouth »

Hi Damonya. Here's a little script that can simplify your job by counting the secrets for you:

Code: Select all

totalSecrets = 0

for l = 1,getMaxLevels() do
	for entity in allEntities(l) do
		if entity.name == "secret" then
			totalSecrets = totalSecrets + 1
		end
	end
end
which also means that you don't have to update the total when you add or remove a secret, the script will just count the secrets every time you click play in the editor or start a new game with this custom dungeon. I have chosen to make totalSecrets non-local so that it only needs to be calculated once, and the value will persist through saving and loading.

Also, prepositions are often one of the most difficult aspects of English for non-native speakers. This sounds more natural:

Code: Select all

hudPrint( number .. " secrets out of " .. totalSecrets  .. " found")
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: "Secret Found" simple setup tutorial

Post by Damonya »

Thank You Marble Mouth.

Just a question. getMaxLevels return the number of level, so the total is the total secrets of all level, not by level ? Is it right ?
Marble Mouth
Posts: 52
Joined: Sun Feb 10, 2013 12:46 am
Location: Dorchester, MA, USA

Re: "Secret Found" simple setup tutorial

Post by Marble Mouth »

You're welcome. That's correct, totalSecrets will include secrets from all levels of your mod.
Post Reply