Frictional Games Forum (read-only)

Full Version: No sound playing in script area
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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);

}
You used a capital in the play sound. Change it to "unlock_door.snt" and you should be golden.
(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.
Then you must have accidently deleted something. Mind showing me how it currently looks like?
(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?
There might just be a quote you accidently deleted while changing this. Just post the script after this change.
(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);

}
You still need a capital S in PlaySoundAtEntity.
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:
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);


(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?
Pages: 1 2 3