Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting issues: sounds & other.
Enexeus Offline
Junior Member

Posts: 7
Threads: 1
Joined: Aug 2011
Reputation: 0
#1
Scripting issues: sounds & other.

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:

////////////////////////////
// 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
08-30-2011, 07:33 PM
Find
ObsidianLegion Offline
Member

Posts: 173
Threads: 53
Joined: Jun 2011
Reputation: 0
#2
RE: Scripting issues: sounds & other.

You're best putting the sounds into the story using the editor. Have you done that?

"Good men mean well; they just don't always end up doing well." -Isaac Clarke, Dead Space 2, Chapter 12
08-30-2011, 08:12 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#3
RE: Scripting issues: sounds & other.

(08-30-2011, 07:33 PM)Enexeus Wrote: 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?
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);
     }
I noticed that you have "Pianosound_1.snt". You may have imported your own sounds, I don't know. But if you didnt...
I looked into the sounds > general > "general_piano01.snt" is probally the one you want.

So check up on the rest of them and make sure their names match up correctly.

(08-30-2011, 07:33 PM)Enexeus Wrote: 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
Didn't see any StartScreenShake function in their. Not sure if their is another function that shakes the screen though.
08-30-2011, 08:13 PM
Find
Enexeus Offline
Junior Member

Posts: 7
Threads: 1
Joined: Aug 2011
Reputation: 0
#4
RE: Scripting issues: sounds & other.

(08-30-2011, 08:12 PM)Lolnesia09 Wrote: You're best putting the sounds into the story using the editor. Have you done that?

No I haven't, I'll look into that. Thanks!

(08-30-2011, 08:13 PM)Rapture Wrote: Didn't see any StartScreenShake function in their. Not sure if their is another function that shakes the screen though.

After screwing around with the playerstartarea I've been able to reduce the shaking a lot. I have no idea why.

Also, it indeed was a sound I imported myself. Wink

I'll get on it straight away, guys! Thanks again!
Update:

It didn't work.
I also added the lines: SetEntityActive("windblow_1", true); etc to make it work but to no avail.

The screen shaking is also back. :/

Anyone? Btw, should I be linking to the .nst or the .ogg file?
(This post was last modified: 08-30-2011, 08:33 PM by Enexeus.)
08-30-2011, 08:21 PM
Find
ObsidianLegion Offline
Member

Posts: 173
Threads: 53
Joined: Jun 2011
Reputation: 0
#5
RE: Scripting issues: sounds & other.

(08-30-2011, 08:21 PM)Enexeus Wrote:
(08-30-2011, 08:12 PM)Lolnesia09 Wrote: You're best putting the sounds into the story using the editor. Have you done that?

No I haven't, I'll look into that. Thanks!

(08-30-2011, 08:13 PM)Rapture Wrote: Didn't see any StartScreenShake function in their. Not sure if their is another function that shakes the screen though.

After screwing around with the playerstartarea I've been able to reduce the shaking a lot. I have no idea why.

Also, it indeed was a sound I imported myself. Wink

I'll get on it straight away, guys! Thanks again!
Update:

It didn't work.
I also added the lines: SetEntityActive("windblow_1", true); etc to make it work but to no avail.

The screen shaking is also back. :/

Anyone? Btw, should I be linking to the .nst or the .ogg file?

Link it to .ogg just to be safe. Have you added your sounds into your customs file in your Amnesia/custom_stories/YourCustom/sounds that may help.

post your .snt up too. I know how to deal with those.

"Good men mean well; they just don't always end up doing well." -Isaac Clarke, Dead Space 2, Chapter 12
08-30-2011, 08:55 PM
Find
Enexeus Offline
Junior Member

Posts: 7
Threads: 1
Joined: Aug 2011
Reputation: 0
#6
RE: Scripting issues: sounds & other.

I have indeed put the sound in that file.

.snt file:

<SOUNDENTITY>
  <SOUNDS>
      <Main>
          <Sound File="Pianosound_1.ogg" />
      </Main>
  </SOUNDS>
  <PROPERTIES Volume="1" MinDistance="0" MaxDistance="100" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="False" Blockable="False" BlockVolumeMul="0.5" Priority="0" />
</SOUNDENTITY>

Thanks for sticking with me. Wink
(This post was last modified: 08-30-2011, 09:08 PM by Enexeus.)
08-30-2011, 09:07 PM
Find
ObsidianLegion Offline
Member

Posts: 173
Threads: 53
Joined: Jun 2011
Reputation: 0
#7
RE: Scripting issues: sounds & other.

(08-30-2011, 09:07 PM)Enexeus Wrote: I have indeed put the sound in that file.

.snt file:

<SOUNDENTITY>
  <SOUNDS>
      <Main>
          <Sound File="Pianosound_1.ogg" />
      </Main>
  </SOUNDS>
  <PROPERTIES Volume="1" MinDistance="0" MaxDistance="100" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="False" Blockable="False" BlockVolumeMul="0.5" Priority="0" />
</SOUNDENTITY>

Thanks for sticking with me. Wink

Try upping the Volume to 60. If i'm not mistaken it's out of 100. Like a master volume control. Set a min distance to 1. Set use3D to true. See if that works.

"Good men mean well; they just don't always end up doing well." -Isaac Clarke, Dead Space 2, Chapter 12
08-30-2011, 09:20 PM
Find
Enexeus Offline
Junior Member

Posts: 7
Threads: 1
Joined: Aug 2011
Reputation: 0
#8
RE: Scripting issues: sounds & other.

(08-30-2011, 09:20 PM)Lolnesia09 Wrote: Try upping the Volume to 60. If i'm not mistaken it's out of 100. Like a master volume control. Set a min distance to 1. Set use3D to true. See if that works.

It didn't work. :/
Thanks for the idea though.


08-30-2011, 09:31 PM
Find
ObsidianLegion Offline
Member

Posts: 173
Threads: 53
Joined: Jun 2011
Reputation: 0
#9
RE: Scripting issues: sounds & other.

(08-30-2011, 09:31 PM)Enexeus Wrote:
(08-30-2011, 09:20 PM)Lolnesia09 Wrote: Try upping the Volume to 60. If i'm not mistaken it's out of 100. Like a master volume control. Set a min distance to 1. Set use3D to true. See if that works.

It didn't work. :/
Thanks for the idea though.

Did you add them in the editor using the sound tool?

"Good men mean well; they just don't always end up doing well." -Isaac Clarke, Dead Space 2, Chapter 12
08-30-2011, 09:39 PM
Find
Enexeus Offline
Junior Member

Posts: 7
Threads: 1
Joined: Aug 2011
Reputation: 0
#10
RE: Scripting issues: sounds & other.

(08-30-2011, 09:39 PM)Lolnesia09 Wrote:
(08-30-2011, 09:31 PM)Enexeus Wrote:
(08-30-2011, 09:20 PM)Lolnesia09 Wrote: Try upping the Volume to 60. If i'm not mistaken it's out of 100. Like a master volume control. Set a min distance to 1. Set use3D to true. See if that works.

It didn't work. :/
Thanks for the idea though.

Did you add them in the editor using the sound tool?

I have, problem is, the sounds play as soon as the map has launched instead of when I pick up the key.

I've made the sound inactive on the map editor and added this line of script at the right place:

SetEntityActive("pianosound_1.snt", true);

-Enexeus
08-30-2011, 09:47 PM
Find




Users browsing this thread: 2 Guest(s)