Aller au contenu

Photo

NPC Text Delay Script


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
Rabstir

Rabstir
  • Members
  • 5 messages
I am not sure how to put a DelayCommand (10.0, ...); so each case is not fired every heartbeat in the following script:-

The idea is put a single line entry delay to cater for each case firing, thanks:):crying:

void main()
{
  object oPC = GetLastPerceived();
  if (!GetIsPC(oPC)) return;
  if (!GetIsInCombat() && GetLastPerceptionSeen() && !IsInConversation(OBJECT_SELF))
  {

     string sSpeakString;
     switch (d6())
     {

        case 1: sSpeakString = "Oh look what I found in my bag."; break;
        case 2: sSpeakString = "Hey Mr, did you drop this?"; break;
        case 3: sSpeakString = "I am so bored"; break;
        case 4: sSpeakString = "Any Dwagons to hunt here?"; break;
        case 5: sSpeakString = "That ring is nice and shiny!"; break;
        case 6: sSpeakString = "Hey Fizban, how about some fireworks?"; break;

        }
       
        SpeakString(sSpeakString, TALKVOLUME_TALK);
 
}

Modifié par Rabstir, 29 août 2011 - 08:41 .


#2
_Guile

_Guile
  • Members
  • 685 messages
OK, based upon what limited information you gave me, here is your fix, I hope...

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

  if (!GetIsPC(oPC))
  {return;}

  float fDelay = 0.0; // By default there is NO delay.
  // NOTE: Delays are in Seconds! 2.5 = 2 seconds and One Half of a seconds

  string sSpeakString;
 

  if (!GetIsInCombat() && GetLastPerceptionSeen() && !IsInConversation(OBJECT_SELF))
  {

     switch (d6())
     {

        case 1:
        { fDelay = 1.1; // NOTE: You need to set the delay time for EACH Case!
          sSpeakString = "Oh look what I found in my bag.";} break;

        case 2:
        { fDelay = 1.2; sSpeakString = "Hey Mr, did you drop this?";} break;
        case 3:
        { fDelay = 1.3; sSpeakString = "I am so bored"; }break;
        case 4:
        { fDelay = 1.4; sSpeakString = "Any Dwagons to hunt here?"; }break;
        case 5:
        { fDelay = 1.5; sSpeakString = "That ring is nice and shiny!"; }break;
        case 6:
        { fDelay = 1.6; sSpeakString = "Hey Fizban, how about some fireworks?"; }break;

        }
       
        DelayCommand(fDelay, SpeakString(sSpeakString, TALKVOLUME_TALK));
 
}

Modifié par _Guile, 30 août 2011 - 12:00 .