[SCRIPT] Display message when player tries to use lantern - 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: [SCRIPT] Display message when player tries to use lantern (/thread-48489.html) |
Display message when player tries to use lantern - serbusfish - 05-27-2016 I would like to disable the lantern and have a message display when the player tries to use it. The message works ok prior to the lantern being disabled but it wont display once it has been. I was using 'SetLanternLitCallback' to set the message, is there another way to do it? RE: Display message when player tries to use lantern - Slanderous - 05-27-2016 PHP Code: if(GetLanternActive()) Should work. RE: Display message when player tries to use lantern - Mudbill - 05-27-2016 How is your code? It might be possible but I wouldn't recommend it: You could use a looping timer to check the lantern state and force it off though I don't expect it to be any better than that callback. That's why it's there anyway. RE: Display message when player tries to use lantern - serbusfish - 05-27-2016 (05-27-2016, 10:39 AM)Slanderous Wrote: I tried that but the game didnt like it and threw back errors, I probably did something wrong. (05-27-2016, 12:47 PM)Mudbill Wrote: How is your code? I simply put a script area over the map start position so when they spawn they hit it straight away: Quote:AddEntityCollideCallback("Player", "ScriptArea_16", "LanternOff", true, 1); And then I have: Quote:SetLanternLitCallback("NoUse"); I understand why it doesnt work, the lantern is is disabled so it cant light, I just need to figure a way around it. RE: Display message when player tries to use lantern - Slanderous - 05-27-2016 PHP Code: void OnStart() PHP Code: RemoveTimer("tmr_check"); RE: Display message when player tries to use lantern - Daemian - 05-27-2016 Another option: PHP Code: void OnStart { To let the player use the lantern again, use this: PHP Code: SetLanternLitCallback(""); RE: Display message when player tries to use lantern - Mudbill - 05-27-2016 Personally I'd go with Daemian's suggestion. It will immediately turn the lantern back off after attempted enabling, which will also trigger the callback. Though I guess he hastily wrote the code, as it's not 100% correct: PHP Code: void OnStart() Keep in mind it will still play the sounds of the player enabling the lantern. RE: Display message when player tries to use lantern - serbusfish - 06-01-2016 Thank you very much and sorry for the delay in replying, i've been working on other areas of my story as I had no luck getting it to work. |