How do I make a lever??? - 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: How do I make a lever??? (/thread-10446.html) |
How do I make a lever??? - Brute - 09-23-2011 I have search in different threads, but with no efforts. My levers won't work! i am freaking out ;D It would be nice, if someone of you could make a step-by-step tutorial for me. Just with... What must i set in the editor and in the script. Please... I really need your help RE: How do I make a lever??? - Homicide13 - 09-23-2011 If you just place a lever (even in thin air i believe) it should work just fine. Now if you want the lever to actually DO something when it's used, you're going to have to use script for that. And if you're going to want help with that, you're also going to have to be more specific. ^^ RE: How do I make a lever??? - Brute - 09-23-2011 OK more specific A lever opens a door. Sounds simple. NOT FOR ME!!! What must I do in the editor and which script must I wrote? Damn you won't believe, what I have tried... It is terrible... no success... RE: How do I make a lever??? - DRedshot - 09-23-2011 there isn't any extremely difficult code to do, the principle is exactly the same as a script area. - A Callback is called then a function(such as Unlock) is run. The only difference is that the callback is a LeverState callback instead of a Collide Callback. So first of all, unlike "AddEntityCollideCallback" there is no script function called for example... "AddLeverCallback" You must Add the Callback in LevelEditor. So click on the Lever, click the Tab on the right. Then scroll to ConnecctionStateChangeCallback, put a name in the box (Such as "OnLeverPull") then in your code put: void OnLeverPull(string &in asEntity , int alState) { if(alState==x){} } // - if(alState==x){} can be used to determine whether the lever is up or down. Good Luck RE: How do I make a lever??? - Brute - 09-24-2011 Sadly it doesn't work. The lever doesn't stuck or do anything HELP!!! RE: How do I make a lever??? - DRedshot - 09-24-2011 well does it call the callback? I'm not sure what you want it to do, but if you want it to stick up if you pull it up, use the "SetLeverStuckState" Sorry if it doesn't work, I haven't made any levers in a while if(alState==1){ SetLeverStuckState(asEntity , 1 , true); } That should work, if not, then just use script areas which collide with the lever at the top and the bottom RE: How do I make a lever??? - Brute - 09-24-2011 It doesn't work again, but thanks for your try DRedshot! At this point I show you my script : ------------------------------------------------------------------------------------------------------ //////////////////////////// // Run first time starting map void OnStart() { AddEntityCollideCallback("Player" , "Enemy02_appear" , "Enemy02_appear" , true , 1); AddEntityCollideCallback("LeverExit" , "ExitOpen" , "OpentheExit" , true , 1); SetEntityPlayerInteractCallback("Library_Key", "Enemy03_appear", true); } //////////////////////////// // Run when entering map void OnEnter() { SetPlayerLampOil(0); PlayMusic("10_amb.ogg", true, 1.0f, 0, 0, true); AddUseItemCallback("", "PrisonDoor_Key", "PrisonDoor", "KeyOnDoor1", true); AddUseItemCallback("", "Ceiling_Key", "Ceiling", "KeyOnDoor2", true); AddUseItemCallback("", "Library_Key", "Library", "KeyOnDoor3", true); } //////////////////////////// // Run when leaving map void OnLeave() { } //////////////////////////// // Actual functions void KeyOnDoor1(string &in asItem, string &in asEntity) { SetSwingDoorLocked("PrisonDoor", false, true); RemoveItem("PrisonDoor_Key"); PlaySoundAtEntity("", "unlock_door.snt", "PrisonDoor", 0.0f, true); SetEntityActive("Enemy01" , true); } void Enemy02_appear(string &in asParent , string &in asChild , int alState) { SetEntityActive("Enemy02" , true); } void Enemy03_appear(string &in asParent , string &in asChild , int alState) { SetEntityActive("Enemy03" , true); AddEnemyPatrolNode("Enemy03", "Path0", 1000000.0f, "true"); } void KeyOnDoor2(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Ceiling", false, true); RemoveItem("Ceiling_Key"); PlaySoundAtEntity("", "unlock_door.snt", "Ceiling", 0.0f, true); } void KeyOnDoor3(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Library", false, true); RemoveItem("Library_Key"); PlaySoundAtEntity("", "unlock_door.snt", "Library", 0.0f, true); } void OpentheExit(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Basement", false, true); SetEntityActive("Guard01" , true); PlaySoundAtEntity("LeverExit", "levelexitopen.ogg", "Player", 0.5f, false); SetEntityActive("Guard02" , true); SetEntityActive("Guard03" , true); } ------------------------------------------------------------------------------------------------------ (I have removed the PatrolNodes, because they would explode my post) The Lever has the settings: Name: LeverExit The ScriptArea has the setting: Name: ExitOpen So what is wrong? Any ideas? RE: How do I make a lever??? - Brute - 09-24-2011 I found the error. This line was wrong: void OpentheExit(string &in asItem, string &in asEntity) Thanks for your help |