Frictional Games Forum (read-only)

Full Version: Piano?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So im doing this scare, when the player touches the piano notes the piano lid will smash shut and make a loud bang, but i cant find any script that's working for moving the lid?
I've tried: get Lever state, Swing door, prop impulse.

What is the correct script for this?

I believe you need a combination of "SetLeverStuckState" and "AddPropImpulse".

I've taken the liberty to find the script FG used in the Archives map, which seems to be what you're looking for (I've removed all scripts irrelevant to the desired function):

void CollideCloseLid(string &in asParent, string &in asChild, int alState)
SetLeverStuckState("piano_1", 0, false);
AddPropImpulse("piano_1", 0,0,10, "world");

GiveSanityDamage(10, true);

Since your event takes place when the player interacts directly with the piano rather than colliding with an area, you can use the following callback syntax:

void pianofunction(string &in asEntity)

I hope that helped!
Thanks for the help. I solved the problem myself... I was scripting on Map1.hps when the piano event were on Map2 xD I'm stupid sometimes ;D