09-16-2012, 11:58 PM
I'm back again >.> I'm now having a problem with my script which I can't seem to find a solution for by searching. I've placed various sounds throughout my map and I can't get 90% of them working. The only one that works is one I have attached to a door. Otherwise, I can't get them to work.
I've created a type of arrest scene towards the end. Which will be refined in greater detail when/if this problem is solved, but right now I'd rather pause on my progression until I can get these sounds to work
The only sound that plays is PlaySoundAtEntity("PlatformDoor", "29_exit_door.snt", "castle_portcullis_3", 0.1f, false);
I read on the wiki you can set the entity to "Player" but it seems that isn't the case for me. Thanks again!
I've created a type of arrest scene towards the end. Which will be refined in greater detail when/if this problem is solved, but right now I'd rather pause on my progression until I can get these sounds to work
PHP Code:
void OnStart()
{
AddDebugMessage("OnStart!", false);
AddEntityCollideCallback("Player", "BottleFallArea", "BottleFall", true, 1);
AddEntityCollideCallback("Player", "BodyAlley", "BodyAlleyScare", true, 1);
SetEntityPlayerInteractCallback("castle_arched_no_grav01_1", "ActivateMessage", false);
SetEntityPlayerInteractCallback("castle_arched_no_grav01_2", "ActivateMessage1", false);
AddEntityCollideCallback("Player", "ScriptDoorMessageArea_1", "ActivateMessage2", true, 1);
AddEntityCollideCallback("Player", "DirectionsArea", "ActivateMessage3", true, 1);
AddEntityCollideCallback("Player", "KnockoutTrigger", "ActivateMessage4", true, 1);
}
void OnEnter()
{
AddDebugMessage("OnEnter!", false);
}
void OnLeave()
{
AddDebugMessage("OnLeave!", false);
}
void BottleFall(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("wine02_1", true);
}
void BodyAlleyScare(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("corpse_male_1", 4.0f, 4.0f, "");
PlaySoundAtEntity("Pant", "react_breath2.ogg", "Player", 0.1f, false);
GiveSanityDamage(5.0f, true);
AddTimer("BodyAlleyTimer", 2.0f, "Timer_01");
}
void Timer_01(string &in asTimer)
{
StartPlayerLookAt("ScriptArea_Look", 4.0f, 4.0f, "");
PlaySoundAtEntity("PlatformDoor", "29_exit_door.snt", "castle_portcullis_3", 0.1f, false);
AddTimer("BodyAlleyTimer2", 3.0f, "Timer_02");
}
void Timer_02(string &in asTimer)
{
StopPlayerLookAt();
SetMessage("MessageOnScreen", "BodyAlleyAdvice", 6.0f);
}
void ActivateMessage(string &in asEntity)
{
SetMessage("MessageOnScreen", "DoorMessage1", 2.0f);
}
void ActivateMessage1(string &in asEntity)
{
SetMessage("MessageOnScreen", "DoorMessage2", 2.0f);
}
void ActivateMessage2(string &in asParent, string &in asChild, int alState)
{
SetMessage("MessageOnScreen", "DoorMessage3", 4.0f);
}
void ActivateMessage3(string &in asParent, string &in asChild, int alState)
{
SetMessage("MessageOnScreen", "Directions", 3.0f);
}
void ActivateMessage4(string &in asParent, string &in asChild, int alState)
{
SetMessage("MessageOnScreen", "Arrest", 4.0f);
SetPlayerActive(false);
PlaySoundAtEntity("", "react_breath3.ogg", "Player", 0.1f, false);
AddTimer("ArrestTimer", 4.0f, "ArrestTimer_01");
}
void ArrestTimer_01(string &in asTimer)
{
SetMessage("MessageOnScreen", "ArrestResponse", 3.0f);
SetPlayerCrouching(true);
AddTimer("ArrestTimer2", 2.0f, "ArrestTimer_02");
}
void ArrestTimer_02(string &in asTimer)
{
PlaySoundAtEntity("", "player_crouch2.ogg", "Player", 0.1f, false);
AddTimer("ArrestTimer3", 1.0f, "ArrestTimer_03");
}
void ArrestTimer_03(string &in asTimer)
{
PlaySoundAtEntity("", "step_walk_rock_rev2.ogg", "Player", 0.1f, false);
AddTimer("ArrestTimer4", 1.0f, "ArrestTimer_04");
}
void ArrestTimer_04(string &in asTimer)
{
PlaySoundAtEntity("", "player_bodyfall5.ogg", "Player", 0.1f, false);
FadeOut(2.0f);
}
The only sound that plays is PlaySoundAtEntity("PlatformDoor", "29_exit_door.snt", "castle_portcullis_3", 0.1f, false);
I read on the wiki you can set the entity to "Player" but it seems that isn't the case for me. Thanks again!