Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timers/Lantern [Solved]
Zirg Offline
Junior Member

Posts: 14
Threads: 4
Joined: Feb 2011
Reputation: 0
#1
Timers/Lantern [Solved]

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

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:

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.
(This post was last modified: 02-21-2011, 03:01 AM by Zirg.)
02-21-2011, 01:44 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Timers/Lantern

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

02-21-2011, 02:52 AM
Website Find
Zirg Offline
Junior Member

Posts: 14
Threads: 4
Joined: Feb 2011
Reputation: 0
#3
RE: Timers/Lantern [Solved]

(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
(This post was last modified: 02-21-2011, 03:06 AM by Zirg.)
02-21-2011, 03:05 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: Timers/Lantern [Solved]

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

02-21-2011, 03:11 AM
Website Find
Zirg Offline
Junior Member

Posts: 14
Threads: 4
Joined: Feb 2011
Reputation: 0
#5
RE: Timers/Lantern [Solved]

(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
(This post was last modified: 02-21-2011, 03:39 AM by Zirg.)
02-21-2011, 03:35 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#6
RE: Timers/Lantern [Solved]

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

02-21-2011, 04:43 AM
Website Find




Users browsing this thread: 3 Guest(s)