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
sound problems
THE/ILL/WILL Offline
Junior Member

Posts: 11
Threads: 4
Joined: Dec 2010
Reputation: 0
#11
RE: sound problems

so i rewrote all the stuff like this and now its giveing me ( errors. i think im grouping wrong anyone have some pointers?
////////////////////////////
// Run first time starting map
void OnStart()
{

{
AddUseItemCallback( "", "DoorKey_1", "Door_3", "UseKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("DoorKey_1");
}
{
[color=#FFD700]AddEntityCollideCallback("Player", "doorslam_1","Collidedoorslam", true, -1);
}
void Collidedoorslam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Room_2", true, true);
PlaySoundAtEntity("", "amb_hunt01", "Player", 0, false);
}
{
AddEntityCollideCallback("Player", "Unlock_1","Room2Unlock", true, 1);
}
void Room2Unlock(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("Room_2", true, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
}

}
12-02-2010, 03:02 AM
Find
Oscar House Offline
Senior Member

Posts: 302
Threads: 3
Joined: Nov 2010
Reputation: 9
#12
RE: sound problems

Why do you have everything inside OnStart()?

[Image: 2exldzm.png]
12-02-2010, 03:49 PM
Find
Akumasama Offline
Member

Posts: 122
Threads: 2
Joined: Nov 2010
Reputation: 0
#13
RE: sound problems

^This.

The functions should be in onEnter(){
AddEntityCollideCallback("Player", "soundtrigger1", "soundtrigger1activate", true, 1);
Such as that.

Then in no category, you place the syntaxes with what you want it to do.
void soundtrigger1activate(string &in asParent, string &in asChild, int alState)
{
stuff that happens
for example:
PlayGuiSound("guardian_activated.snt", 1)
}

STUFF THATS WRONG:

Sound files need the ".snt" after the file you want to play. (Look in the actual folder to see if you have the right file.)
You have a function inside a function (void inside of a function), this isn't possible.

void OnStart()
{ ///STUFF TO ACTIVATE FUNCTIONS HERE
AddUseItemCallback( "", "DoorKey_1", "Door_3", "UseKeyOnDoor", true);
AddEntityCollideCallback("Player", "doorslam_1","Collidedoorslam", true, -1);
AddEntityCollideCallback("Player", "Unlock_1","Room2Unlock", true, 1);
}

///THE ACTUAL FUNCTIONS GO HERE
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_3", false, true);
PlayGuiSound("unlock_door.snt", 1f);
RemoveItem("DoorKey_1");
}

void Collidedoorslam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Room_2", true, true);
PlayGuiSound("amb_hunt01.snt", 1f);
}

void Room2Unlock(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("Room_2", true, true);
PlayGuiSound("unlock_door.snt", 1f);
}
That would make the correct script. (There might be problems, just did this real quick.)
I just rearranged it real quick.
Also, PlayGuiSound is alot easier to use than PlaySoundAtEntity.
(This post was last modified: 12-02-2010, 04:15 PM by Akumasama.)
12-02-2010, 04:04 PM
Find




Users browsing this thread: 1 Guest(s)