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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The trick with the sound
Dismortal Offline
Junior Member

Posts: 10
Threads: 3
Joined: Sep 2010
Reputation: 0
#1
The trick with the sound

Hello.

First, i must say sorry if my englisch is awful. I´ve never write scripts and now I really need help. I had read the threads with questions about sounds and scripting and tried some. Nothing works. I had read the original scripts from the game to get an idea to script. It dont work.

What dont work? I´ve tried to play a simple sound when I use a looked door.
After spending hours in trying I get discouraged. Undecided

Can someone help and explane me the "magic" of scripting?
Befor I forget. I dont have the problem to write a understandable script for the game. The script just dont do what I want.

Thanks for your patience und help.
09-17-2010, 04:41 AM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#2
RE: The trick with the sound

Hard to give any advice without you showing what you have done. Post the script with the part for the door and that is a starting point.
09-17-2010, 07:13 AM
Website Find
Dismortal Offline
Junior Member

Posts: 10
Threads: 3
Joined: Sep 2010
Reputation: 0
#3
RE: The trick with the sound

Quote:void PlaySoundAtEntity
{
PlaySoundAtEntity("ScriptArea_1", "21_screams.snt", "Player", 1, false);
}

This is all what i have. I know I need more than that.
09-17-2010, 01:44 PM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#4
RE: The trick with the sound

I think best is to look through http://hpl2.frictionalgames.com/tutorial...tutorial_1

Short version: You need to select the door in the level editor and in the Entity tab, under PlayerInteractCallback type InteractingWithDoor

Then you have to have a proper default script file to begin with (there is one in the tutorial).

Open your you default script file and anywhere that is NOT in OnStart, OnEnter or OnLeave write the function for that callback you just type into the editor. Like this:

void InteractingWithDoor(string &in asEntity)
{
    PlaySoundAtEntity("ScriptArea_1", "21_screams.snt", "Player", 1, false);

    AddDebugMessage("Playing Sound!", false);
}

Also make sure that you really have that ScriptArea_1 in the level. If you do not see the debug message or hear the sound, the function was not triggered at all.
(This post was last modified: 09-17-2010, 02:01 PM by jens.)
09-17-2010, 01:59 PM
Website Find
Dismortal Offline
Junior Member

Posts: 10
Threads: 3
Joined: Sep 2010
Reputation: 0
#5
RE: The trick with the sound

Wow, it works Smile
Thank you Jens. Now I know my problem. It was the association between the script and the callback function in the level editor.

I will read the tutorial to improve my knowledge about scripting.
After I know that, I feel like a fool. Blush
Thanks again.
09-17-2010, 02:40 PM
Find
Cgturner Offline
Junior Member

Posts: 28
Threads: 7
Joined: Sep 2010
Reputation: 0
#6
RE: The trick with the sound

Jens, I used this:
void InteractingWithDoor(string &in asEntity)
{
    PlaySoundAtEntity("doorinteract", "21_screams.snt", "key_1", 1, false);
}
The sound plays perfectly, and forgive me if I just missed it, but how would you make it so the sound only plays once, and not every time you interact with the door?
09-17-2010, 03:31 PM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#7
RE: The trick with the sound

You check the box that is below the PlayerINteractCallback in the level editor. I think the name is PlayerInteractCallbackAutoRemove.
09-17-2010, 04:24 PM
Website Find
Cgturner Offline
Junior Member

Posts: 28
Threads: 7
Joined: Sep 2010
Reputation: 0
#8
RE: The trick with the sound

(09-17-2010, 04:24 PM)jens Wrote: You check the box that is below the PlayerINteractCallback in the level editor. I think the name is PlayerInteractCallbackAutoRemove.
Why yes it is! I knew I missed something. Thank you for the swift and helpful response.
09-17-2010, 04:28 PM
Find
Requiem Offline
Junior Member

Posts: 1
Threads: 0
Joined: Sep 2010
Reputation: 0
#9
RE: The trick with the sound

Hi

I want to play a sound when the player go across an area, but I have to admit, my script doesn't work : / xD it look like :

void CollidePlayerWithAreaCreep()
{
PlaySoundAtEntity("Creep", "scare_animal_squeal.snt", "Player", 1, false);
}

Who can help me ?? ^^

Thx =p
09-19-2010, 05:14 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#10
RE: The trick with the sound

void CollidePlayerWithAreaCreep(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Creep", "scare_animal_squeal.snt", "Player", 1, false);
}

Here you go!

09-19-2010, 06:00 PM
Find




Users browsing this thread: 1 Guest(s)