Frictional Games Forum (read-only)
Sequence (i.e. switch) Question - Printable Version

+- Frictional Games Forum (read-only) (
+-- Forum: Amnesia: The Dark Descent (
+--- Forum: Custom Stories, TCs & Mods - Development (
+---- Forum: Development Support (
+---- 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


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.


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.