Frictional Games Forum (read-only)
Sanity hit when looking at area - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Sanity hit when looking at area (/thread-30711.html)



Sanity hit when looking at area - Kyzer - 09-23-2015

I need a better explanation as to how this works and what I need to do to make it work

I also want a specific thing to happen for this, like in the storyline when Daniel sees something surprising and unnerving, he makes a gasp noise and (from what I remember) the screen FOV goes through a sudden change and back to normal.

[Image: 0ab0120079.jpg]

I've been doing level design for years, just not for Amnesia. It's far different from hammer. I'm used to everything being a specific function done in the program :p (I mean I'm not used to scripting)


RE: Sanity hit when looking at area - PutraenusAlivius - 09-23-2015

I think that you could use AddEntityCollideCallback that binds to the area and use the Sepia and Trail screen effects with PlaySound and some Sanity damage to do sort of the same thing although I'm not quite sure.

Example:
Spoiler below!

PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player""AreaName""Sanity"true1); //Command that tells the area what happens when you hit the area
}

void Sanity(string &in asParentstring &in asChildint alState)
{
GiveSanityDamage(15.0ftrue); //Command that damages the sanity. Let's just say 15. Let's put true in the effect because why not?
FadeSepiaColorTo(1.0f0.3f); //Command that turns the screen red. Let's set the time to full effect to 0.3 seconds.
FadeImageTrailTo(1.0f0.3f); //Command that sort of gets a trail effect. Let's put the same thing as FadeSepia but you can edit that.
PlayGuiSound("gasp.snt"1.0f); //Command that gives the sound. Now I AM NOT SURE WHAT THE FILE IS, but you can search the Amnesia sound directory to find the appropriate sound. Make sure you put .snt after the name as the original command demands it.



This is just an example as I haven't tested it out yet and I made this on the spot.


RE: Sanity hit when looking at area - Mudbill - 09-23-2015

The GiveSanityDamage is all that is required for the FOV, sound, and loss of sanity. Anyway, I answered your other thread. You should stick to one and not make duplicates.

For the sake of it, I'll just quote my reply here for now.

(09-23-2015, 08:03 AM)Mugbill Wrote: Ah, yes here it is:
PHP Code:
SetEntityPlayerLookAtCallback(stringasNamestringasCallbackbool abRemoveWhenLookedAt); 

The callback syntax is void MyFunc(string &in asEntity, int alState)

If you're not familiar with scripting, this should look like so:

PHP Code:
void OnStart()
{
    
SetEntityPlayerLookAtCallback("NAME_OF_AREA""NAME_OF_CALLBACK"true);
}

void NAME_OF_CALLBACK(string &in asEntityint alState)
{
    
GiveSanityDamage(15.0ftrue);




RE: Sanity hit when looking at area - Kyzer - 09-25-2015

(09-23-2015, 08:09 AM)Mugbill Wrote: The GiveSanityDamage is all that is required for the FOV, sound, and loss of sanity. Anyway, I answered your other thread. You should stick to one and not make duplicates.

For the sake of it, I'll just quote my reply here for now.

(09-23-2015, 08:03 AM)Mugbill Wrote: Ah, yes here it is:
PHP Code:
SetEntityPlayerLookAtCallback(stringasNamestringasCallbackbool abRemoveWhenLookedAt); 

The callback syntax is void MyFunc(string &in asEntity, int alState)

If you're not familiar with scripting, this should look like so:

PHP Code:
void OnStart()
{
    
SetEntityPlayerLookAtCallback("NAME_OF_AREA""NAME_OF_CALLBACK"true);
}

void NAME_OF_CALLBACK(string &in asEntityint alState)
{
    
GiveSanityDamage(15.0ftrue);


I'm getting the effect but I'm not getting the gasping sound. (using 50)


RE: Sanity hit when looking at area - Mudbill - 09-25-2015

The gasp is not part of this line. If you want that, you'll need to add it separately. You can do so with

PHP Code:
PlayGuiSound("filename.snt"1.0f); 

I don't remember what the file name is, but you will find it in the sounds folder somewhere, likely under player.