Frictional Games Forum (read-only)
[SCRIPT] Galloglaich's problems with scripting and other stuff - 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: [SCRIPT] Galloglaich's problems with scripting and other stuff (/thread-14063.html)



Galloglaich's problems with scripting and other stuff - Galloglaich - 03-17-2012

Hi.

It is my first post, I have been lurking around here for quite some time now.

I'm making my own custom story with a few of my friends, this forum and youtube being the help we need for scripting and such, but now I didn't find any help for this problem, so I decided it was time to register here and ask it myself.

My knowledge of scripting is quite limited, I think I know the basics, and can make a working custom story with my skills, but now I have found myself with a problem I cant solve.

So, tell me if this is possible, and if you could provide me a link or give me the proper code, that I can just copy to my hps file, and change the names etc.

The idea is, that when player watches a scriptbox, he loses sanity.

I could of course make it happen with
StartPlayerLookAt command, but I feel that would be forcing the player a bit too much.

I hope that you understand what I meant, and if you can give me some help with this, it will be appreciated, and will get a mention in the credits. ^^

Thank you.

- Galloglaich




RE: Cant figure out a proper name for this - ClayPigeon - 03-17-2012

You mean, when a player is looking at an area he loses sanity?

void OnStart()
{
SetEntityPlayerLookAtCallback("SCRIPT_AREA_NAME", "LOOKATSANITYDRAIN", false);
}

void LOOKATSANITYDRAIN(string &in asEntity, int alState)
{
GiveSanityDamage(5.0f, true); //change 5.0f to the damange you want to be given and true to false if you don't want sanity damage effect
}


RE: Cant figure out a proper name for this - Galloglaich - 03-17-2012

Huh.. It actually was that simple, and it indeed was in the wiki. Somehow that just didn't catch my eye. Well, your help is much appreciated.

I'm probably going to post in this thread everytime I'm having problems with scripting or other stuff.

If everything goes well, you should have a preview version of our custom story to play pretty soon.

- Galloglaich



RE: Cant figure out a proper name for this - ClayPigeon - 03-17-2012

(03-17-2012, 09:38 PM)Galloglaich Wrote: Huh.. It actually was that simple, and it indeed was in the wiki. Somehow that just didn't catch my eye. Well, your help is much appreciated.

I'm probably going to post in this thread everytime I'm having problems with scripting or other stuff.

If everything goes well, you should have a preview version of our custom story to play pretty soon.

- Galloglaich
Don't know if it was in the wiki, just copied the functions from there. Did it work?


RE: Cant figure out a proper name for this - Galloglaich - 03-17-2012

Yes, it did. As I stated above, your help is very much appreciated.

I also changed the topic.

- Galloglaich



RE: Galloglaich's problems with scripting and other stuff - Galloglaich - 03-25-2012

Howdy. I ran into another problem. I need to have music play, when you turn the gramofone handle. All I managed to do was, that when you touch the gramofone, the music start's playing. So, as before, I would appreciate, if you could give me the actual codes I need to the hps. files and all that.

Thank you in advance.

- Galloglaich



RE: Galloglaich's problems with scripting and other stuff - ClayPigeon - 03-25-2012

I believe SetEntityConnectionStateChangeCallback should do the trick.

Code:
void OnStart()
{
    SetEntityConnectionStateChangeCallback("name_of_gramofone", "CALLBACK");
}

void CALLBACK(string &in asEntity, int alState)
{
    if(alState == 1) //Turned on
    {
    }
    if(alState == -1) //Turned off
    {
    }
}



RE: Galloglaich's problems with scripting and other stuff - Galloglaich - 03-26-2012

Again, I'm in your gratitude.
Many thanks.

- Galloglaich