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:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need help debugging various script functions
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#1
Need help debugging various script functions

I'm nearly done with the first room of a map, and here is what I want to happen when you enter:

-Screen starts out black
-player breathing noises happen, then whispers and you get woken up by the sound of someone screaming
-blur effect for a short time with creepy music playing

Well, what happens here is that none of the sounds play. Not sure why.

Also, I have the Ephiphrene(I think it was called)addon from ModDB, but there's a big problem. You have to use up all the Ephiphrene in your inventory for it to work, which isn't helpful when the stuff stacks numerically. I did a botch job and failed to make it work per item.

int PermanentSanityLow = 0;
bool CanAutoWalk = true;
int OnyourKnees = 1;
void OnStart()
{  
}


void OnEnter()
{
ScriptDebugOn();
FadeOut(0.01f);
  SetInventoryDisabled(true);
   SetPlayerJumpDisabled(true);
PreloadSound("react/React_breath_slow.snt");
PreloadSound("insanity/Insanity_Whisper.snt");
PreloadSound("react/React_Pant.snt");
PreloadSound("15/15_The_Big_Scream.snt");
PreloadSound("react/React_Sigh.snt");
PreloadSound("react_sigh"); PreloadSound("react_breath"); PreloadSound("player_climb"); PreloadSound("general_thunder");
    PreloadSound("00_creak"); PreloadSound("scare_walk_hallway"); PreloadSound("00_cuts"); PreloadSound("react_scare");
    PreloadSound("00_loop"); PreloadSound("player_bodyfall"); PreloadSound("00_faint"); PreloadSound("scare_slam_door");
    PreloadSound("ambience_wind_eerie_no3d"); PreloadSound("ambience_hollow_tinker"); PreloadSound("react_pant"); PreloadSound("joint_door_move_special");
    PreloadSound("general_wind_whirl"); PreloadSound("00_laugh"); PreloadSound("general_rain_m");
SetPlayerActive(false);
SetPlayerLampOil (0);
SetPlayerCrouching(true);
SetEntityInteractionDisabled("Bedroom_Piano",true);
  AddTimer("StartTimer",2,"StartTimer");
  SetEntityPlayerInteractCallback("Collapse","IntroCollapse",true);
  SetEntityCallbackFunc("BedRoomDoor","Bedroomdoor");
  AddTimer("Crouchforce",0,"ForcedCrouchCheck");
  }
  void ForcedCrouchCheck(string &in asTimer)
  {
  if(OnyourKnees >= 1)
  {
  SetPlayerCrouching(true);
  AddTimer("Doublecrouch",0.001,"ForcedCrouchCheck");
  }
  else
  {
  AddTimer("TripleCrouch",0.001,"ForcedCrouchCheck");
  }
  }

void InsanityTimeChecker(string &in asTimer)
{
  if(PermanentSanityLow==1)
  {
  AddTimer("SanityLoss",13.5,"ReduceSanity");
  AddDebugMessage("Sanity Loss",true);
  }
  }
  
  void ReduceSanity(string &in asTimer)
  {
  if(GetPlayerSanity() < 3)
  {
  GiveSanityDamage(-5,false);
  }
  else if(GetPlayerSanity() > 12)
  {
  GiveSanityDamage(5,false);
  }
  AddDebugMessage("ReduceSanity Called",true);
  GiveSanityDamage(0.8,false);
  AddTimer("RecheckInsanity",0,"InsanityTimeChecker");
  }

void ScareIntro1(string &in asTimer)
{
AddDebugMessage("ScareIntro function called!",true);
PlayGuiSound("react_breath_slow1.ogg",3.0);
AddDebugMessage("You should hear a breathing.",true);
AddTimer("Wait",3,"ScareIntro1again");
AddDebugMessage("ScareIntro1Again called",true);
AddTimer("Waitagain",3,"ScareIntro1again");
  AddDebugMessage("ScareIntro1Again called",true);
AddTimer("Waitsomemore",2,"ScareIntro1again");
  AddDebugMessage("ScareIntro1Again called",true);
AddTimer("Waitevenmore",2.5,"ScareIntro2");
}

void ScareIntro1again(string &in asTimer)
{
PlayGuiSound("react_breath_slow1.ogg",3.0);
  AddDebugMessage("ScareIntro1Again fires off properly.",true);
}

void ScareIntro2(string &in asTimer)
{
PlayGuiSound("Insanity_Whisper2.ogg",1.0);
AddDebugMessage("Hear the whispers.",true);
PlayGuiSound("15_the_big_scream3.ogg",4.0);
AddDebugMessage("screams!",true);
AddTimer("Awake",1,"ScareIntroAwaken");
AddDebugMessage("Time to wake up!",true);
}

void ScareIntroAwaken(string &in asTimer)
{
FadeSepiaColorTo(50.6,0.2);
SetRadialBlurStartDist(0.7);
FadeRadialBlurTo(4.0,0.5);
FadeImageTrailTo(3,2);
FadeLightTo("pointlight_1",1,0,0,255,-1,1);
FadeLightTo("pointlight_2",1,0,0,255,-1,1);
FadeLightTo("pointlight_3",1,0,0,255,-1,1);
FadeLightTo("pointlight_4",1,0,0,255,-1,1);
FadeLightTo("pointlight_5",1,0,0,255,-1,1);
FadeLightTo("pointlight_6",1,0,0,255,-1,1);
FadeLightTo("pointlight_7",1,0,0,255,-1,1);
FadeLightTo("pointlight_8",1,0,0,255,-1,1);
FadeLightTo("pointlight_9",1,0,0,255,-1,1);
FadeLightTo("pointlight_10",1,0,0,255,-1,1);
FadeLightTo("pointlight_11",1,0,0,255,-1,1);
FadeLightTo("pointlight_12",1,0,0,255,-1,1);
FadeLightTo("pointlight_13",1,0,0,255,-1,1);
FadeLightTo("pointlight_14",1,0,0,255,-1,1);
FadeLightTo("pointlight_15",1,0,0,255,-1,1);
FadeLightTo("pointlight_16",1,0,0,255,-1,1);
FadeIn(3.0f);
FadePlayerFOVMulTo(0.7,2);
GiveSanityDamage(80,false);
StartPlayerLookAt("IntroCameraControllera",5.0,5.0,"");
PlayGuiSound("react_scare.snt",2.0);
AddTimer("LookTimea",2,"LooktoRight");
PlayGuiSound("react_pant6.ogg",3.0);
AddDebugMessage("panting!",true);
AddTimer("WalkTime",0.1,"Playerwalk");
SetPropStaticPhysics("FallVase1",false);
AddTimer("VaseScare1",0.5,"VaseScare");
SetPlayerMoveSpeedMul(0.1);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(2.0);
PermanentSanityLow++;
AddTimer("WaitforIntro3",7,"ScareIntroEnd");
PlayMusic("search_suitor.ogg",true,3.0,1.0,0,false);
AddTimer("InsanityWait",0,"InsanityTimeChecker");
AddTimer("EndAutoWalk",9,"StopAutoWalk");
}

void LooktoRight(string &in asTimer)
{
StopPlayerLookAt();
PlayGuiSound("react_scare.snt",2.0);
StartPlayerLookAt("Introcameracontrollerb",5.0,5.0,"");
AddTimer("LookTimeb",2.0,"LookDown");
}

void LookDown(string &in asTimer)
{
StopPlayerLookAt();
StartPlayerLookAt("Introcameracontrollerc",5.0,5.0,"MoveForward");
}

void MoveForward()
{
  AddPlayerBodyForce(0,0,-500,false);
  AddTimer("PushPlayer",3,"SecondPlayerPush");
}

void VaseScare(string &in asTimer)
{
StartPlayerLookAt("FallVase1",3.0,1.0,"");
GiveSanityDamage(5,true);
AddPropForce("ThrowVase1",3000,0,0,"world");
AddPropForce("ThrowVase2",5000,0,0,"world");
AddTimer("VaseScareTime",0,"VaseScareEnd");
}

void VaseScareEnd(string &in asTimer)
{
StopPlayerLookAt();
}

void ScareIntroEnd(string &in asTimer)
{
PlayGuiSound("react_breath_slow1.ogg",2.0);
AddDebugMessage("breathing",true);
AddTimer("BreathTime",1.5,"Breathing");
AddTimer("BreathTime2",3.0,"Breathing");
AddTimer("Sightime",4.0,"PlayerSigh");
}

void Breathing(string &in asTimer)
{
PlayGuiSound("react_breath_slow1.ogg",2.0);
  AddDebugMessage("breathing",true);
}

void PlayerSigh(string &in asTimer)
{
  PlayGuiSound("react_sigh6.ogg",2.5);
  AddTimer("Activetime",3.0,"ActivatePlayerControl");
  AddDebugMessage("*sigh*",true);
}

void SecondPlayerPush(string &in asTimer)
{
StopPlayerLookAt();
MovePlayerHeadPos(0, -1.3f, 0, 5, 0.25f);
PlayGuiSound("player_bodyfall1.ogg",2.0);
AddTimer("CollapseTime",2.5,"PutHeadBack");
}

void PutHeadBack(string &in asTimer)
{
MovePlayerHeadPos(-1, -1.3f, 0, 1, 0.25f);
}

void ActivatePlayerControl(string &in asTimer)
{
AddTimer("FinalIntroWait",7,"Endthebluralreadyornot");
SetPlayerMoveSpeedMul(0.5);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(0.3);
}


void Endthebluralreadyornot(string &in asTimer)
{
OnyourKnees --;
}
void StartTimer(string &in asTimer)
{
AddTimer("StartScare",1,"ScareIntro1");
AddDebugMessage("This timer isn't the problem either.",true);
}

void ClickDaggers(string &in asbastard_2)
{
SetMessage("PathofDarknessText","DaggerSharpen",8);
AddDebugMessage("Clicked Daggers",true);
}

void ClickDaggers2(string &in asbastard_3)
{
SetMessage("PathofDarknessText","DaggerSharpen",8);
AddDebugMessage("Clicked Daggers",true);
}

void InsanityStatue(string &in asTimer) //Defunct code until I can figure out how terror sanity drain areas work.
{
SetMessage("PathofDarknessText","InsanityStatue",0);
AddDebugMessage("MADNESS!",true);
if(GetPlayerSanity() < 35)
        GiveSanityDamage(0.05f*0.15f, false);
    else
        GiveSanityDamage(0.05f*0.5f, false);
        
    AddTimer(asTimer, 0.05f, "InsanityStatue");
}

void RoseFind(string &in asRose01)
{
SetMessage("PathofDarknessText","RoseFind",6);
AddDebugMessage("Roses :3",true);
}

void ButlerNote(string &in asNote02)
{
SetMessage("PathofDarknessText","ButlerNote1",10);
AddDebugMessage("You got a note from your butler :D",true);
AddTimer("StoreKeyTime",10,"StoreKeyAppear");
}

void IntroCollapse(string &in aschest_small_1)
{
SetPlayerMoveSpeedMul(0.1);
SetPlayerRunSpeedMul(0.0);
SetPlayerLookSpeedMul(3.0);
PlayGuiSound("insanity_monster_roar03.ogg",4.0);
StartRandomInsanityEvent();
GiveSanityDamage(90,false);
AddTimer("RecoverTime",9,"CollapseEnd");
}

void CollapseEnd(string &in asTimer)
{
SetPlayerMoveSpeedMul(0.5);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(0.3);
}

void BacktoNormal(string &in aspotion_sanity_2, string &in asType)
{
PermanentSanityLow--;
RemoveItem("EnhancedSanity");
RemoveItem("potion_sanity_2");
FadeOut(2.0f);
  AddTimer("EndIntro",2,"IntroOver");
}

void BacktoNormal2(string &in asTimer)
{
AutoSave();
GiveSanityBoost();
AddPlayerSanity(80);
FadeRadialBlurTo(0,4);
FadeImageTrailTo(0,10);
SetEntityActive("Thedoorislocked",false);
  PlayMusic("06_amb.ogg",true,2.0,1.0,0,true);
SetPlayerJumpDisabled(false);
SetPlayerMoveSpeedMul(0.8);
SetPlayerRunSpeedMul(0.0);
SetPlayerLookSpeedMul(1.0);
SetSwingDoorLocked("BedRoomDoor",false,false);
AddTimer("FinalIntroTime",1,"FinalIntroEnd");

}

void FinalIntroEnd(string &in asTimer)
{
   SetMessage("PathofDarknessText","Intro2",4);
    FadeIn(2.0f);
}

void IntroOver(string &in asTimer)
{
SetEntityInteractionDisabled("Bedroom_Piano",false);
SetFogActive(false);
SetEntityActive("Boxlight_1",false);
SetEntityActive("Boxlight_2",false);
SetEntityActive("Boxlight_3",false);
SetEntityActive("Redbox",false);
SetEntityActive("Redbox2",false);
SetEntityActive("Redspotlight",false);
SetEntityActive("spotlight_1",false);
SetEntityActive("spotlight_2",false);
SetEntityActive("spotlight_3",false);
SetEntityActive("spotlight_4",false);
SetEntityActive("pointlight_1",true);
SetEntityActive("pointlight_2",true);
SetEntityActive("pointlight_3",true);
SetEntityActive("pointlight_4",true);
SetEntityActive("pointlight_5",true);
SetEntityActive("pointlight_6",true);
SetEntityActive("pointlight_7",true);
SetEntityActive("pointlight_8",true);
SetEntityActive("pointlight_9",true);
SetEntityActive("pointlight_10",true);
SetEntityActive("pointlight_11",true);
SetEntityActive("pointlight_12",true);
SetEntityActive("pointlight_13",true);
SetEntityActive("pointlight_14",true);
SetEntityActive("pointlight_15",true);
SetEntityActive("pointlight_16",true);
SetEntityActive("StatueExamine1",true);
SetEntityActive("StatueExamine1_1",true);
FadeLightTo("pointlight_1",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_2",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_3",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_4",1.0,0.5,0,255,-1,1);
FadeLightTo("pointlight_5",1.0,0.5,0,255,-1,1);
FadeLightTo("pointlight_6",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_7",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_8",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_9",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_10",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_11",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_12",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_13",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_14",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_15",1,0.5,0,255,-1,1);
FadeLightTo("pointlight_16",1,0.5,0,255,-1,1);
SetPropActiveAndFade("Note02",true,1);
SetPropActiveAndFade("bastard_2",true,1.0);
SetPropActiveAndFade("bastard_3",true,1.0);
SetPropActiveAndFade("Rose1",true,1.0);
SetPropActiveAndFade("Note01",true,0.5);
StopMusic(1.0,1);
FadeSepiaColorTo(8,2);
FadeSepiaColorTo(6,2);
FadeSepiaColorTo(4,2);
FadeSepiaColorTo(2,2);
FadeSepiaColorTo(0,2);
AddTimer("ReliefWait",2,"BacktoNormal2");
}

void SecretSyringeHint(string &in asHintbook)
{
SetMessage("PathofDarknessText","SyringeHint",7);
}

void BedroomDoor(string &in asBedRoomDoor)
{
AddDebugMessage("Called BedroomDoor",true);
if(GetSwingDoorLocked("BedRoomDoor")==true)
{
  SetMessage("PathofDarknessText","CantLeave",4);
}
else
{
//Nothing. The door works like normal.
}
}

void Playerwalk(string &in asTimer)
{
if (CanAutoWalk==true)
{
MovePlayerForward(1.0);
AddTimer("Walk2",0.1,"PlayerWalk");
}
}

void StopAutoWalk(string &in asTimer)
{
CanAutoWalk = false;
}

void StoreKeyAppear(string &in asTimer)
{
SetPropActiveAndFade("StoreKey",true,1);
StartPlayerLookAt("StoreKey",1.0,2.0,"");
AddTimer("LookTime",3,"EndKeyLook");
}

void EndKeyLook(string &in asTimer)
{
StopPlayerLookAt();
}

void PianoFlashback(string &in Bedroom_Piano)
{
AddDebugMessage("Emotionflash1",true);
StartEffectEmotionFlash("PathofDarknessText","PianoFlash1","fb_sfx_random_mirage2.ogg");
}

Kind of at a loss about what to do to fix this.
(This post was last modified: 09-19-2013, 09:30 PM by Silent Darkness.)
09-14-2013, 03:18 PM
Find


Messages In This Thread
Need help debugging various script functions - by Silent Darkness - 09-14-2013, 03:18 PM



Users browsing this thread: 2 Guest(s)