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
Lever when pull play sound
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#1
Lever when pull play sound

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.

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..
(This post was last modified: 04-14-2013, 12:25 AM by Hauken.)
04-13-2013, 10:19 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: Lever when pull play sound

(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.

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.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
(This post was last modified: 04-13-2013, 10:37 PM by The chaser.)
04-13-2013, 10:37 PM
Find
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#3
RE: Lever when pull play sound

I will try this

Thanks for response!
04-13-2013, 10:38 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#4
RE: Lever when pull play sound

I'm here to help Wink

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
04-13-2013, 10:42 PM
Find
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#5
RE: Lever when pull play sound

[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 !

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");
}
(This post was last modified: 04-13-2013, 10:52 PM by Hauken.)
04-13-2013, 10:48 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#6
RE: Lever when pull play sound

(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 !

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:
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

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
04-13-2013, 11:06 PM
Find
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#7
RE: Lever when pull play sound

[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...
(This post was last modified: 04-13-2013, 11:29 PM by Hauken.)
04-13-2013, 11:26 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#8
RE: Lever when pull play sound

Try:

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

In Ruins [WIP]
04-13-2013, 11:42 PM
Find
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#9
RE: Lever when pull play sound

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?
(This post was last modified: 04-13-2013, 11:58 PM by Hauken.)
04-13-2013, 11:51 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#10
RE: Lever when pull play sound

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

In Ruins [WIP]
04-13-2013, 11:58 PM
Find




Users browsing this thread: 1 Guest(s)