Frictional Games Forum (read-only)
Give Sanity Boost help D: - 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: Give Sanity Boost help D: (/thread-19761.html)



Give Sanity Boost help D: - 31tashi - 01-01-2013

Sooo... I've been scripting for a while now but i can't seem to figure out one of my problems. I used the sanity boost script on a door you open with a crowbar... And i also have a give sanity boost on when you pull a lever of mine, but the boost Never appears. It seems like the boost only can appear once... can i change that? :c
Script:
void OnStart()
{
AddUseItemCallback("", "crowbar_1", "prison_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_3", "CollideAreaBreakDoor", true, 1);
SetEntityConnectionStateChangeCallback("lever", "func_shelf");geCallback("lever", "func_shelf");
}

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("prison_1", false, true);
AddPropImpulse("prison_1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("prison_1", true);
SetSwingDoorClosed("prison_1", false, false);
SetMoveObjectState("prison_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
AddBodyForce("prison_1", 0, 0, 900, "world");
SetEntityActive("crowbarlives", true);
}

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
AddTimer("", 10, "func_shelf2");
GiveSanityBoost();
SetMoveObjectState("shelf",1.0f);
SetMessage("Messages", "Popup2", 0);
SetLeverStuckState("lever", 1, true);
return;
}
}

So I am really not sure how to make it appear a second time... The func_shelf sanity thing worked before i added in the new crowbar door, but now it doesn't.


RE: Give Sanity Boost help D: - FlawlessHappiness - 01-01-2013

My guess is:
The boost only happens once because you lost some sanity...

The boost does not happen when you have full sanity.


RE: Give Sanity Boost help D: - str4wberrypanic - 01-01-2013

Stay in the dark to lose some sanity, then see if it works.


RE: Give Sanity Boost help D: - 31tashi - 01-01-2013

Yeah it did work... n.n Thanks guys c: