Aller au contenu

Photo

Triggered Player Speech


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

#1
grostilzirelman

grostilzirelman
  • Members
  • 21 messages
It's pretty basic honestly. I store a string called sPopUp on my trigger, and the onEnter scrpt should make the PC say the string. My PC speaks, but nothing is in the text box. Completely blank. Anyone know why?
  • void main()
  • {
  •     object oPC = GetEnteringObject();
  •     string sPopUp;
  •     string sSpeak = GetLocalString(OBJECT_SELF, sPopUp);
  •     if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
  •         return;
  •     SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);
  •     AssignCommand(oPC,SpeakString(sSpeak));
  • }

Modifié par grostilzirelman, 24 novembre 2012 - 05:36 .


#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
string sPopUp; creates a string with the lable sPopUp since you never give it a value it is equal to "" or a null string.

When you create
string sSpeak = GetLocalString(OBJECT_SELF, sPopUp);
you are saying
string sSpeak = GetLocalString(OBJECT_SELF, "");
since that is what sPopUp is equal to. It will return a null string that sSpeak end up being equal to.

Since you do not really need the sPopUp as a string var just get rid of that line and add quotes around the sPopUp Argg.

string sSpeak = GetLocalString(OBJECT_SELF, "sPopUp");

Modifié par Lightfoot8, 24 novembre 2012 - 07:14 .


#3
grostilzirelman

grostilzirelman
  • Members
  • 21 messages
My thanks!