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
Sound and Particles Looping
Wolpertenn Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jul 2012
Reputation: 0
#1
Sound and Particles Looping

Hello,

So I was working on my custom story when I decided upon making a function. In the script I have a callback for when the player enters an area (ScriptArea_1) and the function is called to make the player look at an object (hatch_ceiling_1) and it then calls multiple timers. However, all the timers are malfunctioning in that they make the sounds and particle effects loop. Here's an example:




Here is the scripting:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Look_splash", true, 1);
}
//Watermonster introduction
void Look_splash(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("hatch_ceiling_1", 5, 5, "SplashTimers");
}
void SplashTimers()
{
AddTimer("", 0.5, "Splash_1");
AddTimer("", 5, "Splash_2");
AddTimer("", 10, "Splash_3");
}
void Splash_1(string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_impact_water_low.ps", "ScriptArea_splash", false);
CreateParticleSystemAtEntity("", "ptest_dust_falling.ps", "ScriptArea_splash", false);
PlaySoundAtEntity("", "react_pant.snt", "ScriptArea_splash", 0.5, false);
PlaySoundAtEntity("", "impact_water_med.snt", "ScriptArea_splash", 0.5, false);
AddTimer("", 5, "Splash_2");
}
void Splash_2(string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_impact_water_low.ps", "ScriptArea_splash", false);
CreateParticleSystemAtEntity("", "ptest_dust_falling.ps", "ScriptArea_splash", false);
PlaySoundAtEntity("", "water_lurker_attack_rev.snt", "ScriptArea_splash", 0.5, false);
PlaySoundAtEntity("", "impact_water_high.snt", "ScriptArea_splash", 0.5, false);
AddTimer("", 5, "Splash_3");
}
void Splash_3(string &in asTimer)
{
PlaySoundAtEntity("", "water_lurker_eat_rev.snt", "ScriptArea_splash", 0.5, false);
PlaySoundAtEntity("", "water_lurker_idle_rev.snt", "ScriptArea_splash", 0.5, false);
StopPlayerLookAt();
}


I'd appreciate any advice or solutions anyone has to offer. Thanks.

PS: If anyone requires pictures of the areas in the Level Editor, I'd be happy to post them.
EDIT: Fixed script (didn't have full script).
(This post was last modified: 07-07-2012, 09:54 PM by Wolpertenn.)
07-07-2012, 09:09 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#2
RE: Sound and Particles Looping

maybe you could stop the sound with:
StopSound(string& asSoundName, float afFadeTime);

but for the particles I have no idea :/

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
07-07-2012, 09:28 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Sound and Particles Looping

You only have all of these sounds+particles set to play at one area: "ScriptArea_splash". I'd suggest making a trail of areas, and creating the sound+particle fx at each.

I think that was your intention, but perhaps you forgot to rename the 2nd/3rd functions after you copy and pasted the functions?

Hope that helped!

p.s. that video was scarier than most jump scare maps I've seen Tongue


Edit///
I think I might have misinterpreted your problem. Although the particle systems/sounds you're using don't loop on their own, you could use DestroyParticleSystem and the function Steve named.

I also don't think that syntax is right for "Splash"; perhaps it is called more than once and that's what leading to this looping of effects? Idk.

I rate it 3 memes.
(This post was last modified: 07-07-2012, 09:46 PM by Adny.)
07-07-2012, 09:34 PM
Find
Wolpertenn Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jul 2012
Reputation: 0
#4
RE: Sound and Particles Looping

(07-07-2012, 09:34 PM)andyrockin123 Wrote: You only have all of these sounds+particles set to play at one area: "ScriptArea_splash". I'd suggest making a trail of areas, and creating the sound+particle fx at each.

I think that was your intention, but perhaps you forgot to rename the 2nd/3rd functions after you copy and pasted the functions?

Hope that helped!

p.s. that video was scarier than most jump scare maps I've seen Tongue


Edit///
I think I might have misinterpreted your problem. Although the particle systems/sounds you're using don't loop on their own, you could use DestroyParticleSystem and the function Steve named.

I also don't think that syntax is right for "Splash"; perhaps it is called more than once and that's what leading to this looping of effects? Idk.
Yeah, sorry about that. I didn't have the entire script in there and forgot to add the timers.

I will do the "StopSound" and "DestroyParticleSystem" if I have to, but it just confuses me that it's not working. You'd think that it would work properly considering it's pretty much a replica of the order of events Frictional Games uses in Amnesia.

Alright, it seems I've found the problem.

For some reason, if you use the "StartPlayerLookAt" function, you really shouldn't have a function tied to the end for when you look at said object, otherwise this whole looping problem occurs.

Maybe it's a glitch, or maybe this function is used for different purposes, I don't know. However I have finally found a solution to the problem and I recommend anyone who is having this issue to try removing your function from "StartPlayerLookAt".

I appreciate both of your responses, Steve and andyrockin123. Thanks. Smile
(This post was last modified: 07-07-2012, 10:44 PM by Wolpertenn.)
07-07-2012, 09:53 PM
Find




Users browsing this thread: 2 Guest(s)