Frictional Games Forum (read-only)
Amnesia script help - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Amnesia script help (/thread-25956.html)

Pages: 1 2


Amnesia script help - theodorg - 08-25-2014

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()
{

}


RE: Amnesia script help - Slanderous - 08-25-2014

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

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

or
PHP Code:
PlayGuiSound("scare_falldown"1.0f); 



RE: Amnesia script help - PutraenusAlivius - 08-26-2014

@Theodorg
PHP Code:
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.


RE: Amnesia script help - Mudbill - 08-26-2014

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.


RE: Amnesia script help - FlawlessHappiness - 08-26-2014

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


RE: Amnesia script help - theodorg - 08-26-2014

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


RE: Amnesia script help - theodorg - 08-26-2014

(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?


RE: Amnesia script help - Mudbill - 08-26-2014

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.


RE: Amnesia script help - theodorg - 08-26-2014

(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"


RE: Amnesia script help - FlawlessHappiness - 08-26-2014

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

So that you can refer back to it with

StopSound(asSoundName, float afFadeTime);