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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Help] Envy the Dead Developemt & Scripting Questions
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#20
RE: [Help] Envy the Dead Developemt & Scripting Questions

(03-16-2013, 12:31 AM)plutomaniac Wrote: 2) How do sounds work exactly? Sometimes, unless I put the sounds very apart the second one is not being played. For example if I write the below, the second one is not heard at all. Basically I want one sound to play after the other:

PlayGuiSound("sound1", 1);
PlayGuiSound("sound2", 1); //I also tried PlayMusic function, same result

3) Does PreloadSound help with something like performance etc...?

2) By writing
PlayGuiSound("sound1", 1);
PlayGuiSound("sound2", 1);
it will play the sounds at the same time. If you want the second sound to play after the first sound finishes, you can use a timer. Add a timer so that once it reaches 0, the second sound will play. For example if the first sound was 3 seconds long:
PHP Code: (Select All)
void OnStart()
{
    
PlayGuiSound("sound1.snt"1); //Play first sound (remember to have extension, I think .ogg works too)
    
AddTimer("second_sound"3.0f"SecondSound"); //Will do SecondSound after 3 seconds
}

void SecondSound(string &in asTimer)
{
    
PlayGuiSound("sound2.snt"1);


Don't forget that you can also use PlaySoundAtEntity if you want to play the sound at a certain entity. Using PlayGuiSound does not use 3D at all.

3) Preloading is basically to improve performance. It will load the sound/particle system before it is played so that you don't get a mini lag spike when its played/created. Here's a thread that was created not too long ago: http://www.frictionalgames.com/forum/thread-20577.html

Edit: Robosprog's code is perfectly fine, but for this situation (something happens when item is picked up), it would probably be better to use SetEntityPlayerInteractCallback. This is Robosrog's code modified:
PHP Code: (Select All)
void OnStart()
{
    
SetEntityPlayerInteractCallback("pickuptinder""PickUpTinder, true);
}

void PickUpTinder(string &in asEntity)
{
    SetMessage("
Messages", "Dialogue", 3.50); // The category, then the text entry.


In Ruins [WIP]
(This post was last modified: 03-16-2013, 05:26 PM by NaxEla.)
03-16-2013, 04:53 AM
Find


Messages In This Thread
RE: [Help] Envy the Dead Developemt & Scripting Questions - by NaxEla - 03-16-2013, 04:53 AM



Users browsing this thread: 1 Guest(s)