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
2 Problems, (Playing a sound and Lightning (spotlight)) [BOTH SOLVED!!]
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#1
2 Problems, (Playing a sound and Lightning (spotlight)) [BOTH SOLVED!!]

Hello,

I would like to start off that I'm kind off new to the scripting/programming world but I do enjoy it.

I have a problem.

I am trying to get familiar with the HPL Engine Tools,
and I am making a story with which ill learn to use the editor and how to create a good story.. etc.etc.

now I made a stairs with a door on the right side and a door on the left side.

The door on the left side is locked but when you interact with it it should also play a sound of Wooden / Metal break ("sounds\break\break_wood_metal1.ogg")

but I just cant figure out how to make it work.

I followed both the tutorials on the wiki and I really can't figure out how to use it, also I looked into the code of the main story line made by Frictional Games themselfes and I still can't figure it out.

So now I tried to just play the sound when the player enters the map / game and I can't get that to work either.

so I would really like to see a few more tutorials for me (and probarly others) so we can create a real cool game together. Big Grin Tongue

And my second problem is I used a spot light. followed the tutorial set everything up like it had to and I can't get that to work either (I didn't script anything for the spotlight. I couldn't find anything that says I have to so maybe that is the problem?

Anyway, I'm looking forward to hear from you guys again and thanks in advance!! Heart Big Grin

Thanks Frictional Games for this awesome game!!

(PS, I don't know if you guys want my code I have right now just let me know ill post it as fast as possible)

EDIT1:
I just launched up my map again and for some reason the light is working right now so. That's solved!!
(This post was last modified: 12-23-2010, 11:26 PM by bigfoot.)
12-23-2010, 09:59 PM
Find
Dark88 Offline
Junior Member

Posts: 48
Threads: 6
Joined: Dec 2010
Reputation: 0
#2
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

For the sound issue I had this problem alot until after trial and error I seemed to get it to work using the function;

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

for string &in asSoundFile I kept using the file name for the .ogg like this "break_wood_metal1.ogg" When really you want to play the .snt file there. In this case you'd put "break_wood_metal" and that's it.

If you only want to play the break_wood_metal1.ogg you can modify the .snt file and create a new one by deleting all the sound entries in the .snt in a text editor and leave only the one you want to play but you'll have to include it in a seperate folder for your release I believe.

Hope this helps with your playing sounds issue. Smile
(This post was last modified: 12-23-2010, 10:34 PM by Dark88.)
12-23-2010, 10:34 PM
Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#3
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

(12-23-2010, 10:34 PM)Dark88 Wrote: For the sound issue I had this problem alot until after trial and error I seemed to get it to work using the function;

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

for string &in asSoundFile I kept using the file name for the .ogg like this "break_wood_metal1.ogg" When really you want to play the .snt file there. In this case you'd put "break_wood_metal" and that's it.

If you only want to play the break_wood_metal1.ogg you can modify the .snt file and create a new one by deleting all the sound entries in the .snt in a text editor and leave only the one you want to play but you'll have to include it in a seperate folder for your release I believe.

Hope this helps with your playing sounds issue. Smile

Wow, I only understood you till "for string &in asSoundFile" lol :p, ah well.
I guess ill understand it eventually ^^ Thanks a lot man.!! Heart

EDIT1:
Ok I still can't really figure it out hehe.
Do I need more lines of code for this to work?

I just did it like this right now.

void OnEnter(){
PlaySoundAtEntity("sounds\break\break_wood_metal1","break_wood_metal1","FirstLockedDoor",2.0f,false);
}
(This post was last modified: 12-23-2010, 10:39 PM by bigfoot.)
12-23-2010, 10:35 PM
Find
Dark88 Offline
Junior Member

Posts: 48
Threads: 6
Joined: Dec 2010
Reputation: 0
#4
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

(12-23-2010, 10:35 PM)bigfoot Wrote:
(12-23-2010, 10:34 PM)Dark88 Wrote: For the sound issue I had this problem alot until after trial and error I seemed to get it to work using the function;

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

for string &in asSoundFile I kept using the file name for the .ogg like this "break_wood_metal1.ogg" When really you want to play the .snt file there. In this case you'd put "break_wood_metal" and that's it.

If you only want to play the break_wood_metal1.ogg you can modify the .snt file and create a new one by deleting all the sound entries in the .snt in a text editor and leave only the one you want to play but you'll have to include it in a seperate folder for your release I believe.

Hope this helps with your playing sounds issue. Smile

Wow, I only understood you till "for string &in asSoundFile" lol :p, ah well.
I guess ill understand it eventually ^^ Thanks a lot man.!! Heart

LOL Big Grin Basically just put "break_wood_metal" for the soundfile you want played and you should be good to go.
12-23-2010, 10:38 PM
Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#5
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

(12-23-2010, 10:38 PM)Dark88 Wrote:
(12-23-2010, 10:35 PM)bigfoot Wrote:
(12-23-2010, 10:34 PM)Dark88 Wrote: For the sound issue I had this problem alot until after trial and error I seemed to get it to work using the function;

PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

for string &in asSoundFile I kept using the file name for the .ogg like this "break_wood_metal1.ogg" When really you want to play the .snt file there. In this case you'd put "break_wood_metal" and that's it.

If you only want to play the break_wood_metal1.ogg you can modify the .snt file and create a new one by deleting all the sound entries in the .snt in a text editor and leave only the one you want to play but you'll have to include it in a seperate folder for your release I believe.

Hope this helps with your playing sounds issue. Smile

Wow, I only understood you till "for string &in asSoundFile" lol :p, ah well.
I guess ill understand it eventually ^^ Thanks a lot man.!! Heart

LOL Big Grin Basically just put "break_wood_metal" for the soundfile you want played and you should be good to go.

Hehe (I edited my other post I didn't see your new post hehe)

but ontopic.

Ok so I just put break_wood_metal instead of my old path?,
Ok thats easy hehe and stupid lol.

anyway, I also actually want to know what all the parameters mean.

"PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);"

string& asSoundName - What does it do / mean?
string& asSoundFile - What does this do / mean?
string& asEntity - And this?
float afFade.. etc. etc.

EDIT2:
Ok I got the sound working when I just entered the map / level.

So how would I make it play when I interact with the door?.

"Let me try":
In the level editor at the door set the interact call back option to like : FirstLockedDoorScare.

then script:
void FirstLockedDoorScare(){
PlaySoundAtEntity(blabla)
}
?? hehe
(This post was last modified: 12-23-2010, 10:50 PM by bigfoot.)
12-23-2010, 10:43 PM
Find
Dark88 Offline
Junior Member

Posts: 48
Threads: 6
Joined: Dec 2010
Reputation: 0
#6
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

(12-23-2010, 10:43 PM)bigfoot Wrote: Hehe (I edited my other post I didn't see your new post hehe)

but ontopic.

Ok so I just put break_wood_metal instead of my old path?,
Ok thats easy hehe and stupid lol.

anyway, I also actually want to know what all the parameters mean.

"PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);"

string& asSoundName - What does it do / mean?
string& asSoundFile - What does this do / mean?
string& asEntity - And this?
float afFade.. etc. etc.

string& asSoundName - is just the name of the sound in your custom story honestly you could leave it as just "", if you really wanted to.

string& asSoundFile - the sound file in this case "break_wood_metal" always the .snt file in the sound folders minus the file extension although it may work with the extension

string& asEntity - Where the sound originates for instance if you want it to originate from a door you called for conveniences sake door you'd put "door"

float afFadeTime - this I believe its how long you want the sound to take to fade in I usually just leave it as 0

bool abSaveSound - I guess it saves it I don't honestly know I just always set it to false

In the end you should have a function similar to this

"PlaySoundAtEntity("", "break_wood_metal", "door", 0, false);"
12-23-2010, 10:52 PM
Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#7
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

Ok thanks man.
and I don't know if you read my Second edit in my last post. But is there anything else needed to make it work when the player interacts with the door?
12-23-2010, 10:55 PM
Find
Dark88 Offline
Junior Member

Posts: 48
Threads: 6
Joined: Dec 2010
Reputation: 0
#8
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

(12-23-2010, 10:43 PM)bigfoot Wrote: "Let me try":
In the level editor at the door set the interact call back option to like : FirstLockedDoorScare.

then script:
void FirstLockedDoorScare(){
PlaySoundAtEntity(blabla)
}
?? hehe

That should work you just have to make sure the syntax of the function is correct in this instance
void FirstLockedDoorScare(string &in asEntity)
{
PlaySoundAtEntity(blabla)
}

also in that instance if you want for the string &in asEntity section of your PlaySoundAtEntity() you can just put asEntity without quotations
12-23-2010, 10:57 PM
Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#9
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

(12-23-2010, 10:57 PM)Dark88 Wrote:
(12-23-2010, 10:43 PM)bigfoot Wrote: "Let me try":
In the level editor at the door set the interact call back option to like : FirstLockedDoorScare.

then script:
void FirstLockedDoorScare(){
PlaySoundAtEntity(blabla)
}
?? hehe

That should work you just have to make sure the syntax of the function is correct in this instance
void FirstLockedDoorScare(string &in asEntity)
{
PlaySoundAtEntity(blabla)
}

also in that instance if you want for the string &in asEntity section of your PlaySoundAtEntity() you can just put asEntity without quotations

So I would just replace string &in asEntity (the one in the void FirstLockedDoorScare(this one)) with the door name? and then playsound at entity?

Thanks man Big Grin you deserve rep!

EDIT1:
Forget what I said it's working. but only if I make it so the callback won't be removed. (It's an option inside the LEVEL EDITOR)

But I actually want it to only be able to happen once.
Is there a special function that would do this? (Maybe to delete the sound of delete the callback?

Oh 1 more thing. I read somewhere that there is a function page which shows all the function but I can't find it.

Do you maybe know where I could find it?

Thanks in advance
(This post was last modified: 12-23-2010, 11:08 PM by bigfoot.)
12-23-2010, 11:04 PM
Find
Dark88 Offline
Junior Member

Posts: 48
Threads: 6
Joined: Dec 2010
Reputation: 0
#10
RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED

(12-23-2010, 11:04 PM)bigfoot Wrote:
(12-23-2010, 10:57 PM)Dark88 Wrote:
(12-23-2010, 10:43 PM)bigfoot Wrote: "Let me try":
In the level editor at the door set the interact call back option to like : FirstLockedDoorScare.

then script:
void FirstLockedDoorScare(){
PlaySoundAtEntity(blabla)
}
?? hehe

That should work you just have to make sure the syntax of the function is correct in this instance
void FirstLockedDoorScare(string &in asEntity)
{
PlaySoundAtEntity(blabla)
}

also in that instance if you want for the string &in asEntity section of your PlaySoundAtEntity() you can just put asEntity without quotations

So I would just replace string &in asEntity (the one in the void FirstLockedDoorScare(this one)) with the door name? and then playsound at entity?

Thanks man Big Grin you deserve rep!

You're welcome, bro. I'm just glad I can help a fellow beginner.

Anyways, You replace the one in the PlaySoundAtEntity like this

PlaySoundAtEntity("", "break_wood_metal", asEntity, 0, false);
Edit: or this
PlaySoundAtEntity("", "break_wood_metal", "door", 0, false);

the function remains void FirstLockedDoorScare(string &in asEntity)
(This post was last modified: 12-23-2010, 11:11 PM by Dark88.)
12-23-2010, 11:08 PM
Find




Users browsing this thread: 1 Guest(s)