switch and cases
Hi guys.
It's first time i play with switch and cases, so i was prepared on running into trouble, but now im hitting the spot where im kind of stuck.
I just cant get this to work.
void OnStart
{
AddEntityCollideCallback("Player", "EventArea", "RandomEvent", true, 1);
AddTimer("event", 1, "EventTimer");
}
void RandomEvent(string &in asParent, string &in asChild, int alState)
{
switch(GetLocalVarInt("Var1"))
{
case 1:
StartScreenShake(0.06, 5, 1, 2);
PlaySoundAtEntity("laugh", "00_laugh.snt", "shield02_5", 0, false);
GiveSanityDamage(10, true);
break;
case 2:
StartScreenShake(0.06, 5, 1, 2);
PlaySoundAtEntity("laugh", "00_laugh.snt", "shield02_5", 0, false);
GiveSanityDamage(100, true);
break;
case 3:
PlaySoundAtEntity("", "guardian_activated.snt", "Player", 0, false);
FadeSepiaColorTo(0.3, 2);
FadeRadialBlurTo(0.3, 2);
StartScreenShake(0.1, 11, 0, 1);
GiveSanityDamage(25, true);
AddTimer("NoramlScreen", 10, "NormalScreen");
AddTimer("PlayerReact", 1.5, "PlayerReact");
break;
case 4:
PlaySoundAtEntity("", "insanity_monster_roar02.ogg", "Player", 0, false);
FadeSepiaColorTo(0.3, 2);
FadeRadialBlurTo(0.3, 2);
StartScreenShake(0.1, 6, 0, 1);
GiveSanityDamage(100, true);
AddTimer("NoramlScreen", 5, "NormalScreen");
AddTimer("PlayerReact", 1.5, "PlayerReact");
break;
case 5:
AddEffectVoice("CH02L17_Alexander_01.ogg", "", "", "CH02L17_Alexander_01.ogg", false, "", 0, 0);
break;
}
if(GetLocalVarInt("Var1") == 6)
{
SetLocalVarInt("Var1", 0);
}
}
void PlayerReact(string &in asTimer)
{
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
}
void NormalScreen(string &in asTimer)
{
FadeRadialBlurTo(0, 2);
FadeIn(2);
}
void EventTImer(string &in asTimer)
{
AddLocalVarInt("Var1", 1);
AddTimer("event", 1, "EventTimer");
}
CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 09-07-2013, 03:45 PM by Lizard.)
|