naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
[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 |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Restore sanity
Trying is the first step to success.
|
|
10-12-2012, 08:01 AM |
|
Ongka
Member
Posts: 225
Threads: 3
Joined: Nov 2010
Reputation:
20
|
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.
|
|
10-12-2012, 09:05 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Restore sanity
I can tell you it DOES appear 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 |
|
naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
RE: Restore sanity
(10-12-2012, 09:41 AM)beecake Wrote: I can tell you it DOES appear 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 |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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.
|
|
10-12-2012, 10:28 AM |
|
naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
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 |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
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)
Aculy iz dolan.
|
|
10-12-2012, 12:57 PM |
|
naseem142
Member
Posts: 153
Threads: 19
Joined: Oct 2012
Reputation:
0
|
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
|
|
10-12-2012, 01:10 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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 |
|
|