Frictional Games Forum (read-only)
Advanced script widgets - 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 Articles (https://www.frictionalgames.com/forum/forum-40.html)
+---- Thread: Advanced script widgets (/thread-7521.html)

Pages: 1 2


RE: Advanced script widgets - palistov - 04-26-2011

Check and make sure you created areas equal to a, and named them spook_area_1, spook_area_2, etc until you reach spook_area_a.

Next, change file1.snt, file2.snt, etc to the proper sound files. You need cases in the switch function equal to d.

Make sure b and c are integers.


RE: Advanced script widgets - Exostalker - 04-26-2011

Thanks for making this, keep posting more! Big Grin

EDIT: Suggestion : Tutorial for how to after entering a level to seal and exit? I mean after loading screen you can look back on the door and let's say rocks will seal off the exit. I have seen it done in some custom stories Smile


RE: Advanced script widgets - Apjjm - 04-27-2011

There is a more flexible concise way to play a random sound:
Code:
void playRandomSound(string soundName, string[] sounds, string atEntity, float fadeTime, bool saveSound)
{
  //Select a random index from the array
  int rand = RandInt(0,sounds.length()-1);
  //Play the sound at that index with the given settings
  PlaySoundAtEntity(soundName, sounds[rand], atEntity, fadeTime, saveSound);
}
Usage could be something like:
Code:
//Idea 1:
void someFunction()
{
  string[] mySounds = {"Sound1.snt","Sound2.snt","randomSound.snt","Magic.snt"};
  playRandomSound("Random",mySounds,"Player",0.5f,false);
}
//Idea 2:
string[] levelSounds = {"Sound1.snt","Sound2.snt","randomSound.snt","Magic.snt"};
void OtherCodeHere() {}
void someScriptCollisionCallback(string &in asParent, string &in asChild, int alStat)
{
  playRandomSound("Random",levelSounds,asChild,0.5f,false);
}
Void MoreCodeHere() {}
But nice list, i may have one or two neat little scripts i can dig out.


RE: Advanced script widgets - palistov - 04-27-2011

Nice Apjjm I'll toss that up on the initial post. I'll put timers so it loops too Big Grin Very nice, sir. I didn't even know you could use playRandomSound() like that Big Grin

Toss functions like that up on the wiki if you get the time Smile


RE: Advanced script widgets - Simpanra - 05-01-2011

i am trying to use the ghost steps function =) but i dont know what the "scary"+asTimer is referencing in the CreateFootstep function?