2 Problems, (Playing a sound and Lightning (spotlight)) [BOTH SOLVED!!] - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: 2 Problems, (Playing a sound and Lightning (spotlight)) [BOTH SOLVED!!] (/thread-5858.html) Pages:
1
2
|
2 Problems, (Playing a sound and Lightning (spotlight)) [BOTH SOLVED!!] - bigfoot - 12-23-2010 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. 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!! 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!! RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - Dark88 - 12-23-2010 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. RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - bigfoot - 12-23-2010 (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; Wow, I only understood you till "for string &in asSoundFile" lol :p, ah well. I guess ill understand it eventually ^^ Thanks a lot man.!! 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. Code: void OnEnter(){ RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - Dark88 - 12-23-2010 (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; LOL Basically just put "break_wood_metal" for the soundfile you want played and you should be good to go. RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - bigfoot - 12-23-2010 (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; 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: Code: void FirstLockedDoorScare(){ RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - Dark88 - 12-23-2010 (12-23-2010, 10:43 PM)bigfoot Wrote: Hehe (I edited my other post I didn't see your new post hehe) 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);" RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - bigfoot - 12-23-2010 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? RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - Dark88 - 12-23-2010 (12-23-2010, 10:43 PM)bigfoot Wrote: "Let me try": 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 RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - bigfoot - 12-23-2010 (12-23-2010, 10:57 PM)Dark88 Wrote:(12-23-2010, 10:43 PM)bigfoot Wrote: "Let me try": 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 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 RE: 2 Problems, (Playing a sound and Lightning (spotlight)) Light is SOLVED - Dark88 - 12-23-2010 (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": 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) |