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
Amnesia script help
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#1
Amnesia script help

So im doing this scare when rocks are falling down at you and a sounds playing at the same time. The problem is that the map thats but then when it comes to it the script dosent activate.
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Awesome_key", "Awesome_door", "ABC", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "korridor", "bana", true, 1);
AddUseItemCallback("", "secret_key", "secret_door", "SECRET", true);
AddEntityCollideCallback("Player", "servant_grunt_1", "MonsterAway", true, 1);
AddEntityCollideCallback("Player", "falldown", "falldown", true, 1);
PlayMusic("creepy.ogg", false, 0.6, 5, 0.5, true);
AddEntityCollideCallback("Player", "checkpoint_1", "Restart", true, 1);
}

//INFO******************************
//PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
//INFO******************************

void Restart(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("FirstCheckpoint", "checkpoint_1_spawn", "Happening", "DeathCategory", "Deathtext");
}

void falldown(string &in asItem, string &in asEntity)
{
SetEntityActive("rock_med02_push_1", true);
SetEntityActive("rock_med02_push_2", true);
SetEntityActive("rock_med02_push_3", true);
SetEntityActive("rock_med02_push_4", true);
SetEntityActive("rock_med02_push_5", true);
SetEntityActive("rock_med02_push_6", true);
SetEntityActive("rock_med02_push_7", true);
SetEntityActive("rock_med02_push_8", true);
void PreloadSound(string& scare_falldown.ogg);
}

void ABC(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked( "Awesome_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Awesome_door", 0, false);
RemoveItem("Awesome_key");
}

void SECRET(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked( "secret_door", false, true);
PlaySoundAtEntity("", "unlock_door", "secret_door", 0, false);
RemoveItem("secret_key");
}

void bana(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("osynlig", true);
SetEntityActive("synlig", false);
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
08-25-2014, 08:52 PM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#2
RE: Amnesia script help

Bro,
PHP Code: (Select All)
void PreloadSound(stringscare_falldown.ogg); 
its not how you use sounds in Amnesia.

Use
PHP Code: (Select All)
PlaySoundAtEntity("""scare_falldown""Player"0false); 

or
PHP Code: (Select All)
PlayGuiSound("scare_falldown"1.0f); 
08-25-2014, 09:45 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#3
RE: Amnesia script help

@Theodorg
PHP Code: (Select All)
void falldown(string &in asItemstring &in asEntity)
{
SetEntityActive("rock_med02_push_1"true);
SetEntityActive("rock_med02_push_2"true);
SetEntityActive("rock_med02_push_3"true);
SetEntityActive("rock_med02_push_4"true);
SetEntityActive("rock_med02_push_5"true);
SetEntityActive("rock_med02_push_6"true);
SetEntityActive("rock_med02_push_7"true);
SetEntityActive("rock_med02_push_8"true);

Preload isn't a way to play sounds; it's a way to preload them so the game won't have to load them when the file plays. Because of this I removed the Preload function. Use PlayGuiSound or PlaySoundAtEntity. Note that PlayGuiSound is only for the Player and PlaySoundAtEntity is for any object.

@Lazzer .
Dude, in PlaySoundAtEntity and PlayGuiSound you need to specify the file's extension too, not just the name. File must be in .snt format.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 08-26-2014, 02:43 AM by PutraenusAlivius.)
08-26-2014, 02:42 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Amnesia script help

Despite it saying you need the extension on the script page, you don't actually need it. I think I remember the PlayGuiSound being able to run .ogg files too.

And just to elaborate in case it's unclear:
Quote:Note that PlayGuiSound is only for the Player and PlaySoundAtEntity is for any object.

PlayGuiSound will play a sound as if the sound was played exactly where the player is, and it plays with no 3D. This makes so it doesn't differ from right or left headphone or speaker. PlaySoundAtEntity will place the sound in the 3D world, which will allow the player to know where the sound comes from by listening to the distance and direction.

(This post was last modified: 08-26-2014, 09:41 AM by Mudbill.)
08-26-2014, 09:40 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Amnesia script help

The parameters in "void falldown" has been set to "(string &in asItem, string &in asEntity)".

This is wrong, since you specified in "void OnStart()" that it's a collide function. Smile

Collide functions go like this: (string &in asParent, string &in asChild, int alState)


I see you've done them correctly in your other functions but,
For more help: http://www.frictionalgames.com/forum/thread-18368.html

Trying is the first step to success.
(This post was last modified: 08-26-2014, 10:53 AM by FlawlessHappiness.)
08-26-2014, 10:51 AM
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#6
RE: Amnesia script help

The thing is that i dont know how to make the sound snt i created it myself with multiple sounds and put it in the extrasounds folder Smile

Now its in ogg format.

(08-26-2014, 10:51 AM)FlawlessHappiness Wrote: The parameters in "void falldown" has been set to "(string &in asItem, string &in asEntity)".

This is wrong, since you specified in "void OnStart()" that it's a collide function. Smile

Collide functions go like this: (string &in asParent, string &in asChild, int alState)


I see you've done them correctly in your other functions but,
For more help: http://www.frictionalgames.com/forum/thread-18368.html

Thanks man your page helped ALOT! Smile
(This post was last modified: 08-26-2014, 03:05 PM by theodorg.)
08-26-2014, 03:01 PM
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#7
RE: Amnesia script help

(08-26-2014, 03:01 PM)theodorg Wrote: The thing is that i dont know how to make the sound snt i created it myself with multiple sounds and put it in the extrasounds folder Smile

Now its in ogg format.

(08-26-2014, 10:51 AM)FlawlessHappiness Wrote: The parameters in "void falldown" has been set to "(string &in asItem, string &in asEntity)".

This is wrong, since you specified in "void OnStart()" that it's a collide function. Smile

Collide functions go like this: (string &in asParent, string &in asChild, int alState)


I see you've done them correctly in your other functions but,
For more help: http://www.frictionalgames.com/forum/thread-18368.html

Thanks man your page helped ALOT! Smile

Does anyone have any suggestions?
08-26-2014, 04:21 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: Amnesia script help

What do you not get?
First off, your sound file needs to be processed in the .ogg format. Secondly, you'll want a .snt text file that plays this .ogg file. Copy an existing .snt file and edit it + rename it. You can name it the same as the .ogg if you'd like.

Once you have both, just play the .snt file using either of the scripts already mentioned.

08-26-2014, 04:54 PM
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#9
RE: Amnesia script help

(08-26-2014, 04:54 PM)Mudbill Wrote: What do you not get?
First off, your sound file needs to be processed in the .ogg format. Secondly, you'll want a .snt text file that plays this .ogg file. Copy an existing .snt file and edit it + rename it. You can name it the same as the .ogg if you'd like.

Once you have both, just play the .snt file using either of the scripts already mentioned.

I put it like this now but the game crashes on startup:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Awesome_key", "Awesome_door", "ABC", true);
AddEntityCollideCallback("Player", "korridor", "bana", true, 1);
AddUseItemCallback("", "secret_key", "secret_door", "SECRET", true);
AddEntityCollideCallback("Player", "falldown", "falldown1", true, 1);
PlayMusic("creepy.ogg", false, 0.6, 5, 0.5, true);
AddEntityCollideCallback("Player", "checkpoint_1", "Restart", true, 1);
}

void Restart(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("FirstCheckpoint", "checkpoint_1_spawn", "Happening", "DeathCategory", "Deathtext");
}

void falldown1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("rock_med02_push_1", true);
SetEntityActive("rock_med02_push_2", true);
SetEntityActive("rock_med02_push_3", true);
SetEntityActive("rock_med02_push_4", true);
SetEntityActive("rock_med02_push_5", true);
SetEntityActive("rock_med02_push_6", true);
SetEntityActive("rock_med02_push_7", true);
SetEntityActive("rock_med02_push_8", true);
void PlaySoundAtEntity(string& "falldown", string& "scare_falldown.snt", string& "rock_med02_push_8", float 0, bool false);
}

and what does the internal name mean??? "asSoundName - internal name"
(This post was last modified: 08-26-2014, 06:02 PM by theodorg.)
08-26-2014, 06:01 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: Amnesia script help

internal name is the name you give it in the script.

So that you can refer back to it with

StopSound(asSoundName, float afFadeTime);

Trying is the first step to success.
08-26-2014, 06:16 PM
Find




Users browsing this thread: 2 Guest(s)