Display text message until... - 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: Display text message until... (/thread-17295.html) |
Display text message until... - iFondue - 07-27-2012 Hey, I'm still working on my custom Story, and i have a question. I want to script that the player can open the door when he picked up the lantern. That wasn't a problem to script, i just did it with OnPickup... I also want that it displays a message when he interacts with the door saying "I should search for the lantern first." That was no problem to script too, but the problem is, if he has the lantern, and than leaves the room by using the door, it displays the message again... I want to fix that but I dom't know how... Thanks already! Greets -iFondue RE: Display text message until... - Kreekakon - 07-27-2012 Set a LocalInt which will change when you pick up the lantern. Then surround your display message script with a if check which will only run if the localint is the proper one. RE: Display text message until... - Adny - 07-27-2012 When the player interacts with the door (and he doesn't have the lantern) it will set the message; if the player has the lantern, the door will unlock and no longer display the message. void OnStart() { SetEntityPlayerInteractCallback("NAME_OF_DOOR", "FUNC", false); SetEntityPlayerInteractCallback("NAME_OF_LANTERN", "FUNC_2", false); } void FUNC(string &in asEntity) { if(HasItem("NAME_OF_LANTERN") == true) { SetMessage("NAME_OF_TEXT_CATEGORY", "NAME_OF_TEXT_ENTRY", 0); } } void FUNC_2(string &in asEntity) { SetSwingDoorLocked("NAME_OF_DOOR", false, false); ///by having abEffects false, the player won't suddenly hear an unlocking noise } Hope that Helped! RE: Display text message until... - iFondue - 07-27-2012 Thank you! It now works... But I had to change the statement of: if(HasItem("NAME_OF_LANTERN") == true) to false, else it does exactly the opposite. Thanks alot! Greets -iFondue RE: Display text message until... - iFondue - 07-27-2012 The first door I made this works perfect now, thanks again, but i have another problem *eyeroll* xD Because on the second door, I want the player to use a hollow needle to open. All works perfectly, if he interacts with the door with no Hollow Needle the message "It seems that the lock is jammed!" appears and when he has the hollow needle no text message appears. But problem is, as soon as he used the needle on the door, and than pushes it forward the message appears again, because if he doesn't have the entity the message will appear. How can i make this statement "false" after he picked the needle up? Thanks for taking the time for me! Greets -iFondue RE: Display text message until... - Kreekakon - 07-28-2012 In this case use my method I mentioned earlier =D It nearly works the same as Andy's except that there's a LocalInt involved. void OnStart() { SetEntityPlayerInteractCallback("NAME_OF_DOOR", "FUNC", false); AddUseItemCallback("", "NAME_OF_NEEDLE", "NAME_OF_DOOR", "FUNC_2", true); SetLocalVarInt("INT_NAME", 0); } void FUNC(string &in asEntity) { if(GetLocalVarInt("INT_NAME")==0) { SetMessage("NAME_OF_TEXT_CATEGORY", "NAME_OF_TEXT_ENTRY", 0); } } void FUNC_2(string &in NAME_OF_NEEDLE, string &in NAME_OF_DOOR) { SetSwingDoorLocked("NAME_OF_DOOR", false, false); AddLocalVarInt("INT_NAME", 1); } |