Sequencing Events and Timers
Trying to teach myself how to use timers. The tutorial from the wiki helped me with the set up, but I am getting errors on lines [11], [14], [15], [17], and [23]. I tried explaining what the lines did in my own terms with the // but they may be incorrect. There were two other questions I had:
-I have seen partSpeed and fEventSpeed used in regard to how long a part of a sequence will be, which is correct?
-How do you determine what goes in OnStart, and OnEnter, they seem very much the same to me. Thank you for your help.
void OnStart()
{
SetLocalVarInt("iIntro", 0); // sets timer sequence value to zero
}
void OnEnter()
{
AddTimer("IntroTimer", 1, "Intro"); //creates timer that begins in __ seconds
}
[11] void Intro(string &in asTimer)
{
AddLocalVarInt("iIntro", 1); //changes timer value from 0 to 1
[14] float fEventSpeed = 1f; //sets default time for parts: 1 second
[15] switch (GetLocalVarInt("iIntro")); //looks for value of timer
{
[17] case 1: //what it does if the value for iIntro is 1
fEventSpeed = 2f;
FadeIn(5);
PlaySoundAtEntity("", "scare_male_terrified.snt", "player", 3, false);
break;
[23] case 2: //if iIntro value is 2
fEventSpeed = .1f;
CreateParticleSystemAtEntity("", "ps_rose_petals_swirl.ps", "player", false);
break;
}
if (GetLocalVarInt("iIntro") <2) //if iIntro value is less than two,
{
AddTimer("IntroTimer", fEventSpeed, "Intro");
}
}
void OnLeave()
{
}
|