LDOriginal
Junior Member
Posts: 35
Threads: 7
Joined: Oct 2014
Reputation:
0
|
No sound playing in script area
Ok, so i've come to realise scripting isn't for the average idiot. I've been trying to figure out exactly what i'm doing wrong here but i just don't know what to do anymore. I know there's plenty of info on scripting but it's really not working. I think some examples would do me better. Would you please take a look at my script and see what's wrong? I would really appreciate it!
void OnStart()
{
AddEntityCollideCallback("Player", "Ljud", "start", true, 1);
AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true);
AddUseItemCallback("", "Nyckel", "Rumpa", "UseKeyOnDoor", true);
AddUseItemCallback("", "Tillskåp", "Skåp", "UseKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "Unlock_door.snt", asEntity, 10, false);
RemoveItem(asItem);
PlaySoundAtEntity("", "25_strain_wood.snt", "Player", 0.0f, false);
}
|
|
10-07-2014, 07:03 PM |
|
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
|
RE: No sound playing in script area
You used a capital in the play sound. Change it to "unlock_door.snt" and you should be golden.
Derp.
|
|
10-07-2014, 07:43 PM |
|
LDOriginal
Junior Member
Posts: 35
Threads: 7
Joined: Oct 2014
Reputation:
0
|
RE: No sound playing in script area
(10-07-2014, 07:43 PM)Neelke Wrote: You used a capital in the play sound. Change it to "unlock_door.snt" and you should be golden.
Got fatal error by that:
main (19,2) : ERR : No matching signatures to
'PlaysoundAtEntity(string@&, string@&, string@&, const float, const bool)'
I don't have any problems with the doors and keys. It's just a certain area on the map wich i've placed a script area and it doesn't play the sound when i enter it.
(This post was last modified: 10-07-2014, 07:55 PM by LDOriginal.)
|
|
10-07-2014, 07:53 PM |
|
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
|
RE: No sound playing in script area
Then you must have accidently deleted something. Mind showing me how it currently looks like?
Derp.
|
|
10-07-2014, 07:59 PM |
|
LDOriginal
Junior Member
Posts: 35
Threads: 7
Joined: Oct 2014
Reputation:
0
|
RE: No sound playing in script area
(10-07-2014, 07:59 PM)Neelke Wrote: Then you must have accidently deleted something. Mind showing me how it currently looks like?
Sure, how would we go about doing that?
|
|
10-07-2014, 08:07 PM |
|
Neelke
Senior Member
Posts: 668
Threads: 82
Joined: Apr 2013
Reputation:
26
|
RE: No sound playing in script area
There might just be a quote you accidently deleted while changing this. Just post the script after this change.
Derp.
|
|
10-07-2014, 08:10 PM |
|
LDOriginal
Junior Member
Posts: 35
Threads: 7
Joined: Oct 2014
Reputation:
0
|
RE: No sound playing in script area
(10-07-2014, 08:10 PM)Neelke Wrote: There might just be a quote you accidently deleted while changing this. Just post the script after this change.
void OnStart()
{
AddEntityCollideCallback("Player", "Ljud", "start", true, 1);
AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true);
AddUseItemCallback("", "Nyckel", "Rumpa", "UseKeyOnDoor", true);
AddUseItemCallback("", "Tillskåp", "Skåp", "UseKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaysoundAtEntity("", "unlock_door.snt", asEntity, 10, false);
RemoveItem(asItem);
PlaysoundAtEntity("", "25_strain_wood.snt", "Player", 0.0f, false);
}
|
|
10-07-2014, 08:20 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: No sound playing in script area
You still need a capital S in PlaySoundAtEntity.
Trying is the first step to success.
|
|
10-07-2014, 08:35 PM |
|
Radical Batz
Posting Freak
Posts: 953
Threads: 145
Joined: Dec 2013
Reputation:
25
|
RE: No sound playing in script area
The s in PlaySoundAtEntity should be with a capital as Flawless mentioned, fixed it for ya even tho it's easy to do XD
void OnStart() {
AddEntityCollideCallback("Player", "Ljud", "start", true, 1); AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true); AddUseItemCallback("", "Nyckel", "Rumpa", "UseKeyOnDoor", true); AddUseItemCallback("", "Tillskåp", "Skåp", "UseKeyOnDoor", true); }
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{ SetSwingDoorLocked(asEntity, false, true); PlaySoundAtEntity("", "unlock_door.snt", asEntity, 10, false); RemoveItem(asItem);
PlaySoundAtEntity("", "25_strain_wood.snt", "Player", 0.0f, false);
}
(This post was last modified: 10-07-2014, 08:37 PM by Radical Batz.)
|
|
10-07-2014, 08:37 PM |
|
LDOriginal
Junior Member
Posts: 35
Threads: 7
Joined: Oct 2014
Reputation:
0
|
RE: No sound playing in script area
(10-07-2014, 08:35 PM)FlawlessHappiness Wrote: You still need a capital S in PlaySoundAtEntity.
Figured that since it won't run without it. Is there anything besides that, that seem misplaced to you or out of the ordinary?
|
|
10-07-2014, 08:38 PM |
|
|