Aller au contenu

Photo

Rest and play sound?


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Fester Pot

Fester Pot
  • Members
  • 1 394 messages

Can't get this to work. The sound ALWAYS plays after the rest sequence.

void main()
{
    object oPC = GetLastPCRested();

 if (GetLastRestEventType()==REST_EVENTTYPE_REST_STARTED)
        {

            if (GetLocalInt(GetFirstPC(), "canrest") == 0)
            {

            FloatingTextStringOnCreature("You can't rest here . . .", oPC, FALSE);
            AssignCommand(oPC, ClearAllActions());
            return;
            }
       AssignCommand(oPC, PlaySound("Camping"));
       DelayCommand(0.5, FadeToBlack(oPC,FADE_SPEED_SLOW));

 }
        else if (GetLastRestEventType()==REST_EVENTTYPE_REST_CANCELLED)
        {
         // No longer used but left in for the community
         // WMFinishPlayerRest(oPC,TRUE); // removes sleep effect, etc
         FadeFromBlack(oPC,FADE_SPEED_SLOW);
        }
        else if (GetLastRestEventType()==REST_EVENTTYPE_REST_FINISHED)
        {
         // No longer used but left in for the community
         //   WMFinishPlayerRest(oPC); // removes sleep effect, etc
         FadeFromBlack(oPC,FADE_SPEED_SLOW);
        }
    }

How can I get sound to play DURING the sequence?

 

For testing purposes, just change "Camping" to some other wav related mono sound that comes with NWN.

 

FP!



#2
henesua

henesua
  • Members
  • 3 878 messages

In my experience you can not get sound to play on a creature with a full action queue.

 

You have a couple options that i am aware of:

  • clear the PCs action queue, then apply the sound. You will need to reestablish the rest afterwards.
  • create an invisible placeable to play the sound on. when done, destroy the placeable.


#3
Fester Pot

Fester Pot
  • Members
  • 1 394 messages

Ah, thanks Henesua. Too much trouble for what it's worth.

 

FP!