The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
switch and cases
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#1
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.)
09-07-2013, 10:09 AM
Find


Messages In This Thread
switch and cases - by Lizard - 09-07-2013, 10:09 AM
RE: switch and cases - by Apjjm - 09-07-2013, 02:42 PM
RE: switch and cases - by Lizard - 09-07-2013, 03:01 PM
RE: switch and cases - by Kreekakon - 09-07-2013, 03:14 PM
RE: switch and cases - by Lizard - 09-07-2013, 03:31 PM
RE: switch and cases - by Kreekakon - 09-07-2013, 03:36 PM
RE: switch and cases - by Lizard - 09-07-2013, 03:44 PM



Users browsing this thread: 1 Guest(s)