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
Sequencing Events and Timers
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#3
RE: Sequencing Events and Timers

Everything you put inside OnEnter() happen when the map starts everytime,
everything you put inside OnStart() happen the first time you enter the map.

Then about the event you made:
if you use float values (numbers with f behind) you must use decimals ie. 0.5f 1.0f.
You don't need to set the iIntro variable into 0 at start because AddLocalVarInt atomatically sets it from 0 to 1.
To use FadeIn, you have to first use FadeOut.
You can use any name instead of fEventSpeed.

Heres the script (I added preloads cos everyone forgets to add them):

void OnStart()
{FadeOut(0);
AddTimer("IntroTimer", 1, "Intro");
}

void Intro(string &in asTimer)
{
AddLocalVarInt("iIntro", 1); //Adds 1 to iIntro everytime this timer starts
float thisnow = 1.0f; //sets default time for parts: 1 second
switch (GetLocalVarInt("iIntro")) //looks for value of timer
{
case 1: //what it does if the value for iIntro is 1
thisnow = 2.0f;
FadeIn(5);
PlaySoundAtEntity("", "scare_male_terrified.snt", "player", 0, false);
break;

case 2: //if iIntro value is 2
thisnow = .1f;
CreateParticleSystemAtEntity("", "ps_rose_petals_swirl", "player", false);
break;
}
if (GetLocalVarInt("iIntro") <2) //if iIntro value is less than two
{
AddTimer("IntroTimer", thisnow, "Intro");
}
}

void OnEnter()
{
PreloadParticleSystem("ps_rose_petals_swirl");
PreloadSound("scare_male_terrified");
}

(This post was last modified: 08-12-2011, 01:36 PM by Khyrpa.)
08-12-2011, 01:30 PM
Find


Messages In This Thread
Sequencing Events and Timers - by rybray - 08-12-2011, 05:47 AM
RE: Sequencing Events and Timers - by Juby - 08-12-2011, 12:25 PM
RE: Sequencing Events and Timers - by Khyrpa - 08-12-2011, 01:30 PM
RE: Sequencing Events and Timers - by rybray - 08-12-2011, 04:46 PM
RE: Sequencing Events and Timers - by Khyrpa - 08-12-2011, 08:08 PM



Users browsing this thread: 2 Guest(s)