Scripting Problems ! - 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: Scripting Problems ! (/thread-10288.html) Pages:
1
2
|
Scripting Problems ! - AmnesiaIsScary :S - 09-12-2011 Hey, I have a lot of problems with the scripting here ! When I try to make a key to a door it doesn't work or that the game crashes when im starting the map. And the thing I would love to know most : How to make insanity effects ? When I Tried they worked when I started the map. (I want it to be in specific area's or when touching an entity) Help would be much appreciated . RE: Scripting Problems ! - Obliviator27 - 09-12-2011 I'll give you some examples based upon what you want to do. For starters, you can find all the script functions you need here: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions Now, to tackle your key problem, you simply need to place an AddUseItemCallback into your OnStart() function. The parameters you need will be shown in the wiki. EXAMPLE (I placed descriptions in [], so you can replace those with what you need. Code: void OnStart() SetEntityPlayerInteractCallback for when an item is interacted with or AddEntityCollideCallback for when you want the player to walk into an area. Be sure to have all names match up perfectly in the level editor. Also note that on the Entities, you can set up an interact callback without having to place it in your OnStart function. Hopefully this helps you! RE: Scripting Problems ! - Itskody - 09-12-2011 in your hps file you have to have this void UsedKeyOnDoorOne(string &in asItem, string &in asEntity) { SetSwingDoorLocked("name of door", false, true); PlaySoundAtEntity("", "unlock_door", "name of door", 0, false); RemoveItem("name of key"); } The names you put there are the names of the key/door in the map editor. so the door would be like mansion_1 and the key would be like key_study_1... Get it? and if you want to add sanity damage to your character(along with the effects) when a door is slammed or at ANY time, do this.. void ONStart() { AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1); } // Now add a script area in your map editor and where is says "ScriptArea_1" ABOVE, that is the name of the script in the map editor( such as key_study_1, or mansion_1). And where is says "Open" that is what YOU are choosing to call the function that will occur. You can name it what ever you want. Now that you have the entity collide function you have to add effects to what happends when you collide with that function. so then in your hps file you add(NOT IN THE OnStart BRACKETS BUT BELOW IT): void Scare(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); } Now this function is boring. You spice it up a bit add some noises so lets add some monster/ and player noises(some *gasps* obviously or moans from monsters.) so add: PlayGuiSound("amb_alert.snt", 0.5f); and PlayGuiSound("react_scare.snt", 0.5f); into the function so now you have void Scare(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); PlayGuiSound("amb_alert.snt", 0.5f); PlayGuiSound("react_scare.snt", 0.5f); } If you have any more questions then just ask. Hope this helped and this function is only good for when you walk through the script created on the hps map editor. if you want to know how to make effects when touching something or when a monster touches something or anything then just ask. RE: Scripting Problems ! - AmnesiaIsScary :S - 09-13-2011 Ok thanks a lot guys ... The last comment helped, but the key is still not working for me ... It says unexpected token or other errors when I try to fix it .. So this is the door name : "monsterdoor" This is the key: "key_study_1" Maybe you can give me the exact command now ? And "itskody" can you give me the command when touching something ? Oh and how to do another scare ? like where do i put the command ? I tried like this but it didnt work , look maybe you will understand what do I want ... { AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1); } void Scare(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); PlayGuiSound("amb_alert.snt", 0.5f); PlayGuiSound("react_scare.snt", 0.5f); } { AddEntityCollideCallback("Player", "ScriptArea_2", "Scare", true, 1); } void Scare(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); PlayGuiSound("amb_alert.snt", 0.5f); PlayGuiSound("react_scare.snt", 0.5f); } What that I meant is that I want to do another scare effect in another place .. how to do it ,and how to do a scarier react effect ? or scarier insanity effect ? And thanks for the help RE: Scripting Problems ! - Itskody - 09-13-2011 You cannot have 2 functions leading to the same void function.. like you cant have both: AddEntityCollideCallback("Player", "ScriptArea_2", "Scare", true, 1); and AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1); have the same "Scare" function. You need to make a new name for the second reaction. So for the first reaction do what i said and put AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1); in the OnStart brackets and put the AddEntityCollideCallback("Player", "ScriptArea_2", "Scare", true, 1); ALSO in the OnStart brackets but for the second script dont use the Void function "Scare" becasue that is already in use so you have to change it to another name. Lets use Monster in this example. so your OnStart should look like this: Void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1); AddEntityCollideCallback("Player", "ScriptArea_2", "Monster", true, 1); } //////// Then when you are making the reaction you have to do a separate void for each function so OUT of the OnStart brackets you should have: void Scare(string &in asParent, string &in asChild, int alState) { ///////The functions you want such as sanity damage or noises you want to put in } AND void Monster(string &in asParent, string &in asChild, int alState) { /////// Whatever functions you want here. } SOOOOO YOUR TOTAL SCRIPT WITH 2 EFFECTS SHOULD LOOK LIKE THIS Void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1); AddEntityCollideCallback("Player", "ScriptArea_2", "Monster", true, 1); } void Monster(string &in asParent, string &in asChild, int alState) { /////// Whatever functions you want here. } void Scare(string &in asParent, string &in asChild, int alState) { /////// Whatever functions you want here. } Would you like me to send you my HPS file for a part of my custom story so you can get ideas? RE: Scripting Problems ! - AmnesiaIsScary :S - 09-13-2011 Would you like me to send you my HPS file for a part of my custom story so you can get ideas? ^ Yes . P.S You helped me a LOT , really. Can you tell me the name of the command to a bigger scare reaction ? And send the file ? I have so many shit to learn from you !!! RE: Scripting Problems ! - Itskody - 09-14-2011 haha alright and what do you mean a bigger scare? describe what you want to happen? http://www.mediafire.com/?qp5a4d9zfdxh69w open that file in notepad and look through it, Its a small part of my map but has a bunch of different ideas in it. so ASK away RE: Scripting Problems ! - AmnesiaIsScary :S - 09-14-2011 Ok i went through a part of it and i tried to do the : StartPlayerLookAt("monsterdoor", 5, 10, ""); now i tried to stop it and i didn't know how .. this is my whole hps, Can you show me what to put to stop it ? //////////////////////////// // Run first time starting map void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1); AddEntityCollideCallback("Player", "ScriptArea_2", "Monster", true, 1); } void Scare(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); PlayGuiSound("amb_alert.snt", 0.5f); PlayGuiSound("react_pant.snt", 0.5f); StartPlayerLookAt("monsterdoor", 5, 10, ""); AddTimer("", 0.5f, "TimerScare"); } void Monster(string &in asParent, string &in asChild, int alState) { GiveSanityDamage(10, true); PlayGuiSound("amb_alert.snt", 0.5f); PlayGuiSound("react_pant.snt", 0.5f); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave() { } And when I meant bigger scares i Meant like different scares , like you did the earthquake and som people make him to get scared more (I think they raise the scaredamage) Oh and another thing .. How to you spawn a monster when entering a script area ? RE: Scripting Problems ! - AmnesiaIsScary :S - 09-14-2011 Anyone ^ ? RE: Scripting Problems ! - Your Computer - 09-14-2011 (09-14-2011, 04:10 PM)AmnesiaIsScary :S Wrote: Anyone ^ ? StopPlayerLookAt(); Refer to http://wiki.frictionalgames.com/hpl2/amnesia/script_functions for anything else |