Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
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.
|
|
09-14-2013, 03:18 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Need help debugging various script functions
PlaySoundAtEntity is the correct parameter. FadeInSound didn't do shit in my case.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
09-14-2013, 03:37 PM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
Updated the code to use PlaySoundAtEntity. It still doesn't work, i'm afraid.
|
|
09-14-2013, 04:33 PM |
|
Javist
Junior Member
Posts: 46
Threads: 3
Joined: Sep 2010
Reputation:
0
|
RE: Need help debugging various script functions
Just read carefully function description, and you'll understand the problem.
HPL2 Wiki
unzip, strip, touch, finger, grep, mount, fsck, more, yes, fsck, fsck, fsck, umount, sleep.
(This post was last modified: 09-14-2013, 08:14 PM by Javist.)
|
|
09-14-2013, 07:46 PM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
.....I don't. I don't see what i'm doing wrong, tbph. I'll keep looking it over/smashing my head into the wall, but i'd feel better if someone spelled it out in simple english for me.
Script Updated. Check the first post again.
|
|
09-14-2013, 08:47 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Need help debugging various script functions
You have to make sure you provide the proper arguments in each of the function you're calling. The link that Javist provided is a complete list of available engine functions and what they need as arguments.
So, you'd look up a function. Say, PlaySoundAtEntity, and ensure that you pass the proper arguments.
If it still doesn't work, then the error lies within the script. ie, a timer isn't being called which would disrupt the sequence.
|
|
09-14-2013, 09:08 PM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
I just borrowed a hunk of appropriate code for one section from one of the Dark Descent maps, and inserted it. Should've worked, but it absolutely DID NOT. Didn't play, period. All the proper arguments are passed, i'm sure of it at this point. Must be the script that's the error. I'm going to toy around with debug messages for a few minutes, see if I can't force the problem to reveal itself.
Unless i've been using the wrong internal name. Is it possible to get a list of Amnesia's internal sound names? And the sequence shouldn't be interrupted by a lack of timer. All the functions have the &in as Timer parameter, and i'm SURE that the syntax is correct.
|
|
09-14-2013, 09:14 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Need help debugging various script functions
I would be weary of using code from existing maps. Unless you refactor it perfectly, there's bound to be issues.
How do you mean internal sounds?
You can find all of the sounds through the level editor.
|
|
09-14-2013, 09:17 PM |
|
Silent Darkness
Junior Member
Posts: 37
Threads: 9
Joined: Jul 2012
Reputation:
0
|
RE: Need help debugging various script functions
Uh, there's INTERNAL names for all the sounds amnesia uses. Like react_sigh6 may be the actual sound file name, but in the Dark Descent scripts, it's just "sigh".
And scratch another possibility, the script flows just fine.
proper parameters and script flow is perfect.....still at square 1. *sigh*
|
|
09-14-2013, 09:28 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Need help debugging various script functions
(09-14-2013, 09:28 PM)Drakeman1234 Wrote: Uh, there's INTERNAL names for all the sounds amnesia uses. Like react_sigh6 may be the actual sound file name, but in the Dark Descent scripts, it's just "sigh".
Really? I hadn't noticed.
Have you solved your issue?
|
|
09-14-2013, 09:40 PM |
|
|