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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scare Sound?
zergling50 Offline
Member

Posts: 74
Threads: 9
Joined: Jul 2012
Reputation: 1
#1
Scare Sound?

So I have this code set up and I want it to play a sound when someone finished reading a note. I tried using this code:
////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("", "key_study_1", "mansion_3", "KeyOnDoor2", true);
SetEntityPlayerInteractCallback("note_paper01_3", "ScareNoise1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
void ActivateMonster(string &in asItem)
{
}
void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0.0f, false);
RemoveItem(asItem);
}
void ScareNoise1()
{
PlaySoundAtEntity("", "scare_baby_cry1.ogg", "Player", 0, false);
PlaySoundAtEntity("", "scare_steps_big5.ogg", "Player", 0, false);
PlaySoundAtEntity("", "scare_tingeling_rev2.ogg", "Player", 0, false);
}
It wont however work, but thanfully doesnt crash or give me any errors. Do I need to use something other than
SetEntityPlayerInteractCallback to make it work with a note?
EDIT: Sorry, I said "a" sound but I actually want it to play a chorus of those three sounds at once.
(This post was last modified: 07-22-2012, 05:06 PM by zergling50.)
07-18-2012, 09:12 PM
Find
Kazakarumariou Away
An angry man.

Posts: 283
Threads: 8
Joined: Jul 2012
Reputation: 14
#2
RE: Scare Sound?

void ScareNoise1(string& asName)
(This post was last modified: 07-18-2012, 09:20 PM by Kazakarumariou.)
07-18-2012, 09:20 PM
Find
zergling50 Offline
Member

Posts: 74
Threads: 9
Joined: Jul 2012
Reputation: 1
#3
RE: Scare Sound?

(07-18-2012, 09:20 PM)Harthex Wrote: void ScareNoise1(string& asName)

It started playing all the sounds for a split second but then they all cut off. Is it because Im trying to play so many at once? Should I make a different method for each noise? Otherwise thank you sooo much!
07-18-2012, 10:03 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: Scare Sound?

The proper syntax for the function is:

void ScareNoise1(string &in asEntity)


The HPL2 engine is able to handle quite a few sounds at once; if they cut off, its not due to the engine's limitations, but your script. Also, the "PlaySoundAtEntity" function doesn't directly support ogg vorbis (.ogg) files, but .snt files.

I rate it 3 memes.
07-18-2012, 10:14 PM
Find
zergling50 Offline
Member

Posts: 74
Threads: 9
Joined: Jul 2012
Reputation: 1
#5
RE: Scare Sound?

(07-18-2012, 10:14 PM)andyrockin123 Wrote: The proper syntax for the function is:

void ScareNoise1(string &in asEntity)


The HPL2 engine is able to handle quite a few sounds at once; if they cut off, its not due to the engine's limitations, but your script. Also, the "PlaySoundAtEntity" function doesn't directly support ogg vorbis (.ogg) files, but .snt files.

What should I do if i want it to runan ogg file?
07-18-2012, 10:16 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#6
RE: Scare Sound?

You can use a .ogg file. but it has to have an accompanying .snt file. I'd suggest (for troubleshooting purposes) to only use the name of the .snt file and not the individual .ogg names.

void ScareNoise1(string &in asEntity)
{
PlaySoundAtEntity("", "scare_baby_cry", "Player", 0, false);
PlaySoundAtEntity("", "scare_steps_big", "Player", 0, false);
PlaySoundAtEntity("", "scare_tingeling_rev2", "Player", 0, false);
}

I rate it 3 memes.
07-18-2012, 10:22 PM
Find
Kazakarumariou Away
An angry man.

Posts: 283
Threads: 8
Joined: Jul 2012
Reputation: 14
#7
RE: Scare Sound?

(07-18-2012, 10:14 PM)andyrockin123 Wrote: The proper syntax for the function is:

void ScareNoise1(string &in asEntity)
Sorry to be adding another question to you, but what's the difference? It works fine with the one I have(I'm using it on an Examine area).
07-18-2012, 11:16 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#8
RE: Scare Sound?

(07-18-2012, 11:16 PM)Harthex Wrote: Sorry to be adding another question to you, but what's the difference? It works fine with the one I have(I'm using it on an Examine area).
Technically you only need to have the "string &in" part then you can put whatever after that, but I just noticed that on the wiki page with the list of functions it specifically says string &in asEntity.

I rate it 3 memes.
07-18-2012, 11:34 PM
Find
zergling50 Offline
Member

Posts: 74
Threads: 9
Joined: Jul 2012
Reputation: 1
#9
RE: Scare Sound?

(07-18-2012, 10:22 PM)andyrockin123 Wrote: You can use a .ogg file. but it has to have an accompanying .snt file. I'd suggest (for troubleshooting purposes) to only use the name of the .snt file and not the individual .ogg names.

void ScareNoise1(string &in asEntity)
{
PlaySoundAtEntity("", "scare_baby_cry", "Player", 0, false);
PlaySoundAtEntity("", "scare_steps_big", "Player", 0, false);
PlaySoundAtEntity("", "scare_tingeling_rev2", "Player", 0, false);
}
It works now, but whats the point in having an ogg file if you cant use it? I prefer some of the ogg files but ill hav to settle with the snt.
07-18-2012, 11:51 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#10
RE: Scare Sound?

(07-18-2012, 11:51 PM)zergling50 Wrote: It works now, but whats the point in having an ogg file if you cant use it? I prefer some of the ogg files but ill hav to settle with the snt.
.snt files aren't actual sound files; they're more like configuration for the ogg files. If you look in the sounds folder, all ogg(s) have an accompanying .snt file. The snt file determines the sound(s) played, the volume, the maximum/minimum distances from which they can be heard, as well as other options. You can open them with notepad and look around inside of them, once you figure out how they work you can make your own .snt files with customized settings.

I rate it 3 memes.
07-19-2012, 12:10 AM
Find




Users browsing this thread: 1 Guest(s)