Frictional Games Forum (read-only)

Full Version: Galloglaich's problems with scripting and other stuff
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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

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
}
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
(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?
Yes, it did. As I stated above, your help is very much appreciated.

I also changed the topic.

- Galloglaich
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
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
    {
    }
}
Again, I'm in your gratitude.
Many thanks.

- Galloglaich