Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Thread Closed 
 
Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advanced script widgets
Author Message
palistov Offline
Posting Freak

Posts: 1,186
Joined: Mar 2011
Reputation: 56
Post: #11
RE: Advanced script widgets
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.

04-26-2011 03:43 PM
Find all posts by this user
Exostalker Offline
Member

Posts: 192
Joined: Aug 2010
Reputation: 1
Post: #12
RE: Advanced script widgets
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

(This post was last modified: 04-26-2011 08:58 PM by Exostalker.)
04-26-2011 05:22 PM
Find all posts by this user
Apjjm Offline
Super Moderator

Posts: 444
Joined: Apr 2011
Reputation: 42
Post: #13
RE: Advanced script widgets
There is a more flexible concise way to play a random sound:
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:
//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.
(This post was last modified: 04-27-2011 09:23 PM by Apjjm.)
04-27-2011 09:21 PM
Find all posts by this user
palistov Offline
Posting Freak

Posts: 1,186
Joined: Mar 2011
Reputation: 56
Post: #14
RE: Advanced script widgets
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

(This post was last modified: 04-27-2011 10:02 PM by palistov.)
04-27-2011 10:01 PM
Find all posts by this user
Simpanra Offline
Senior Member

Posts: 314
Joined: Mar 2011
Reputation: 0
Post: #15
RE: Advanced script widgets
i am trying to use the ghost steps function =) but i dont know what the "scary"+asTimer is referencing in the CreateFootstep function?
05-01-2011 10:31 PM
Find all posts by this user
Thread Closed 




User(s) browsing this thread: 1 Guest(s)