Frictional Games Forum (read-only)
Lever when pull play sound - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Lever when pull play sound (/thread-21161.html)

Pages: 1 2


Lever when pull play sound - Hauken - 04-13-2013

Hi

Im trying to connect a lever to a door which is working
However i want a sound to play once i pull it, I've been messing around looking at the script wiki page but after I did this i get a error token saying 9,1 "{" is wrong.

Code:
void OnStart()
{
    InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
    PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
}

void SetEntityPlayerInteractCallback("","Soundlever", true);

{
    PlaySoundAtEntity("","quest_completed.snt","slidedoor");
}

Currently i have a simple lever connected to a door, it is facing upwards and if i pull it it will stuck and the door opens. Easy and working.

The trouble is the sound i want to play when pull!

Im sure you guys can see the problem already Angel

Edit: the Playmusic is just temp so it wont be so silent when im testing around..


RE: Lever when pull play sound - The chaser - 04-13-2013

(04-13-2013, 10:19 PM)Hauken Wrote: Hi

Im trying to connect a lever to a door which is working
However i want a sound to play once i pull it, I've been messing around looking at the script wiki page but after I did this i get a error token saying 9,1 "{" is wrong.

Code:
void OnStart()
{
    InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
    PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
}

void SetEntityPlayerInteractCallback("","Soundlever", true);

{
    PlaySoundAtEntity("","quest_completed.snt","slidedoor");
}

Currently i have a simple lever connected to a door, it is facing upwards and if i pull it it will stuck and the door opens. Easy and working.

The trouble is the sound i want to play when pull!

Im sure you guys can see the problem already Angel

Edit: the Playmusic is just temp so it wont be so silent when im testing around..

void OnStart()
{
InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1);
}

void DoSound (string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("","quest_completed.snt","slidedoor");
}

Make an area which is IN the slidedoor. Scale it enough so that when the slide door reaches the top, the area finishes. The -1 that I used in the CollideCallback function means that when slidedoor goes out of the area, the sound will happen.


RE: Lever when pull play sound - Hauken - 04-13-2013

I will try this

Thanks for response!


RE: Lever when pull play sound - The chaser - 04-13-2013

I'm here to help Wink


RE: Lever when pull play sound - Hauken - 04-13-2013

[Image: kcjdyr.png]

This was the result, i also had the editor with the pic so you can the placement of the ScriptArea.

I know by the values provided from that fault message I should know where to fix but I am a big noob at this and im still learning. Confused

Save pic to see enlarged !

Code:
void OnStart()
{
    InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
    PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
    AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1);
}

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

{
PlaySoundAtEntity("","quest_completed.snt","slidedoor");
}



RE: Lever when pull play sound - The chaser - 04-13-2013

(04-13-2013, 10:48 PM)Hauken Wrote: [Image: kcjdyr.png]

This was the result, i also had the editor with the pic so you can the placement of the ScriptArea.

I know by the values provided from that fault message I should know where to fix but I am a big noob at this and im still learning. Confused

Save pic to see enlarged !

Code:
void OnStart()
{
    InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
    PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
    AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1);
}

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

{
PlaySoundAtEntity("","quest_completed.snt","slidedoor");
}

It should be:
Code:
void OnStart()
{
    InteractConnectPropWithMoveObject("","valve", "slidedoor",true, false, 0);
    PlayMusic("01_amb_darkness", true, 1, 0, 0, true);
    AddEntityCollideCallback("slidedoor", "AreaLeave", "DoSound", true, -1);
}

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

{
PlaySoundAtEntity("","quest_completed.snt","slidedoor", false);
}

The area should be where the door is in the beggining, like:

http://i.imgur.com/5oXViXg.jpg

Sorry, didn't find the slide door entity Tongue


RE: Lever when pull play sound - Hauken - 04-13-2013

[Image: aykls6.png]

The result with the exact copy paste you gave me.

slidedoor = my door entity
valve = my lever entity

PlaySoundAtEntity("","quest_completed.snt","slidedoor"

The fault obvioussly lies in that line...


RE: Lever when pull play sound - NaxEla - 04-13-2013

Try:

PlaySoundAtEntity("","quest_completed.snt","slidedoor", 0, false);


RE: Lever when pull play sound - Hauken - 04-13-2013

That solved the crash, the sound however doesn't work - I bet it has something to do with my scriptarea.

Let me mess around with it some time, I do need to call it "Arealeave" right?

Ok, thanks to both of you!

This script is fully functional now, now I just need some smoke effects and sanity boost and im there.
Aint to hard to do is it?


RE: Lever when pull play sound - NaxEla - 04-13-2013

In chaser's script, it's "AreaLeave" (with a capital L)