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
[SOLVED] Restore sanity
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#1
[SOLVED] Restore sanity

How can i restore the sanity of the player just like happens in amnesia when you finish a puzzle a blur comes on screen and sanity is restored.

I want to add it when i click the 3 buttons.


void func5()
{
if(GetLocalVarInt("Var1") == 4)
{
/////Here what happens when all the 3 buttons are clicked vvvvvvvvvvvvv
SetSwingDoorLocked("doorman", false, false);
PlaySoundAtEntity("", "unlock_door.snt", "doorman", 0.5f, false);
//*Inset restore sanity script here*
}
}
(This post was last modified: 10-12-2012, 01:21 PM by naseem142.)
10-12-2012, 07:27 AM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Restore sanity

AddPlayerSanity(5);

Use this site, and Cmd/Ctrl F
http://wiki.frictionalgames.com/hpl2/amn..._functions

Trying is the first step to success.
10-12-2012, 08:01 AM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#3
RE: Restore sanity

I'm not sure if the blue screen-effect pops up if you use AddPlayerSanity, if not, you can use GiveSanityBoostSmall() instead.

[Image: 18694.png]
10-12-2012, 09:05 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Restore sanity

I can tell you it DOES appear Wink But of course it only works if you have less than 100 sanity

Trying is the first step to success.
10-12-2012, 09:41 AM
Find
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#5
RE: Restore sanity

(10-12-2012, 09:41 AM)beecake Wrote: I can tell you it DOES appear Wink But of course it only works if you have less than 100 sanity
It doesn't work , also the door didn't open either.


if(GetLocalVarInt("Var1") == 4)
{
/////Here what happens when all buttons are clicked vvvvvvvvvvvvv
SetSwingDoorLocked("doorman", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "doorman", 0.5f, false);
AddPlayerSanity(5);
}
}
10-12-2012, 10:23 AM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Restore sanity

Did the sound play? Because if it didn't then there is something wrong with the script not with AddPlayerSanity(5); Show the whole script

Trying is the first step to success.
(This post was last modified: 10-12-2012, 10:28 AM by FlawlessHappiness.)
10-12-2012, 10:28 AM
Find
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#7
RE: Restore sanity

(10-12-2012, 10:28 AM)beecake Wrote: Did the sound play? Because if it didn't then there is something wrong with the script not with AddPlayerSanity(5); Show the whole script

void OnStart()
{
AddUseItemCallback("", "Key_3", "Prison_11", "KeyOnDoor11", true);
SetLocalVarInt("Var1", 0);
SetEntityPlayerInteractCallback("button1", "func1", true);
SetEntityPlayerInteractCallback("button2", "func2", true);
SetEntityPlayerInteractCallback("button3", "func3", true);
}

void KeyOnDoor11(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Prison_11", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Prison_11", 0.0f, true);
}

void func1(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func2(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func3(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func4(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func5()
{
if(GetLocalVarInt("Var1") == 4)
{
/////Here what happens when all buttons are clicked vvvvvvvvvvvvv
SetSwingDoorLocked("doorman", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "doorman", 0.5f, false);
AddPlayerSanity(5);
}
}

Help? :S
(This post was last modified: 10-12-2012, 11:06 AM by naseem142.)
10-12-2012, 10:29 AM
Website Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#8
RE: [Not solved , yet] Restore sanity

You have three buttons, and every one adds 1 to the local variable. So, you have three, and you need 4. I suggest you to put:

void OnStart()

{

AddUseItemCallback("", "Key_3", "Prison_11", "KeyOnDoor11", true);

SetLocalVarInt("Var1", 0);

SetEntityPlayerInteractCallback("button1", "func1", true);

SetEntityPlayerInteractCallback("button2", "func2", true);

SetEntityPlayerInteractCallback("button3", "func3", true);

}



void KeyOnDoor11(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("Prison_11", false, true);

PlaySoundAtEntity("", "unlock_door.snt", "Prison_11", 0.0f, true);

}



void func1(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func2(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func3(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func4(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func5()

{

if(GetLocalVarInt("Var1") == 3)

{

/////Here what happens when all buttons are clicked vvvvvvvvvvvvv

SetSwingDoorLocked("doorman", false, true);

PlaySoundAtEntity("", "unlock_door.snt", "doorman", 0.5f, false);

AddPlayerSanity(5);

}

}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-12-2012, 12:57 PM
Find
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#9
RE: [Not solved , yet] Restore sanity

(10-12-2012, 12:57 PM)The chaser Wrote: You have three buttons, and every one adds 1 to the local variable. So, you have three, and you need 4. I suggest you to put:

void OnStart()

{

AddUseItemCallback("", "Key_3", "Prison_11", "KeyOnDoor11", true);

SetLocalVarInt("Var1", 0);

SetEntityPlayerInteractCallback("button1", "func1", true);

SetEntityPlayerInteractCallback("button2", "func2", true);

SetEntityPlayerInteractCallback("button3", "func3", true);

}



void KeyOnDoor11(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("Prison_11", false, true);

PlaySoundAtEntity("", "unlock_door.snt", "Prison_11", 0.0f, true);

}



void func1(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func2(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func3(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func4(string &in asEntity)

{

AddLocalVarInt("Var1", 1);

func5();

}



void func5()

{

if(GetLocalVarInt("Var1") == 3)

{

/////Here what happens when all buttons are clicked vvvvvvvvvvvvv

SetSwingDoorLocked("doorman", false, true);

PlaySoundAtEntity("", "unlock_door.snt", "doorman", 0.5f, false);

AddPlayerSanity(5);

}

}
Lol , i took the tutorial from the wiki and i decided to make it only 3 buttons and forgot to set the if var to 3
*face palm*
Thanks for helping Rolleyes
10-12-2012, 01:10 PM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: [SOLVED] Restore sanity

You still have a problem! The player is able to press the same button 3 times. Is that ok?

Trying is the first step to success.
10-12-2012, 02:01 PM
Find




Users browsing this thread: 1 Guest(s)