Frictional Games Forum (read-only)
Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Cant have PlaySoundAtEntity with SetSwingDoorClosed? (/thread-7819.html)

Pages: 1 2


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Ge15t - 05-05-2011

(05-05-2011, 09:21 AM)ricky horror Wrote:
Code:
void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("StartDoor2", false, true);
    PlaySoundAtEntity("", "unlock_door", "StartDoor2", 0, false);

this is actual scripting from the conversion i'm working on
works fine for me

make sure that the third thing typed in (the one next to "unlock_door") is the actual name of the door

other than that, i have no idea why it's not working :/

Yeah see that works for the door unlock noise, thats no problem, its just the door slam noise thats supposed to accompany it.

I even made a separate area with a different sound:

Code:
void CollideRoomTwoWind(string &in asParent, string &in asChild, int alState)
{

    PlaySoundAtEntity("", "general_wind_whirl.snt", "mansion_1", 0, false);
    
}

And this STILL doesnt work. Is there any config file that points to where the sound files are supposed to be located so I can check if thats the problem?

EDIT: Yeah i tried that one as well, thats what the code originally looked like


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - ricky horror - 05-05-2011

(05-05-2011, 09:28 AM)Ge15t Wrote:
(05-05-2011, 09:21 AM)ricky horror Wrote:
Code:
void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("StartDoor2", false, true);
    PlaySoundAtEntity("", "unlock_door", "StartDoor2", 0, false);

this is actual scripting from the conversion i'm working on
works fine for me

make sure that the third thing typed in (the one next to "unlock_door") is the actual name of the door

other than that, i have no idea why it's not working :/

Yeah see that works for the door unlock noise, thats no problem, its just the door slam noise thats supposed to accompany it.

I even made a separate area with a different sound:

Code:
void CollideRoomTwoWind(string &in asParent, string &in asChild, int alState)
{

    PlaySoundAtEntity("", "general_wind_whirl.snt", "mansion_1", 0, false);
    
}

And this STILL doesnt work. Is there any config file that points to where the sound files are supposed to be located so I can check if thats the problem?

EDIT: Yeah i tried that one as well, thats what the code originally looked like

are you sure the sounds you're trying to use have a .snt file? if not, make one


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Ge15t - 05-05-2011

Aha! Figured out what the problem was, my 'reload map' debug menu option was reloading an old version of the map since i transfered it over to the custom_story folder to make it a custom story rather than a map. ALl working now except for extra_english.lang stuff.. but ill get it working. Thanks guys for the help!


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Ge15t - 05-05-2011

Ok this is my new problem:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "CandleArea", "BlowOutCandles", true, 1);

}

void BlowOutCandles(string &in entity)
{

    SetLampLit("blowout_1", false, false);
    SetLampLit("blowout_2", false, false);

}

Ok so im trying to get candles to 'blowout' when i collide with the CandleArea script. The game loads but nothing happens when I enter the area.. not too sure whats going on here


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - cook - 05-05-2011

void chasesequence2(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("", "ps_break_wood.ps", "scaretriggerchasesound_1", false);
CreateParticleSystemAtEntity("", "ps_door_damage_wood.ps", "scaretriggerchasesound_1", false);
PlaySoundAtEntity("", "break_wood.snt", "scaretriggerchasesound_1", 0.0f, false);
SetEntityActive("scaredoor3", false);
SetEntityActive("scarestatue13", true);
SetLampLit("scarelantern1", false, true);
PlaySoundAtEntity("scrapesound8", "scrape_rock.ogg", "statuetriggerchase_1", 0.0f, false);
AddTimer("", 1, "stopscrape8");
}

There's one of mine, works. Your problem is you are using the entity interact callback syntax and not the trigger callback syntax, shown in my script.

(string &in asParent, string &in asChild, int alState)


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Roenlond - 05-05-2011

(05-05-2011, 11:35 AM)Ge15t Wrote: Ok this is my new problem:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "CandleArea", "BlowOutCandles", true, 1);

}

void BlowOutCandles(string &in entity)
{

    SetLampLit("blowout_1", false, false);
    SetLampLit("blowout_2", false, false);

}

Ok so im trying to get candles to 'blowout' when i collide with the CandleArea script. The game loads but nothing happens when I enter the area.. not too sure whats going on here

The function is not getting called because the syntax (the part after BlowOutCandles in parantheses) is wrong. Since the callback is AddEntityCollideCallback, the syntax should be "(string &in asParent, string &in asChild, int alState)"

That should fix it Smile