Frictional Games Forum (read-only)
Sequence (i.e. switch) Question - 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: Sequence (i.e. switch) Question (/thread-24029.html)



Sequence (i.e. switch) Question - RaideX - 12-04-2013

Hey everybody,

I've been trying to get a bit more experienced in coding and stumbled upon sequences / switches.

I understand the concept of the whole thing but this one thing that still won't get in my head (or maybe i'm just too dumb to read, idunno) is:

How does the iIntroPart Integer go from 1 to 2 or upwards? (best to look at the link above. The finished code is at the bottom of the page)

Because, as i've understood it, the cases go from case1 to case2 (and so on) if the parameter of the switch function changes to the according numbers.


I have the harsh feeling that i've just missread this whole thing or maybe i just interpret it wrong. Hope that you guys can help

-RaideX


RE: Sequence (i.e. switch) Question - Kreekakon - 12-04-2013

AddLocalVarInt("iIntroPart", 1);

This will boost up the int each time the function is called again, taking it to the next step.


This:

partSpeed = 21.0f;

and this:

if (GetLocalVarInt("iIntroPart") <2)
{
AddTimer("tmrIntro", partSpeed, "introSequence");
}

...will determine that if the sequence is not yet finished then it will play the entire thing again after the time that was set in partSpeed in the previous one.

When time is up, and the function fires again AddLocalVarInt("iIntroPart", 1); will activate allowing the next step in the sequence to play out.


RE: Sequence (i.e. switch) Question - RaideX - 12-04-2013

oh. my god. I'm such an idiot!

I got confused with the AddLocalVarInt because i thought it was SetLocalVarInt....

It makes sense now! thanks alot.