Interesting code needed for lantern/pickup functions - 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: Interesting code needed for lantern/pickup functions (/thread-22959.html) |
Interesting code needed for lantern/pickup functions - SLAMnesia - 09-11-2013 Hey FG Forums! Great to be posting again after a long hiatus. I have an idea for a Custom Story and it will have an interesting mechanic, if I can pull it off with the help of the community My main character is going to only have one arm, and complicate his use of lantern/pickup objects. If the character has the lantern active, and decides to pickup an object, the lantern will be sheathed BECAUSE the character doesn't have the arms to do two things. Basically here's what I want: 1) The lantern should deactivate when any object is picked up (excluding items that go into your inventory #TDD) 2) The lantern should be impossible to use while holding an object, and display a message along the lines of "Drop that object to use your lantern!" when you try to use it. And yes, my idea is pretty neat and I hope to use the upgraded engine as soon as possible! RE: Interesting code needed for lantern/pickup functions - FlawlessHappiness - 09-11-2013 Well... You could name all entities the same thing. Like entity_1, entity_2, entity_3 etc. Then create a large for-script combined with SetEntityPlayerInteractCallback. Screw that idea. You won't be able to determine if the player has dropped the item. I don't think it's possible, since we don't have the right script-commands for this. Sorry, I don't think it's possible RE: Interesting code needed for lantern/pickup functions - Apfel - 09-11-2013 Here is something I got managed to work similar to what you wanted. - When you grab an object and you use your lantern the grabbed object will be dropped. - when your lantern is active and you try to grab an object the lantern will be switched off automatically (you can change it to manual, see commentary in the script). - there is a timer to prevent to grab an object while the switch off animation of the lantern is still going on. - Instead of normal messages I used debug-messages, so they need to be exchanged (bolded text) regarding to your second request: "2) The lantern should be impossible to use while holding an object, and display a message along the lines of "Drop that object to use your lantern!" when you try to use it." I can do this, too, but without the message, because the lantern callback wouldn't be called when the lantern is disabled and/or has no oil. script: Spoiler below!
|