Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a scream play when player enters a room?
Author Message
MrBigzy Offline
Senior Member

Posts: 616
Joined: Mar 2011
Reputation: 8
Post: #21
RE: Making a scream play when player enters a room?

Add this to the start of your code, before everything:

void OnEnter()
{
}

void OnLeave()
{
}

Pretty sure you need those for them to run.
03-23-2011 04:53 AM
Find all posts by this user Quote this message in a reply
Austums Offline
Member

Posts: 60
Joined: Mar 2011
Reputation: 0
Post: #22
RE: Making a scream play when player enters a room?

Ok, so now I have this

void OnEnter()
{
}

void OnLeave()
{
}

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();
}

And yet still nothing happens. This scripting is like Greek to me :/
(This post was last modified: 03-23-2011 05:00 AM by Austums.)
03-23-2011 04:59 AM
Find all posts by this user Quote this message in a reply
MrBigzy Offline
Senior Member

Posts: 616
Joined: Mar 2011
Reputation: 8
Post: #23
RE: Making a scream play when player enters a room?

Sorry, I made another booboo. D:

Put the Scream and Scream_1 back the way they were in the collide. That's the thing bout programming, one single, tiny thing can screw up everything! Big Grin

Edit: Oh wait, I just realized. Make them both Scream_1. Your area is also called Scream_1. D:

Basically you had a function to an area that didn't exist, lol.
(This post was last modified: 03-23-2011 05:07 AM by MrBigzy.)
03-23-2011 05:05 AM
Find all posts by this user Quote this message in a reply
Austums Offline
Member

Posts: 60
Joined: Mar 2011
Reputation: 0
Post: #24
RE: Making a scream play when player enters a room?

lol, perfect! It worked!! Thank you so much! My very first script ^_^

I'm not gonna lie, I'm still very confused as to how C++ works (This is my first day with it) but I'm glad there are helpful people to help me out!
Now that that works, is there a script on the forums that shows me how to make the player whimper/startle? Like in Amnesia, when something frightens Daniel, he'll quietly whimper.
(This post was last modified: 03-23-2011 05:12 AM by Austums.)
03-23-2011 05:11 AM
Find all posts by this user Quote this message in a reply
MrBigzy Offline
Senior Member

Posts: 616
Joined: Mar 2011
Reputation: 8
Post: #25
RE: Making a scream play when player enters a room?

Glad to help. :3 Just try to learn from that script as to what's being done; it'll make it much easier to script later on! If you have any questions about certain parts of the script, just ask.

Edit: Uh, just use the same sound function you used for the scream, but make the entity Player and use the whimper sound file.
(This post was last modified: 03-23-2011 05:15 AM by MrBigzy.)
03-23-2011 05:14 AM
Find all posts by this user Quote this message in a reply
Austums Offline
Member

Posts: 60
Joined: Mar 2011
Reputation: 0
Post: #26
RE: Making a scream play when player enters a room?

Okay, so I added the react sound all by myself and it works, but I realized Daniel won't stop looking at the door!

I'm stumped as to what the problem is. I put the StopPlayerLookAt();

void OnEnter()
{
}

void OnLeave()
{
}

void OnStart()
{
AddEntityCollideCallback("Player", "Scream_1", "Scream_1", true, 1);
}
void Scream_1(string &in asParent, string &in asChild, int alStates)
{
   AddTimer("Somenamedoesntreallymatter", 6.0f, "Scream_Trigger");
}

void Scream_Trigger(string &in asTimer)
{
   PlaySoundAtEntity("Scream_1", "12_girl_scream.snt", "Scream_1", 0, false);
   PlaySoundAtEntity("Scream_1", "react_scare.snt", "Scream_1", 0, false);
   StartPlayerLookAt("LookArea_1", 2, 2, "");
   AddTimer("Somenamedoesntreallymatter", 6.0f, "LookArea_Trigger");
}
void LookArea_Trigger(string &in asParent, string &in asChild, int alStates)
{
   StopPlayerLookAt();
}
03-23-2011 05:27 AM
Find all posts by this user Quote this message in a reply
MrBigzy Offline
Senior Member

Posts: 616
Joined: Mar 2011
Reputation: 8
Post: #27
RE: Making a scream play when player enters a room?

The function has the arguments for a collide, it should have the asTimer in it only.
03-23-2011 05:34 AM
Find all posts by this user Quote this message in a reply
Austums Offline
Member

Posts: 60
Joined: Mar 2011
Reputation: 0
Post: #28
RE: Making a scream play when player enters a room?

Awesome, got it working! Yay, I can actually do a little scripting on my own, all thanks to you Big Grin

Let's say I wanted to have some breathing from the Player after the scream, and maybe start some ambient music. Same idea as the react and scream sounds?
03-23-2011 06:28 AM
Find all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #29
RE: Making a scream play when player enters a room?

That script language isn't C++, it's Angelscript (though it's pretty similiar to C++). Wink

03-23-2011 11:51 AM
Find all posts by this user Quote this message in a reply
MrBigzy Offline
Senior Member

Posts: 616
Joined: Mar 2011
Reputation: 8
Post: #30
RE: Making a scream play when player enters a room?

Woot! Tongue

Yep same thing, except for music, it's the function PlayMusic I think, just go to the function page in the wiki and do a search for "music", you'll find it. You should go through that page actually and look at the functions, most of them are self-explanatory.
03-23-2011 01:19 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)