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 case issue
Claymix Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jan 2019
Reputation: 0
#1
Switch case issue

I've been working on a custom story for awhile now and I've had a switch case bit of code that has been driving me nuts. For some reason, two of the cases trigger instantly, regardless of what I have it set to. To me, it seems like a weird glitch, although I'm sure it's actually a simple mistake I've made.  The naughty cases are case 1 and case 3. Both cases are over instantly when they are triggered, causing the next case (2 and 4) to trigger at the same time. The weird thing is that case 3 has nearly always been that way, but case 1 only recently started to misbehave and I haven't touched this part of the code at all!


Here is the switch case script. Sorry if the formatting is weird, it didn't paste quite nicely. I tried to clean it up.

PHP Code: (Select All)
void Dream(string &in asTimer)
{
 AddLocalVarInt("DreamStep"1);
 float fEventSpeed 5;
 switch(GetLocalVarInt("DreamStep"))
 {
  case 1             
   AddEntityCollideCallback
("servant_brute_2""BruteDoor""BruteBreakDoor"true1);
   AddEntityCollideCallback("Player""EnterRoomArea""EnterRoom"true1);
   SetPlayerHealth(50);
   FadeOut(0);
   SetMessage("ChapterOneMisc""IntroQuote"11.5f);
   SetPlayerActive(false);
   TeleportPlayer("DreamStart");
   SetSanityDrainDisabled(true);
   PlayMusic("DreamWhisper.ogg"false115false);
   SetPlayerMoveSpeedMul(0.2f);
   SetPlayerRunSpeedMul(0.3f);
   SetPlayerLookSpeedMul(0.3f);
   FadeGlobalSoundSpeed(0.6f1);
   fEventSpeed 12;
   AddDebugMessage("Case1 initializing"true);
  break;

  case 2:
   for(int g 1<= 51g++)
   SetEntityActive("13_burner_" +gtrue);
   SetPlayerActive(true);
   PlaySoundAtEntity("""sanity_damage.snt""Player"0.0ffalse);
   FadeIn(0.1f);
   FadeImageTrailTo(21);
   PlayMusic("29_amb.ogg"true115false);
   fEventSpeed 10;
   AddDebugMessage("Case2 initializing"true);
  break;

  case 3:
   SetEntityActive("servant_brute_2"true);
   CreateParticleSystemAtEntity("""ps_hit_wood.ps""DoorBreak"false);
   PlaySoundAtEntity("""break_wood.snt""BruteDoor_1"0false);
   SetEntityActive("FirstDoor"false);
   StartPlayerLookAt("servant_brute_2"11"");
   AlertEnemyOfPlayerPresence("servant_brute_2");
   fEventSpeed 5;
   AddDebugMessage("Case3 initializing"true);

  case 4                                         
   fEventSpeed 
5;
   AddDebugMessage("Case4 initializing"true);
  break 

  case 5
:
   CheckPoint ("DeathRespawn""PlayerStartBed""DeathRespawn""DeathRespawn""DeathRespawn");
   StartPlayerLookAt("AreaDreamLook"0.5f1"");
   AddTimer(""2"StopLook");
   TeleportPlayer("Dream1");
   AlertEnemyOfPlayerPresence("servant_brute_2");
   SetSwingDoorClosed("dreamdoor"falsefalse);
   SetSwingDoorDisableAutoClose("dreamdoor"true);
   AddPropForce("dreamdoor"003000"world");
   fEventSpeed 3;
   AddDebugMessage("Case5 initializing"true);
  break;
 }
 if(GetLocalVarInt("DreamStep") < 5)  AddTimer("Dream1"fEventSpeed"Dream");



(Case 4 is blank because it has always triggered at the same time as 3)

Thanks so much!
(This post was last modified: 01-15-2019, 01:40 PM by Mudbill.)
01-15-2019, 05:05 AM
Find


Messages In This Thread
Switch case issue - by Claymix - 01-15-2019, 05:05 AM
RE: Switch case issue - by Mudbill - 01-15-2019, 01:59 PM
RE: Switch case issue - by Claymix - 01-15-2019, 09:44 PM
RE: Switch case issue - by Mudbill - 01-16-2019, 09:45 PM
RE: Switch case issue - by Claymix - 01-16-2019, 09:58 PM
RE: Switch case issue - by Mudbill - 01-17-2019, 06:20 PM
RE: Switch case issue - by Claymix - 01-17-2019, 06:26 PM



Users browsing this thread: 1 Guest(s)