Frictional Games Forum (read-only)
Timers/Lantern [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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Timers/Lantern [Solved] (/thread-6668.html)



Timers/Lantern [Solved] - Zirg - 02-21-2011

Hey everyone,
I've been working on a custom story for about a week now. Been really trying to learn scripting through following some tutorial videos and just looking at the original game's .lang and .hps files.
It helped me a lot and got me quite far.
I just can't seem to figure out how I can make my lantern 'disappear' for about 3-4 seconds.

All I could come up with was

Code:
void blabla
{
AddTimer("lanternoff", 3, "LanternTurnsOff");
}

void LanternTurnsOff (string &in asTimer)
{
SetLanternDisabled(true);
}

But all that this does is, start the timer after 3 seconds as soon as I have entered my collision area, and I can't seem to figure out how to make it turn back on automatically.
Thanks in advance.

*EDIT
Lol after some clear thinking I figured it out myself.
I changed it to:

Code:
void blabla
{
SetLanternDisabled(true);
AddTimer("lanternon", 4, "LanternGoesOn1");
}

void LanternGoesOn1 (string &in asTimer)
{
SetLanternDisabled(false);
}

Works like a charm now.
Hope other people can benefit from this.


RE: Timers/Lantern - Tanshaydar - 02-21-2011

In the callback function, SetLanternDisabled(false); ??


RE: Timers/Lantern [Solved] - Zirg - 02-21-2011

(02-21-2011, 02:52 AM)Tanshaydar Wrote: In the callback function, SetLanternDisabled(false); ??

That wouldn't have worked, because I didn't have a command to turn the lantern off before that.
If I would have just simply changed it to 'false' it would literally say, turn on a lantern that is already on.
Thanks anyway, I figured it out by myself and edited my original post. Smile


RE: Timers/Lantern [Solved] - Tanshaydar - 02-21-2011

So, what's the difference from what I suggested Big Grin


RE: Timers/Lantern [Solved] - Zirg - 02-21-2011

(02-21-2011, 03:11 AM)Tanshaydar Wrote: So, what's the difference from what I suggested Big Grin
Well, if I had blindly followed you, and just changed 'true' into 'false' It wouldn't have worked.
I added a SetLanternDisabled(true); into the first callback, so the second callback could turn it bàck on.
And yes, you're right when you say the second callback is now exactly the same as your suggestion. Again, that wouldnt have worked if I hadn't found out to add SetLanternDisabled(true); into the first callback. Smile


RE: Timers/Lantern [Solved] - Tanshaydar - 02-21-2011

I thought you have a collide area with a callback, and I referred it; not the first one. But it's good you don't follow blindly Smile