08-28-2011, 11:40 AM
Code:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "starterroomkey_1", "starterdoor", "Usekeyondoor", true);
AddEntityCollideCallback("Player", "BLAM1", "func_slam", true, 1);
SetEntityCallbackFunc("earthquakenote", "Func");
}
void Usekeyondoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("starterdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("starterroomkey_1");
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("starterdoor", true, true);
SetSwingDoorLocked("starterdoor", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void Func(string &in asEntity, string &in type)
{
if(type == "OnPickup")
{
StartScreenShake(0.10f, 5.0f, 1.5f, 4.0f);
StartPlayerLookAt("lookat", 0.5, 0.5, "");
SetPlayerActive(false);
SetPlayerCrouching(true);
AddTimer("", 1.0, "Timer1");
AddTimer("", 4.0, "Timer2");
AddTimer("", 1.0, "PlayShit");
}
}
void Timer1(string &in asTimer)
{
PlaySoundAtEntity("", "react_sigh", "Player", 0, false);
}
void Timer2(string &in asTimer)
{
SetPlayerCrouching(false);
StopPlayerLookAt();
SetPlayerActive(true);
}
void PlayShit(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "general_rock_rumble", "Player", 0, false);
}
The rumble sound seems to be delayed, then it repeats. Also for some reason after the timer ends and the stopplayerlookat function is called, it still automatically looks at random objects.