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
#30
RE: Need help debugging various script functions

1. I did manage to fix the SpeedRemedy script on my own.
2. By adding more bandage items around my maps! I intend it like this.
3. Alright, i'll do that.
4. I got pretty damn close to the effect I wanted just by using box lights, but i'll give that a try too.

Alright, I think i'm almost done with the first room. Now I want to add some improvements to the intro script to make it more cinematic-like. Here's the current intro script:

void OnEnter()
{
ScriptDebugOn();
FadeOut(0.01f);
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);
  AddTimer("StartTimer",2,"StartTimer");
  SetEntityPlayerInteractCallback("Collapse","IntroCollapse",true);
  SetEntityCallbackFunc("BedRoomDoor","Bedroomdoor");
  
}

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)
{
SetInventoryDisabled(true);
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);
PlayGuiSound("react_pant6.ogg",3.0);
AddDebugMessage("panting!",true);
AddTimer("WalkTime",0.1,"Playerwalk"); //prepare yourself for long, repeated script.

SetPlayerActive(true);
SetPropStaticPhysics("FallVase1",false);
AddTimer("VaseScare1",0.5,"VaseScare");
SetPlayerMoveSpeedMul(0.1);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(2.0);
PermanentSanityLow++;
AddTimer("WaitforIntro3",2,"ScareIntroEnd");
PlayMusic("search_suitor.ogg",true,3.0,1.0,0,false);
AddTimer("InsanityWait",0,"InsanityTimeChecker");
AddTimer("EndAutoWalk",9,"StopAutoWalk");
}

void VaseScare(string &in asTimer)
{
StartPlayerLookAt("FallVase1",3.0,1.0,"");
GiveSanityDamage(5,true);
AddPropForce("ThrowVase1",5000,0,0,"world");
AddPropForce("ThrowVase2",8000,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 ActivatePlayerControl(string &in asTimer)
{
AddTimer("FinalIntroWait",7,"Endthebluralreadyornot");
SetPlayerMoveSpeedMul(0.5);
SetPlayerRunSpeedMul(0.1);
SetPlayerLookSpeedMul(0.3);
SetPlayerJumpDisabled(true);
}


void Endthebluralreadyornot(string &in asTimer)
{
FadeImageTrailTo(0,4);
SetMessage("PathofDarknessText","Intro1",7);

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

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");
FadeSepiaColorTo(8,2);
FadeSepiaColorTo(6,2);
FadeSepiaColorTo(4,2);
FadeSepiaColorTo(2,2);
FadeSepiaColorTo(0,2);
AddTimer("ReliefWait",2,"BacktoNormal2");
}

void BacktoNormal2(string &in asTimer)
{
AutoSave();
GiveSanityBoost();
AddPlayerSanity(80);
FadeRadialBlurTo(0,4);
FadeImageTrailTo(0,10);
FadeOut(5.0f);
AddTimer("EndIntro",1,"IntroOver");
SetEntityActive("Thedoorislocked",false);
}

void IntroOver(string &in asTimer)
{
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);
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("StoreKey",true,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);
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);
FadeIn(2.0f);
SetMessage("PathofDarknessText","Intro2",4);
}


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

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

I want to make it so that the player automatically kind of shuffles off of a bed, and falls onto the floor, getting up after a few seconds. Having trouble getting the MovePlayerForward part to work, though.
(This post was last modified: 09-17-2013, 02:27 PM by Silent Darkness.)
09-17-2013, 12:58 PM
Find


Messages In This Thread
RE: Need help debugging various script functions - by Silent Darkness - 09-17-2013, 12:58 PM



Users browsing this thread: 1 Guest(s)