MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
RE: Making a scream play when player enters a room?
Whoops, it's supposed to be StartPlayerLookAt, not the other way around.
Also, You'll need to add a timer, and then a StopPlayerLookAt(); to stop him from looking, or else he'll look at it forever.
03-23-2011, 03:44 AM
Austums
Member
Posts: 60
Threads: 11
Joined: Mar 2011
Reputation:
0
RE: Making a scream play when player enters a room?
So does this all look good then?
void OnStart()
{
AddEntityCollideCallback("Player", "Scream", "Scream_1", true, 1);
}
void Scream_1(string &in asParent, string &in asChild, int alStates)
{
AddTimer("Somenamedoesntreallymatter", 2.0f, "Scream_Trigger");
}
void Scream_Trigger(string &in asTimer)
{
PlaySoundAtEntity("Scream_1", "04_scream.snt", "Scream_1", 0, false);
StartPlayerLookAt("LookArea_1", 1, 1, "");
StopPlayerLookAt();
}
void LookArea_1(string &in as Parent, string &in as Child, int alStates)
{
AddTimer("Somenamedoesntreallymatter", 2.0f, "LookArea_Trigger");
}
Just got a new error.
"main (16,31) : ERR: Expected ')' or ','
(This post was last modified: 03-23-2011, 03:51 AM by Austums .)
03-23-2011, 03:49 AM
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
RE: Making a scream play when player enters a room?
as Parent and as Child are one word. And you should add the timer into the Scream_Trigger function, then put the stoplook into that function. If you put the start and stoplook in the same function without a timer, he'll start looking, and then stop a millisecond later, so basically nothing will happen. I'd do a 2 second timer to the stoplook, or whatever suits you.
03-23-2011, 04:00 AM
Austums
Member
Posts: 60
Threads: 11
Joined: Mar 2011
Reputation:
0
RE: Making a scream play when player enters a room?
So liek this?
void OnStart()
{
AddEntityCollideCallback("Player", "Scream", "Scream_1", true, 1);
}
void Scream_1(string &in asParent, string &in asChild, int alStates)
void LookArea_1(string &in asParent, string &in asChild, int alStates)
{
AddTimer("Somenamedoesntreallymatter", 2.0f, "Scream_Trigger");
AddTimer("Somenamedoesntreallymatter", 2.0f, "LookArea_Trigger");
StopPlayerLookAt();
}
void Scream_Trigger(string &in asTimer)
{
PlaySoundAtEntity("Scream_1", "04_scream.snt", "Scream_1", 0, false);
StartPlayerLookAt("LookArea_1", 1, 1, "");
}
03-23-2011, 04:07 AM
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
RE: Making a scream play when player enters a room?
Nono, keep the timer you had before in Scream_1, put another one in Scream_Trigger, call another function with it, Scream_Trigger. Put the StopPlayerLookAt function in there. So basically, Scream_1 triggers a timer, after 2 seconds the sound plays, you look at the door, and another timer is called, then 2 seconds or more later, the player stops looking at the door.
void OnStart()
{
AddEntityCollideCallback("Player", "Scream", "Scream_1", true, 1);
}
void Scream_1(string &in asParent, string &in asChild, int alStates)
{
AddTimer("Somenamedoesntreallymatter", 2.0f, "Scream_Trigger");
}
void Scream_Trigger(string &in asTimer)
{
PlaySoundAtEntity("Scream_1", "04_scream.snt", "Scream_1", 0, false);
StartPlayerLookAt("LookArea_1", 1, 1, "");
AddTimer("Somenamedoesntreallymatter", 2.0f, "LookArea_Trigger");
}
void LookArea_Trigger(string &in asParent, string &in asChild, int alStates)
{
StopPlayerLookAt();
}
It's all a consecutive thing, this way the timers just from function to function.
(This post was last modified: 03-23-2011, 04:19 AM by MrBigzy .)
03-23-2011, 04:18 AM
Austums
Member
Posts: 60
Threads: 11
Joined: Mar 2011
Reputation:
0
RE: Making a scream play when player enters a room?
Okay, I think I get it. I put the script you just did in my .hps but when I go into the room where the scream and look is supposed to happen, nothing happens. Am I supposed to edit the Area Scripts in the Level Editor or just name them? I can post my level for you if you think that would help
03-23-2011, 04:22 AM
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
RE: Making a scream play when player enters a room?
You just have to make sure the script areas are named Scream_1 and LookArea_1, and that Scream_1 is in a position that you'll run into it. If you post the map I'll look at it.
03-23-2011, 04:25 AM
Austums
Member
Posts: 60
Threads: 11
Joined: Mar 2011
Reputation:
0
RE: Making a scream play when player enters a room?
Everything is named correctly... Hmmm
Anyways, here's the .map
Attached Files
Stalking_Test.rar (Size: 352.03 KB / Downloads: 113)
03-23-2011, 04:29 AM
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
RE: Making a scream play when player enters a room?
Just realized, change entity collide to this: AddEntityCollideCallback("Player", "Scream_1", "Scream", true, 1);
The function and the script area were switched.
Also, you should probably make the scream area go to the ground, just in case.
(This post was last modified: 03-23-2011, 04:38 AM by MrBigzy .)
03-23-2011, 04:37 AM
Austums
Member
Posts: 60
Threads: 11
Joined: Mar 2011
Reputation:
0
RE: Making a scream play when player enters a room?
Changed it so the script is this
void OnStart()
{
AddEntityCollideCallback("Player", "Scream_1", "Scream", true, 1);
}
void Scream_1(string &in asParent, string &in asChild, int alStates)
{
AddTimer("Somenamedoesntreallymatter", 2.0f, "Scream_Trigger");
}
void Scream_Trigger(string &in asTimer)
{
PlaySoundAtEntity("Scream_1", "04_scream.snt", "Scream_1", 0, false);
StartPlayerLookAt("LookArea_1", 1, 1, "");
AddTimer("Somenamedoesntreallymatter", 2.0f, "LookArea_Trigger");
}
void LookArea_Trigger(string &in asParent, string &in asChild, int alStates)
{
StopPlayerLookAt();
}
But it still does nothing when I walk through the door and wait.
03-23-2011, 04:43 AM