How to play sounds in cutscenes (gestalt scripts)
#1
Posté 26 septembre 2014 - 03:39
#2
Posté 26 septembre 2014 - 05:48
A sound object has three different "names" - the name, the tag and the blueprint resref (found under the advanced tab). Have you tried each of them in turn? Also the name is a string. You are enclosing it in quotation marks (i.e. "fred_sound"), aren't you?
TR
#3
Posté 26 septembre 2014 - 06:23
I hadn't tried the resref name, but it doesn't seem to be working either.
I did however find a script which did it in the following way:
object oSound = GetObjectByTag("sound_tag");
DelayCommand(2.0,SoundObjectPlay(oSound));
This does work, but it requires a sound object to be placed in the area, which permissibly has to be destroyed after usage.
Is this the way it's usually done, or should the GestaltPlaySound() work approximately the way I tried to use it?
#4
Posté 29 septembre 2014 - 07:36
So I went and had a look at what I did in this situation when I made "Hrothgar's Resting Place". Having looked at my code it turns out that I may have run into the same problem. Before I show you my solution (by showing the whole of the very short cutscene code, I have one last question. The sound you want played does exist? The reason I ask is because, just on rare occasions, NwN "forgets" a sound. I'm not sure why but it may be something to do with custom content.
OK here is the code snippet I promised.
GestaltStartCutscene(oPC, "giveinscene", TRUE, TRUE, TRUE, TRUE, 2);
AssignCommand(oPC, SpeakString("(Seeker) Scabbard! Scabbard! Scabbard!"));
if((GetGender(oPC)) == GENDER_MALE)
DelayCommand(1.0f, AssignCommand(oPC, PlaySound("as_pl_x2screamm5")));
else
DelayCommand(1.0f, AssignCommand(oPC, PlaySound("as_pl_x2screamf3")));
GestaltActionAnimate(1.01f, oPC, ANIMATION_LOOPING_TALK_FORCEFUL, 3.5f);
DelayCommand(2.0f, AssignCommand(oPC, SpeakString("(" + sName + ") Enough already! I'll find you a scabbard!")));
GestaltStopCutscene(5.0, oPC);
The commands that you want are between the if and else statements. What it does is wait a second and then it tells the PC to play the scream sound. It does not need a sound object to be placed in the area.
TR
#5
Posté 03 octobre 2014 - 03:18
Hey!
I just now checked on this thread again.
I had figured out how to use sound objects, but your solution is more elegant. It works with the sound I posted above, so apparently it does exist.
Thanks for the help, much appreciated!





Retour en haut






