![]() |
I'm back, with a new custom story and another question! [SOLVED] - 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: I'm back, with a new custom story and another question! [SOLVED] (/thread-9372.html) |
I'm back, with a new custom story and another question! [SOLVED] - Karai16 - 07-25-2011 Hey guys! I'm back after some time of not being here! ^^ I'm working on another custom story at the moment, but I'm facing some problems. You see: Code: void OnStart() ![]() RE: I'm back, with a new custom story and another question! - Tanshaydar - 07-25-2011 HasItem("Lantern") == true == true is unneeded here, as HasItem function is a boolean function. This happened to someone else too. So, how about unlocking the level door on lantern pickup instead of checking if player has it? RE: I'm back, with a new custom story and another question! - Karai16 - 07-25-2011 (07-25-2011, 06:38 PM)Tanshaydar Wrote: HasItem("Lantern") == true Well you see, lantern is picked up in another map, So that's why I can't unlock that door yet. But if there is a way, I'm all ears ofcourse. RE: I'm back, with a new custom story and another question! - DRedshot - 07-25-2011 I found a workaround when i ran into this problem if(HasItem("Lantern")){} else{ // Unlock door } ![]() RE: I'm back, with a new custom story and another question! - Karai16 - 07-25-2011 (07-25-2011, 11:11 PM)DRedshot Wrote: I found a workaround when i ran into this problem Well the thing is, the door has to unlock when you do have the lantern. Also, I've tried something simular before, but it doesn't work either. RE: I'm back, with a new custom story and another question! - DRedshot - 07-25-2011 ok, I dont fully understand what you're trying to do. If you want the door to unlock when you do have the lantern, this should work: if(HasItem("Lantern")){ // Unlock Door } if that doesn't work, you may not have called it Lantern. RE: I'm back, with a new custom story and another question! - Roenlond - 07-25-2011 When you pick up the lantern in map 1, set a global variable to 1 and check if that variable is 1 when you click on the door. RE: I'm back, with a new custom story and another question! - Karai16 - 07-26-2011 (07-25-2011, 11:51 PM)Roenlond Wrote: When you pick up the lantern in map 1, set a global variable to 1 and check if that variable is 1 when you click on the door. Okay, I did that, but it still won't open the door... Here are the scripts: Hallway: (The map where the game starts (atm) and where the door is that needs to be unlocked) Code: void OnGameStart() Bedroom: (The map where you get the lantern) Code: void OnStart() ![]() RE: I'm back, with a new custom story and another question! - Anxt - 07-27-2011 Ok, here's what you do: Since you already have your GlobalVarInt set up, use an if statement in your hallway map to unlock the door. So, for example: void OnEnter() { if(GetGlobalVarInt("LanternVar")==1) { SetLevelDoorLocked(blahblahblah); } } Here's where I suspect the problem is: You have your LanternVar set to 1 at the start of the game. Set it to 0. Then, when you get the lantern, adding 1 to it will make it 1, thus making the function I have outlined for you above work properly. Hope that helped ![]() RE: I'm back, with a new custom story and another question! - Karai16 - 07-27-2011 (07-27-2011, 01:06 AM)Anxt Wrote: Ok, here's what you do: Thanks anxt! It's working completely fine now ![]() |