Frictional Games Forum (read-only)

Full Version: Sequence (i.e. switch) Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.
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.