Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Galloglaich's problems with scripting and other stuff
Galloglaich Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2012
Reputation: 2
#1
Galloglaich's problems with scripting and other stuff

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

(This post was last modified: 03-17-2012, 09:56 PM by Galloglaich.)
03-17-2012, 09:25 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#2
RE: Cant figure out a proper name for this

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
}
(This post was last modified: 03-17-2012, 09:35 PM by ClayPigeon.)
03-17-2012, 09:32 PM
Find
Galloglaich Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2012
Reputation: 2
#3
RE: Cant figure out a proper name for this

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
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#4
RE: Cant figure out a proper name for this

(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?
03-17-2012, 09:40 PM
Find
Galloglaich Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2012
Reputation: 2
#5
RE: Cant figure out a proper name for this

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

I also changed the topic.

- Galloglaich
(This post was last modified: 03-17-2012, 09:56 PM by Galloglaich.)
03-17-2012, 09:51 PM
Find
Galloglaich Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2012
Reputation: 2
#6
RE: Galloglaich's problems with scripting and other stuff

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
03-25-2012, 08:45 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#7
RE: Galloglaich's problems with scripting and other stuff

I believe SetEntityConnectionStateChangeCallback should do the trick.

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

void CALLBACK(string &in asEntity, int alState)
{
    if(alState == 1) //Turned on
    {
    }
    if(alState == -1) //Turned off
    {
    }
}
(This post was last modified: 03-25-2012, 08:50 PM by ClayPigeon.)
03-25-2012, 08:49 PM
Find
Galloglaich Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2012
Reputation: 2
#8
RE: Galloglaich's problems with scripting and other stuff

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

- Galloglaich
03-26-2012, 07:51 PM
Find




Users browsing this thread: 1 Guest(s)