Ge15t
Junior Member
Posts: 48
Threads: 8
Joined: Feb 2011
Reputation:
0
|
RE: Anyone need help?
void ScaryFootstepsCallback(string &in asParent, string &in asChild, int alState)
{
for(int s=2;s<8;s++) AddTimer("step"+s, 2.0 * s, "CreateFootstep");
}
void CreateFootstep(string &in asTimer)
{
PlaySoundAtEntity("scary"+asTimer, "scare_wood_creak_walk.snt", "Area_step_1", 0, false);
if(asTimer == "Area_step_6")
{
PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
}
Ok so this script works, BUT the footsteps sound like they are coming from the player or really close by, how can I fix that? also, the PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false); doesnt work either.. any tips? The game loads fine btw
(This post was last modified: 05-08-2011, 11:06 PM by Ge15t.)
|
|
05-08-2011, 11:06 PM |
|
RawkBandMan
Posting Freak
Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation:
5
|
RE: Anyone need help?
(05-08-2011, 10:59 PM)Kyle Wrote: Inside of the function "Function01", it set the entity, the monster, "Monster" to true, thus spawning it.
So when the player activates the function, by the SetEntityPlayerInteractCallback, it calls the function, doing what ever is inside of it.
Okay thank you very much!
I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
|
|
05-08-2011, 11:11 PM |
|
Simpanra
Senior Member
Posts: 314
Threads: 28
Joined: Mar 2011
Reputation:
0
|
RE: Anyone need help?
but thats what i said! xD you just used the actual script while i was using a mock up script =)
|
|
05-08-2011, 11:18 PM |
|
Dominic0904
Member
Posts: 63
Threads: 14
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
(05-08-2011, 10:46 PM)Kyle Wrote: Simpanra, I don't know why you are even trying to help him, you just screwed it all up, no offence. :p
void OnStart()
{
PreloadSound("react_scare");
AddEntityCollideCallback("Player", "ScriptArea_1", "LoadRoarEvent", true, 1);
}
void LoadRoarEvent(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}
The preloading of the sound will reduce the moment of lag between loading the sound and playing when it is used.
Hey I did what you put there and replaced with my sound and script area names. But when i enter the script area. The sanity damage is given, but the sound is not played. This is how my code looks so far:
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);
//Here are all the sounds stopped so they can be triggered later
StopSound("Roar_01", 2.0f);
StopSound("Scream_01", 2.0f);
StopSound("WallScratch_01", 2.0f);
StopSound("Piano_01", 2.0f);
StopSound("Reaction_2", 2.0f);
StopSound("Reaction_3", 2.0f);
StopSound("", 2.0f); //used for later
StopSound("", 2.0f);
PreloadSound("Reaction_3");
AddEntityCollideCallback("Player", "ScaryEvent_01", "LoadScaryEvent", true, 1);
}
void LoadScaryEvent(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "Reaction_3", "Player", 0, false);
}
The reason I got all those StopSound(s) is because I needed to stop the sounds from playing as soon as I load the map up. Since I need them to be triggered later.
|
|
05-08-2011, 11:46 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Anyone need help?
Oops. A my bad on my part. It should be:
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
The react_scare.snt is an actual file under sounds, and then react. You can try out sounds and see what sounds each one makes by going into the editor and clicking on the sound tab, and click on the "..." and then chose a sound file (.snt) and play it by pressing the play arrow there. Just to let you know.
|
|
05-08-2011, 11:51 PM |
|
Dominic0904
Member
Posts: 63
Threads: 14
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
Oh, so I don't need to place down sound entities? I just need to say where the sound is coming from (this example would be "Player") and then write out the actually file name?
|
|
05-08-2011, 11:59 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Anyone need help?
(05-08-2011, 11:59 PM)Dominic0904 Wrote: Oh, so I don't need to place down sound entities? I just need to say where the sound is coming from (this example would be "Player") and then write out the actually file name?
That is correct. It is also best to preload the sound with: PreloadSound(""); with the sound file inside the quotes.
(05-08-2011, 11:06 PM)Ge15t Wrote: void ScaryFootstepsCallback(string &in asParent, string &in asChild, int alState)
{
for(int s=2;s<8;s++) AddTimer("step"+s, 2.0 * s, "CreateFootstep");
}
void CreateFootstep(string &in asTimer)
{
PlaySoundAtEntity("scary"+asTimer, "scare_wood_creak_walk.snt", "Area_step_1", 0, false);
if(asTimer == "Area_step_6")
{
PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
}
Ok so this script works, BUT the footsteps sound like they are coming from the player or really close by, how can I fix that? also, the PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false); doesnt work either.. any tips? The game loads fine btw
The "PlaySoundAtEntity" only works with .snt files. In this case, it would be "PlaySoundAtEntity("", "scare_breath.snt", "Player", 0, false);"
I don't know about the footsteps sounding too close to the player. Just try placing them farther away? :p
(This post was last modified: 05-09-2011, 12:09 AM by Kyle.)
|
|
05-09-2011, 12:04 AM |
|
Dominic0904
Member
Posts: 63
Threads: 14
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
Thanks dude! I'll post here again if I want to know anything else (First I'll try and figure it out myself though! )
|
|
05-09-2011, 12:12 AM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Anyone need help?
You're welcome, anytime.
It's funny how I'm helping people on the forums and scripting my custom story at the same time.
|
|
05-09-2011, 12:14 AM |
|
Ge15t
Junior Member
Posts: 48
Threads: 8
Joined: Feb 2011
Reputation:
0
|
RE: Anyone need help?
(05-09-2011, 12:04 AM)Kyle Wrote: (05-08-2011, 11:59 PM)Dominic0904 Wrote: Oh, so I don't need to place down sound entities? I just need to say where the sound is coming from (this example would be "Player") and then write out the actually file name?
That is correct. It is also best to preload the sound with: PreloadSound(""); with the sound file inside the quotes.
(05-08-2011, 11:06 PM)Ge15t Wrote: void ScaryFootstepsCallback(string &in asParent, string &in asChild, int alState)
{
for(int s=2;s<8;s++) AddTimer("step"+s, 2.0 * s, "CreateFootstep");
}
void CreateFootstep(string &in asTimer)
{
PlaySoundAtEntity("scary"+asTimer, "scare_wood_creak_walk.snt", "Area_step_1", 0, false);
if(asTimer == "Area_step_6")
{
PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false);
}
Ok so this script works, BUT the footsteps sound like they are coming from the player or really close by, how can I fix that? also, the PlaySoundAtEntity("", "scare_breath.ogg", "Player", 0, false); doesnt work either.. any tips? The game loads fine btw
The "PlaySoundAtEntity" only works with .snt files. In this case, it would be "PlaySoundAtEntity("", "scare_breath.snt", "Player", 0, false);"
I don't know about the footsteps sounding too close to the player. Just try placing them farther away? :p
It still doesnt work after trying that. Footstep noises are good though. Is the script right? Because game loads fine, but ignores the sound file at the end.
|
|
05-09-2011, 12:35 AM |
|
|