"Secret Found" simple setup tutorial

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

"Secret Found" simple setup tutorial

Post by Komag »

When I want a secret in my dungeon, here is one way to manually set it all up:
SpoilerShow
- Place an S "secret" item (this is just for the statistical purpose I believe)
- place a hidden pressure plate (only triggered by party and set to "activate once")
- place a script item:

Code: Select all

function foundthesecret()
	playSound("secret")
	hudPrint("Secret Found")
end
- connect the plate to the script with "foundthesecret"

I couldn't find any shortcut to this, no settings for the S "secret" item. I guess there needs to be flexibility, so manual it must be.

The sound and the hudPrint could be triggered by anything, but I'm just guessing that to have the secret properly accounted for in the game statistics, you must place the S and step in that square for the S to be counted.

(I also have noticed that functions can't have underscores _ in the name. I can't call it found_secret() for example)
EDIT - NEVER MIND ALL THAT!
Just:
- Place an S "secret" item
- place a hidden pressure plate (only triggered by party)
- connect the plate to the S with activate
The S will only activate once no matter how many times you step there. Activating the S is probably the only way to properly account for the secret being found
Finished Dungeons - complete mods to play
User avatar
djoldgames
Posts: 107
Joined: Fri Mar 23, 2012 11:28 pm
Contact:

Re: "Secret Found" simple setup tutorial

Post by djoldgames »

Komag wrote:When I want a secret in my dungeon, here is one way to manually set it all up:
And what about this if you have secret entity with ID=secret_1 ?

Code: Select all

function foundthesecret()
   secret_1:activate()
end
This automaticaly play the secret sound and print the message, and of course increase system secrets counter for statistic...
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: "Secret Found" simple setup tutorial

Post by Grimwold »

I usually use a connector instead of a script, but this works too. Thanks.

I didn't realise you couldn't have underscores... thought it was just a convention to use camel-case for function names... e.g. foundSecret()
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: "Secret Found" simple setup tutorial

Post by Komag »

djoldgames wrote:And what about this if you have secret entity with ID=secret_1 ?

Code: Select all

function foundthesecret()
   secret_1:activate()
end
This automaticaly play the secret sound and print the message, and of course increase system secrets counter for statistic...
I had no idea! Well then to heck with the script and everything, just link the plate to the secret! (why didn't I try that first?!?) :oops: :roll:

And that's probably the only way to get it to count it for the stats anyway (I was just guessing about stepping on it)

FIRST POST EDITED!
Finished Dungeons - complete mods to play
Obyvvatel
Posts: 30
Joined: Mon Sep 17, 2012 11:21 pm
Location: Poznań, Poland

Re: "Secret Found" simple setup tutorial

Post by Obyvvatel »

I think you can just ignore the "activate once" thingy. The secret will activate only one time :P
Lyverbe
Posts: 57
Joined: Thu May 17, 2012 1:31 pm

Re: "Secret Found" simple setup tutorial

Post by Lyverbe »

Grimwold wrote:I usually use a connector instead of a script, but this works too. Thanks.

I didn't realise you couldn't have underscores... thought it was just a convention to use camel-case for function names... e.g. foundSecret()
That's what I've always done too. No need to script anything.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: "Secret Found" simple setup tutorial

Post by Komag »

Obyvvatel wrote:I think you can just ignore the "activate once" thingy. The secret will activate only one time :P
ah, good to know
Finished Dungeons - complete mods to play
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 »

Hello,

I am looking for a script solution, so that when you find a secret this mark: 1 to X secret found (2 to x etc...). X is the total. Or better yet, that the mark only when you go on a healing crystal or at the end of each level (whatever).

Perhaps by incrementing a counter every secret. But I prefere a simple solution with the hidden plate and the S marker rather than a big script, but it may not be possible. Any ideas?

PS : I'm french, sorry for my bad english.


EDIT : There is no connector with the S marker and the healing crystal. So at the end of each level with a hidden plate is the best solution I think. So with each hidden_secret_plate I incremente a counter in script. And I get the number of the counter whith the hidden plate at the end of my level. Am I right?
User avatar
antti
Posts: 688
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

Re: "Secret Found" simple setup tutorial

Post by antti »

Damonya wrote:EDIT : There is no connector with the S marker and the healing crystal. So at the end of each level with a hidden plate is the best solution I think. So with each hidden_secret_plate I incremente a counter in script. And I get the number of the counter whith the hidden plate at the end of my level. Am I right?
Yeah, this sounds like a good solution to me.
Steven Seagal of gaming industry
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 »

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
Post Reply