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
Edit: the Playmusic is just temp so it wont be so silent when im testing around..
(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
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.
I will try this
Thanks for response!
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.
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");
}
(04-13-2013, 10:48 PM)Hauken Wrote: [ -> ]
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.
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
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...
Try:
PlaySoundAtEntity("","quest_completed.snt","slidedoor", 0, false);
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?
In chaser's script, it's "AreaLeave" (with a capital L)