Need help with scripting - 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: Need help with scripting (/thread-6158.html) Pages:
1
2
|
Need help with scripting - Cakefirst - 01-11-2011 Hello, I am quite new to the whole scripting thing and need some help. First thing solved Thanks! Second I have put out this particle ps_pipe_flow_medium.ps as a leak on a pipe. And there is 3 levers and 1 wheel around it that I want so you have to use all of them to make it stop. When the leak stops it will also open a secret stone wall door same one that is used in the original game. RE: Need help with scripting - Frontcannon - 01-11-2011 Well, both CollideCallbacks refer to the same function. If the function is called, it does what you've written in it. And now look, what did you write in it? RE: Need help with scripting - Cakefirst - 01-11-2011 do you mean remove item? how can I make it seperate then so both dont get removed RE: Need help with scripting - Tottel - 01-11-2011 When you execute that function, EVERYTHING in it will be executed. Meaning both doors will be unlocked. And you call that function when you use either key, so it will always unlock the 2 doors. You will have to use a separate function per door in order for it to work. (or 1 function that checks which key you have equipped and then unlocks that door.. but never mind about this, make 2 functions.) RE: Need help with scripting - Cakefirst - 01-11-2011 I tried doing like this but it gives me unexpected error when starting the custom story?? void OnStart() { AddUseItemCallback("", "machine", "castle_4", "KeyOnDoor", true); } void KeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("castle_4", false, true); PlaySoundAtEntity("", "unlock_door", "castle_4", 0, false); RemoveItem("machine"); } { AddUseItemCallback("", "hall", "castle_2", "KeyOnDoor", true); } void KeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("castle_2", false, true); PlaySoundAtEntity("", "unlock_door", "castle_2", 0, false); RemoveItem("hall"); } void onEnter() { } void OnLeave() { } RE: Need help with scripting - Cakefirst - 01-12-2011 a little bump. I have tried different combinations but i only get unexpected errors RE: Need help with scripting - Seragath - 01-12-2011 (01-12-2011, 03:24 PM)Cakefirst Wrote: a little bump. I have tried different combinations but i only get unexpected errors please post the errors. Code: void OnStart() Try this, I have not tested it myself but it could work. RE: Need help with scripting - Cakefirst - 01-12-2011 I only got unexpected token {because of the wrong combinations I did. But I am happy to say that yours worked! Thank you! I also didn't have a clue about having to put a number infront of KeyOnDoor to specifiy if you have more doors, thanks! RE: Need help with scripting - Seragath - 01-12-2011 (01-12-2011, 03:45 PM)Cakefirst Wrote: I only got unexpected token {because of the wrong combinations I did. But I am happy to say that yours worked! Thank you! I also didn't have a clue about having to put a number infront of KeyOnDoor to specifiy if you have more doors, thanks! The reason for that is because you had two named "void KeyOnDoor" So I just changed the name, and moved it out from void OnStart() I guess when you put it there it triggers when you start the map the first time? I don't know. But I like to keep everything out there except for triggers on the map that I want to trigger only once. RE: Need help with scripting - Frontcannon - 01-12-2011 (01-11-2011, 06:17 PM)Cakefirst Wrote: I have put out this particle ps_pipe_flow_medium.ps as a leak on a pipe. This one is interesting. So you have 3 levers and a turning wheel and the player has to use all of the to stop the leak? Well, that's where variables come in. And if statements. And ConnectionStateChangeCallbacks. It's still a pretty simple script, but you better get used to the syntax or it will be a pain in the ass to script for you. |