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
Causing sanity damage to yourself
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#2
RE: Causing sanity damage to yourself

Yes, you will need scripting for this. But it is fairly simply, if you begin by making a script file as on the wiki in the first step in the script tutorial 1. Then you only have to do 1 thing in the script and 1 thing in the editor.

In the editor, select the lever, click the Entity tab. For ConnectionStateChangeCallback enter a name for a function, like PullLever

Then in the script file, anywhere that is not within OnStart, OnEnter or OnLeave you add

//Function as you specified in ConnectionStateChangeCallback
void PullLever(string &in asEntity, int alState)
{
    //If the lever is pulled max up or down then give sanity damage
    if(alState == 1 or alState == -1)
    {
        GiveSanityDamage(10, true);  //10 = amount of damage, true = effects are used (vision distorts and such)
    }
}

I think this will work, this is not the 100% intended use of ConnectionStateChangeCallback, but I think I used it like this in one of the levels. As you say 0 experience, to make sure you are not confused, all the lines that start with // are comments I added to explain what is going on, those do not actually have to be in the script.
(This post was last modified: 09-21-2010, 06:20 AM by jens.)
09-17-2010, 06:54 AM
Website Find


Messages In This Thread
Causing sanity damage to yourself - by RaptorRed - 09-17-2010, 06:24 AM
RE: Causing sanity damage to yourself - by jens - 09-17-2010, 06:54 AM
RE: Causing sanity damage to yourself - by jens - 09-17-2010, 08:28 AM
RE: Causing sanity damage to yourself - by jens - 09-20-2010, 07:41 AM
RE: Causing sanity damage to yourself - by jens - 09-21-2010, 06:19 AM



Users browsing this thread: 1 Guest(s)