Frictional Games Forum (read-only)

Full Version: Give Sanity Boost help D:
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
My guess is:
The boost only happens once because you lost some sanity...

The boost does not happen when you have full sanity.
Stay in the dark to lose some sanity, then see if it works.
Yeah it did work... n.n Thanks guys c: