Door problem?(NOOB) - 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: Door problem?(NOOB) (/thread-16994.html) Pages:
1
2
|
Door problem?(NOOB) - Stenkilde - 07-15-2012 Hello! Here i am with my first noob problem! Yes i'm a noob. So i'm trying to make these "normal" doors work. Or Swings doors to work. I have this door which i want to stay locked, and then you pick up a key and you can unlock a door. Code: void UnlockLevelDoor(string &in item, string &in entity) heres my script, i hope you guys can tell me what insane noob mistake i'm making. Thank you! RE: Door problem?(NOOB) - Ongka - 07-15-2012 Code: void OnStart() RE: Door problem?(NOOB) - Stenkilde - 07-15-2012 Hello Ongka! Thanks for the SUPER quick answer! A second question, could you try to explain to me why it has to be the specific "input" (string &in asItem) ? RE: Door problem?(NOOB) - Ongka - 07-15-2012 If I remember correctly these are the values the function gets delivered. In this case it's the name of the item you're using and the name of the entity you're using it on. Depends on what you try to achieve whit each function. If you don't use an item from your inventory to call a function, you don't have to add string &in asItem. For the beginning you should just look up functions from the original maps and copy their header. RE: Door problem?(NOOB) - Stenkilde - 07-15-2012 Okay, i see. So you want me to open the HPS files from FC and just look around at them? RE: Door problem?(NOOB) - Ongka - 07-15-2012 Exactly, here are some examples: Code: void TimerXyz(string &in asTimer) You can name the function how you'd like them to be, but you should use some kind of system to make it more clear. RE: Door problem?(NOOB) - drunkmonk - 07-15-2012 (07-15-2012, 06:37 PM)Stenkilde Wrote: Hello Ongka!The reason for the (string &in asItem) and what not is this is the function that is being called when you declared it earlier in your script. So what I mean is in your void OnStart you have a AddUseItemCallback("UnlockDoor", "ENTER_KEY_NAME_HERE", "ENTER_DOOR_NAME_HERE","UseKeyOnDoor", true); everything inside the brackets is all the information the script needs to be able to call the function. So the first quotes is the name of the callback(this is optional) the second is the name of the key that you want to use, the third is the name of the door you want the key to work with, and finally the fourth is the name of the function to call when you use the key on the specific door. Now for the (string &in asItem), this is the function that is being called when you use the key on the door, basically what is happening here is your telling that script that once you have used the key on the door you want it to unlock for example I hope this helped RE: Door problem?(NOOB) - Stenkilde - 07-15-2012 Thank you both Ongka and Drunkmonk! I thank you guys so much for helping a noob like me out! Drunkmonk it did made sense to me! RE: Door problem?(NOOB) - FlawlessHappiness - 07-15-2012 The FC's Hps can look a little bit wild with a lot of differen scripting stuff, like variables and such. http://wiki.frictionalgames.com/hpl2/amnesia/script_functions Use the wiki too! It works! As soon as you know how scripting works then you will find it easy. Quick tutorial: void OnStart() { AddUseItemCallback("UnlockDoor", "KEY_NAME", "DOOR_NAME","UseKeyOnDoor", true); The whole line allows the function to work. ///The red one is the name of the allowing. Usually you don't put anything here. Only if you f.x. want to ///delete a timer. ///The blue one is the name of the function, that happens when you use the item.} void UseKeyOnDoor(string &in asItem, string &in asEntity) ///This is the line that specifies that you are using and ITEM on an ENTITY. { SetSwingDoorLocked("DOOR_NAME", false, true); } RE: Door problem?(NOOB) - Stenkilde - 07-15-2012 That made me understand ALOT! Thank you Beecake! Alot of helpfull people here! |