08-30-2011, 07:33 PM
Hey!
So I've picked up scripting and oh boy, do I love it! (no sarcasm intended)
Anyway, I do have a problem. I have a script for my map (for which I partly copy pasted some other scripts and changed stuff.)
But anyway, here is what I have so far:
Some sounds won't play, for example the scare_baby one, the piano one, the wind one, ...
Some others do play, such as the sounds with the doorslam.
Now, why won't it work? I've looked at the .snt file of e.g. the pianosound and it has a big range and 1,00 sound volume. Loud enough for me to hear it, right?
Another thing, in the waking up script the screen starts shaking heavily. My starterarea box is on the ground, not in any object.
Any thoughts? Thanks so much!
-Enexeus
So I've picked up scripting and oh boy, do I love it! (no sarcasm intended)
Anyway, I do have a problem. I have a script for my map (for which I partly copy pasted some other scripts and changed stuff.)
But anyway, here is what I have so far:
Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
}
void OnStart()
{
/////////////////////////////CALLBACKS & OTHER/////////////////////////
///////////////////////////////////////////////////////////////////////
AddEntityCollideCallback("Player", "slamdoor_1", "func_slam", true, 1);
AddEntityCollideCallback("Player", "wind_1", "func_wind", true, 1);
AddUseItemCallback("", "key_1", "leveldoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
wakeUp();
}
/////////////////////////////GAMEPLAY//////////////////////////////////
//////////////////////////////////////////////////////////////////////
void wakeUp ()
{
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(12); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true); // Simulates being on the ground
AddTimer("trig1", 08.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "scare_baby_cry2.snt", "Player", 0, false);
}
void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
AddTimer("trig2", 03.0f, "LookNote");
}
void LookNote(string &in asTimer)
{
StartPlayerLookAt("note_1", 6, 6, "");
AddTimer("trig3", 03.0f, "StopLook");
}
void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(10.0f, true);
SetLampLit("altar_lamp_1", true, true);
PlayMusic("The Dread", true, 50, 3, 0, true);
StartPlayerLookAt("wallcorpse_1", 6, 6, "");
AddTimer("trig4", 03.0f, "StopLook");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("leveldoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "leveldoor_1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
PlaySoundAtEntity("", "Pianosound_1.snt", "piano_01", 0, false);
FadeInSound("Pianosound_1.snt", 0, true);
SetEntityActive("wind_1", true);
}
void func_wind(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_wall_3", false, false);
SetLampLit("candlestick_wall_4", false, false);
SetLampLit("candlestick_wall_5", false, false);
SetLampLit("candlestick_wall_6", false, false);
SetLampLit("candlestick02_1", false, false);
SetLampLit("candlestick02_2", false, false);
SetLampLit("candlestick02_3", false, false);
SetLampLit("chandelier_nice_1", false, false);
SetLightVisible("PointLight_1", false);
SetLightVisible("PointLight_2", false);
SetLightVisible("PointLight_3", false);
SetLightVisible("PointLight_4", false);
SetLightVisible("PointLight_6", false);
SetLightVisible("SpotLight_1", false);
SetLightVisible("CandleStick_trl_1", false);
PlaySoundAtEntity("", "general_wind_blow.snt", "candlestick_wall_6", 0, false);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Some sounds won't play, for example the scare_baby one, the piano one, the wind one, ...
Some others do play, such as the sounds with the doorslam.
Now, why won't it work? I've looked at the .snt file of e.g. the pianosound and it has a big range and 1,00 sound volume. Loud enough for me to hear it, right?
Another thing, in the waking up script the screen starts shaking heavily. My starterarea box is on the ground, not in any object.
Any thoughts? Thanks so much!
-Enexeus