![]() |
HELP!!! - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: HELP!!! (/thread-14851.html) |
HELP!!! - JPPSJ - 04-16-2012 I need desparate help with scripting!!! Ive watched alot of videos and have done everything they have said and it does not work at all! Even the most simple things! please help! RE: HELP!!! - Putmalk - 04-17-2012 Please calm down and explain your problem so we can help you. RE: HELP!!! - JPPSJ - 04-17-2012 (04-17-2012, 12:01 AM)Putmalk Wrote: Please calm down and explain your problem so we can help you.Sorry i was emphasizing my anger, ive tryed to do scripting on my custom map as in "Flying jesus" amd door slams ect. but NONE of my scripting attempts have worked. I even tryed to do the beginning script to give the player a lanturn and tat dident work either. im at a loss. RE: HELP!!! - MrIcabod123 - 04-17-2012 (04-17-2012, 12:06 AM)JPPSJ Wrote:Don't dive into the deep end without learning how to swim.(04-17-2012, 12:01 AM)Putmalk Wrote: Please calm down and explain your problem so we can help you.Sorry i was emphasizing my anger, ive tryed to do scripting on my custom map as in "Flying jesus" amd door slams ect. but NONE of my scripting attempts have worked. I even tryed to do the beginning script to give the player a lanturn and tat dident work either. im at a loss. RE: HELP!!! - JPPSJ - 04-17-2012 (04-17-2012, 12:12 AM)MrIcabod123 Wrote:ok i understand that now, i even tyred the beginner tutorial on the wiki and it dident work, is there anyway you can help explain scripting to me? or refer me to sombody other than ELVEN because nomatter how ard i consetrate i cannot understand him.(04-17-2012, 12:06 AM)JPPSJ Wrote:Don't dive into the deep end without learning how to swim.(04-17-2012, 12:01 AM)Putmalk Wrote: Please calm down and explain your problem so we can help you.Sorry i was emphasizing my anger, ive tryed to do scripting on my custom map as in "Flying jesus" amd door slams ect. but NONE of my scripting attempts have worked. I even tryed to do the beginning script to give the player a lanturn and tat dident work either. im at a loss. RE: HELP!!! - Putmalk - 04-17-2012 Okay, let me do this as clear as possible. Do you know what a function is? Pretty much, any "scripting" we do on our maps are simply calling premade functions that do what we want them to do already. We start out every file with three functions: Code: void OnStart() That is how every script file should look. Everything inside the brackets "{""}" in the OnStart() function will happen the FIRST AND ONLY FIRST TIME you enter a map. Everything inside OnEnter() will happen EVERY TIME you enter the map. Everything inside OnLeave() happens every time you leave the map. This is the bare minimum for any map script file you want. I am not going to continue to post until you reply to this comment. RE: HELP!!! - JPPSJ - 04-17-2012 (04-17-2012, 12:19 AM)Putmalk Wrote: Okay, let me do this as clear as possible. im listining. (04-17-2012, 12:27 AM)JPPSJ Wrote:By the way thank you so much for helping me im at a huge loss.(04-17-2012, 12:19 AM)Putmalk Wrote: Okay, let me do this as clear as possible. RE: HELP!!! - Putmalk - 04-17-2012 I am not going to teach you how to do flying jesus's, as it's very annoying and not scary at all. What I am going to do is teach you how to slam your doors the way you want them to. Okay, so, we have our basic script file. You need to remember that every line of code (minus the function headers such as "OnStart()", etc, must end in ";" (that tells the computer to move on to the next line of code). I'm not going to explain loops and stuff, that can be covered at a different time in a different thread. So, our scenario: We want the player to come close to the door, and when he does, the door slams shut in his face! Included is a loud bang and a sanity drain. Here we have a list of functions: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions I could make you go down that list, but I'd rather just pinpoint all the functions we need. AddEntityCollideCallback(string parentname, string childname, string function, bool deleteoncollide, int alStates); GiveSanityDamage(float amount, bool UseEffects); PlaySoundAtEntity(string soundname, string soundfile, string entity, float fadetime, bool savesound); SetSwingDoorClosed(string name, bool closed, bool effects); Those are all the functions we need to complete our task. I know this looks weird. What do these functions do? AddEntityCollideCallback: We call this when the player touches another entity (such as a script area), and when he does, we fire a function with a name that we specify. GiveSanityDamage: We deal a specific amount of sanity damage (good values: 5-20) to the player and we can choose whether to show an effect or not. PlaySoundAtEntity: We play a sound from the sound folder in the Amnesia directory. We can set several values here, such as how fast it fades and where the sound is played. SetSwingDoorClosed: We swing the door closed as fast as we can. This is only step one of the process. Next post will detail how to use these functions in your script. RE: HELP!!! - JPPSJ - 04-17-2012 (04-17-2012, 12:37 AM)Putmalk Wrote: I am not going to teach you how to do flying jesus's, as it's very annoying and not scary at all.Ok, That makes sense... RE: HELP!!! - Putmalk - 04-17-2012 Okay, so, first, we have a mapping problem. In our map, we are going to have a door called "mansion_1", an area called "AreaSlamDoor", and that's pretty much it. Our player is always called "Player" when referred to by the script. So, when we collide with AreaSlamDoor, mansion_1 will be shut closed! How do we do this? First, we add a callback in our OnStart function so that the game knows when the player will collide with the area. Code: void OnStart() That should work for you. Don't copy and paste that code, write it out and study my comments, it is the only way you will learn syntax and how to code! There are many advanced methods on how to script, but you are a beginner and this is how you need to learn. |