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
#1
sound problems

Hay guys i have been working on some sound scripts, and really have no idea what im doing. Here is my code. Would you guys tell me that im doing wrong? This is the first time i have done any of this kind of stuff so I dont know what even to ask.
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "doorslam_1","Collidedoorslam", true, -1);
}

void Collidedoorslam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Room_2", true, true);
}

void ScaryVoice()
{
AddEntityCollideCallback("Player", "Room_2","PlaySoundAtEntity", true, -1);
}

void PlaySoundAtEntity(string &in asItem, string &in asEntity)

{
PlaySoundAtEntity("Player", "amb_hunt01", "Door_2", 0, false);

}

////////////////////////////
// Run when entering map
void OnEnter()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
(This post was last modified: 12-01-2010, 07:46 PM by THE/ILL/WILL.)
12-01-2010, 07:44 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#2
RE: sound problems

Callbacks ALWAYS go in OnStart (well, not always, but for your skill level) or they'll never be executed at all.

The PlaySoundAtEntity Func is... ugh.

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam", true, -1);

AddEntityCollideCallback("Player", "Room_2", "PlaySoundAtEntity", true, -1);

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}

void Collidedoorslam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Room_2", true, true);
}

void PlaySoundAtEntity(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Player", "amb_hunt01", "Door_2", 0, false);
}

////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
12-01-2010, 07:56 PM
Find
THE/ILL/WILL Offline
Junior Member

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

hay I rewrote it to look like this and now its telling me i have an u uexpected {

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "doorslam_1","Collidedoorslam", true, -1);

AddEntityCollideCallback("Player", "Growl_1", "CollidePlayGuiSound", true, -1);
}

void Collidedoorslam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Room_2", true, true);
}

void CollidePlayGuiSound();
{
PlayGuiSound("amb_hunt01", 10.0f);
}

////////////////////////////
// Run when entering map
void OnEnter()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
(This post was last modified: 12-01-2010, 08:24 PM by THE/ILL/WILL.)
12-01-2010, 08:22 PM
Find
LoneWolf Offline
Senior Member

Posts: 308
Threads: 43
Joined: Sep 2010
Reputation: 0
#4
RE: sound problems

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}






this part, maybe try deleting a couple of the }


to this:

if(ScriptDebugOn())

GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");

}
12-01-2010, 08:27 PM
Find
THE/ILL/WILL Offline
Junior Member

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

it says that the error is on line 16 this void function is on line 15.
void CollidePlayGuiSound( );
{
PlayGuiSound("amb_hunt01", 10.0f);
}
12-01-2010, 08:34 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#6
RE: sound problems

Remove that semicolon after CollidePlayGuiSound()


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
12-01-2010, 08:47 PM
Find
THE/ILL/WILL Offline
Junior Member

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

that got the game to load but im still not geting the sound for the door. hmm i cant think of anything else to do i have been rewriteing this line over and over for 3 hours haha.
ok wow now i can hear this really scatchy noise (defenently not the one im trying to put in) as soon as i spawn in but whent i head over to the trigger area nothing happens. Sad
(This post was last modified: 12-01-2010, 09:10 PM by THE/ILL/WILL.)
12-01-2010, 08:58 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#8
RE: sound problems

Use debug mode (F1) and activate debug messages. Then use AddDebugMessage (look in the Script Functions section of the wiki) to check if your area is triggered properly.

Two things:

Why are you using PlayGuiSound? Just use PlaySoundAtEntity with the entity being "Player". Also, a fade-in of 10 seconds will probably render it way too quiet..


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
12-01-2010, 09:13 PM
Find
THE/ILL/WILL Offline
Junior Member

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

ok i changed the scripts for the PlaySoundAtEntity. i also ran the game with the debug panel there is alot of stuff on there what exacly am i looking for?

oh an by the way thanks for all the help so far :)
12-01-2010, 10:01 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#10
RE: sound problems

You're looking for this.

Debugging works like this:

AddDebugMessage(string& asString, bool abCheckForDuplicates);

The string is just the message you want to show up (it shows up in the bottom left of the screen), eg. "It works!". The boolean please set to false.

Put the AddDebugMessage in the function your Callback calls, CollidePlayGuiSound or whatever you've named it now in this case.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
12-01-2010, 10:07 PM
Find




Users browsing this thread: 1 Guest(s)