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
Script Help No sound playing in script area
LDOriginal Offline
Junior Member

Posts: 35
Threads: 7
Joined: Oct 2014
Reputation: 0
#1
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! Smile

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
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#2
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
Find
LDOriginal Offline
Junior Member

Posts: 35
Threads: 7
Joined: Oct 2014
Reputation: 0
#3
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
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#4
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
Find
LDOriginal Offline
Junior Member

Posts: 35
Threads: 7
Joined: Oct 2014
Reputation: 0
#5
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
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#6
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
Find
LDOriginal Offline
Junior Member

Posts: 35
Threads: 7
Joined: Oct 2014
Reputation: 0
#7
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
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
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#9
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

PHP Code: (Select All)
void OnStart()


AddEntityCollideCallback("Player""Ljud""start"true1);
AddUseItemCallback("""Key""Door""UseKeyOnDoor"true);
AddUseItemCallback("""Nyckel""Rumpa""UseKeyOnDoor"true);
AddUseItemCallback("""Tillskåp""Skåp""UseKeyOnDoor"true);
}

void UseKeyOnDoor(string &in asItemstring &in asEntity)



{
SetSwingDoorLocked(asEntityfalsetrue);
PlaySoundAtEntity("""unlock_door.snt"asEntity10false);
RemoveItem(asItem);

PlaySoundAtEntity("""25_strain_wood.snt""Player"0.0ffalse);



(This post was last modified: 10-07-2014, 08:37 PM by Radical Batz.)
10-07-2014, 08:37 PM
Find
LDOriginal Offline
Junior Member

Posts: 35
Threads: 7
Joined: Oct 2014
Reputation: 0
#10
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
Find




Users browsing this thread: 1 Guest(s)