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
Script Help Sound-Area doesn't work [Solved]
ShipinShen Offline
Junior Member

Posts: 23
Threads: 7
Joined: Apr 2014
Reputation: 0
#7
RE: Sound-Area doesn't work

(04-22-2014, 03:33 PM)Amn Wrote: If your sound is too short, maybe the fade time 1 is causing trouble. Try with 0.
Also check grandfather it should be an entity or area close to the player. And enabled.
And last, make sure your sound is called ClockChime.ogg and it's mono.

The sound is 5minutes long, the fade time shouldnt be a problem..
The entity is in the room so i can walk to the clock instantly. Maybe its the intro who stops the sound ?

Quote:void OnStart()
{
TeleportPlayer("Intro_0");
FadeOut(0);
SetPlayerActive(false);
SetSanityDrainDisabled(true);
ShowPlayerCrossHairIcons(false);

AddTimer("fadein", 3, "TimerIntro");

SetEntityCallbackFunc("Lantern", "OpenDoor");
SetLocalVarInt("Door", 0);




AddUseItemCallback("", "KeyTable", "DeskDoor", "UseKeyOnDoor", true);
PlayMusic("RainyMood.ogg", false, 1, 3, 1, true);

PlaySoundAtEntity("Clock", "ClockChime.snt", "grandfather", 0, false);
}
Quote:void TimerIntro(string &in asTimer)
{
if(GetLocalVarInt("Intro") < 3) {

if(asTimer == "fadein") {
TeleportPlayer("Intro_" + GetLocalVarInt("Intro"));
FadeIn(1);
AddTimer("fadeout", 4, "TimerIntro");
}
if(asTimer == "fadeout") {
FadeOut(1);
AddTimer("fadein", 1, "TimerIntro");
AddLocalVarInt("Intro", 1);
}
}
else
{
TeleportPlayer("Spawn");
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrossHairIcons(true);
}
}
The Intro works fine. After the intro, the player stands in near of the entity "grandfather"

(04-22-2014, 02:41 PM)ShipinShen Wrote: Hey guys, I added an area and an entity for example the grandfather clock.
I named the Area "ClockChime", the PlayerInteractCallback "Clock" and the Clock "grandfather". The Sound name is "ClockChime.snt".

Quote:void OnStart()
{
AddEntityCollideCallback("Player", "ClockChime", "Clock", true, 1);
}

void Clock(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Clock", "ClockChime.snt", "grandfather", 1, false);
}

When i'm colliding with this area ingame, nothing happens.. where is my mistake ?

I know where the mistake is.. the sound file works fine, because when i'm writing PlaySoundAtEntity("Clock", "ClockChime.snt", "Player", 1, false); I can hear the noise, but i dont understand, why the sound doesnt work when i'm writing PlaySoundAtEntity("Clock", "ClockChime.snt", "grandfather", 1, false); the entity has the exact same name in the level editor and the same .snt settings than the phonogram, which works fine

(04-22-2014, 03:56 PM)ShipinShen Wrote:
(04-22-2014, 03:33 PM)Amn Wrote: If your sound is too short, maybe the fade time 1 is causing trouble. Try with 0.
Also check grandfather it should be an entity or area close to the player. And enabled.
And last, make sure your sound is called ClockChime.ogg and it's mono.

The sound is 5minutes long, the fade time shouldnt be a problem..
The entity is in the room so i can walk to the clock instantly. Maybe its the intro who stops the sound ?

Quote:void OnStart()
{
TeleportPlayer("Intro_0");
FadeOut(0);
SetPlayerActive(false);
SetSanityDrainDisabled(true);
ShowPlayerCrossHairIcons(false);

AddTimer("fadein", 3, "TimerIntro");

SetEntityCallbackFunc("Lantern", "OpenDoor");
SetLocalVarInt("Door", 0);




AddUseItemCallback("", "KeyTable", "DeskDoor", "UseKeyOnDoor", true);
PlayMusic("RainyMood.ogg", false, 1, 3, 1, true);

PlaySoundAtEntity("Clock", "ClockChime.snt", "grandfather", 0, false);
}
Quote:void TimerIntro(string &in asTimer)
{
if(GetLocalVarInt("Intro") < 3) {

if(asTimer == "fadein") {
TeleportPlayer("Intro_" + GetLocalVarInt("Intro"));
FadeIn(1);
AddTimer("fadeout", 4, "TimerIntro");
}
if(asTimer == "fadeout") {
FadeOut(1);
AddTimer("fadein", 1, "TimerIntro");
AddLocalVarInt("Intro", 1);
}
}
else
{
TeleportPlayer("Spawn");
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrossHairIcons(true);
}
}
The Intro works fine. After the intro, the player stands in near of the entity "grandfather"

(04-22-2014, 02:41 PM)ShipinShen Wrote: Hey guys, I added an area and an entity for example the grandfather clock.
I named the Area "ClockChime", the PlayerInteractCallback "Clock" and the Clock "grandfather". The Sound name is "ClockChime.snt".

Quote:void OnStart()
{
AddEntityCollideCallback("Player", "ClockChime", "Clock", true, 1);
}

void Clock(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Clock", "ClockChime.snt", "grandfather", 1, false);
}

When i'm colliding with this area ingame, nothing happens.. where is my mistake ?

I know where the mistake is.. the sound file works fine, because when i'm writing PlaySoundAtEntity("Clock", "ClockChime.snt", "Player", 1, false); I can hear the noise, but i dont understand, why the sound doesnt work when i'm writing PlaySoundAtEntity("Clock", "ClockChime.snt", "grandfather", 1, false); the entity has the exact same name in the level editor and the same .snt settings than the phonogram, which works fine

I solved it, by adding an area which names "grandfather" !

ShipinShen - YouTube
(This post was last modified: 04-22-2014, 04:19 PM by ShipinShen.)
04-22-2014, 03:56 PM
Find


Messages In This Thread
Sound-Area doesn't work [Solved] - by ShipinShen - 04-22-2014, 02:41 PM
RE: Sound-Area doesn't work - by Mudbill - 04-22-2014, 02:51 PM
RE: Sound-Area doesn't work - by ShipinShen - 04-22-2014, 02:54 PM
RE: Sound-Area doesn't work - by Mudbill - 04-22-2014, 02:57 PM
RE: Sound-Area doesn't work - by ShipinShen - 04-22-2014, 03:00 PM
RE: Sound-Area doesn't work - by Daemian - 04-22-2014, 03:33 PM
RE: Sound-Area doesn't work - by ShipinShen - 04-22-2014, 03:56 PM
RE: Sound-Area doesn't work [Solved] - by Mudbill - 04-22-2014, 05:59 PM



Users browsing this thread: 1 Guest(s)