![]() |
[SOLVED] Restore sanity - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SOLVED] Restore sanity (/thread-18736.html) Pages:
1
2
|
[SOLVED] Restore sanity - naseem142 - 10-12-2012 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* } } RE: Restore sanity - FlawlessHappiness - 10-12-2012 AddPlayerSanity(5); Use this site, and Cmd/Ctrl F http://wiki.frictionalgames.com/hpl2/amnesia/script_functions RE: Restore sanity - Ongka - 10-12-2012 I'm not sure if the blue screen-effect pops up if you use AddPlayerSanity, if not, you can use GiveSanityBoostSmall() instead. RE: Restore sanity - FlawlessHappiness - 10-12-2012 I can tell you it DOES appear ![]() RE: Restore sanity - naseem142 - 10-12-2012 (10-12-2012, 09:41 AM)beecake Wrote: I can tell you it DOES appearIt 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); } } RE: Restore sanity - FlawlessHappiness - 10-12-2012 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 RE: Restore sanity - naseem142 - 10-12-2012 (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 RE: [Not solved , yet] Restore sanity - The chaser - 10-12-2012 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); } } RE: [Not solved , yet] Restore sanity - naseem142 - 10-12-2012 (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: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 ![]() RE: [SOLVED] Restore sanity - FlawlessHappiness - 10-12-2012 You still have a problem! The player is able to press the same button 3 times. Is that ok? |