ZRPT
Junior Member
Posts: 17
Threads: 3
Joined: Aug 2011
Reputation:
1
|
Sound not playing at the right times
////////////////////////////
// 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.
(This post was last modified: 08-28-2011, 11:42 AM by ZRPT.)
|
|
08-28-2011, 11:40 AM |
|
ZRPT
Junior Member
Posts: 17
Threads: 3
Joined: Aug 2011
Reputation:
1
|
RE: Sound not playing at the right times
Can anyone help?
|
|
08-28-2011, 08:19 PM |
|
Elven
Posting Freak
Posts: 862
Threads: 37
Joined: Aug 2011
Reputation:
26
|
RE: Sound not playing at the right times
Use that instead of CallEntityCallbackFunc
void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in asEntity)
asName - internal name
asCallback - function to call
abRemoveOnInteraction - determines whether the callback should be removed when the player interacts with the entity
|
|
08-28-2011, 08:55 PM |
|
|