I’ve been playing about with scripting ( no, I’m not being modest, I don’t have a clue other than patching together bits of other scripts and relying on SG) !
I have a trigger which I want to produce floating text above an NPC’s head ( “Grandad” for this one). now I’m reasonable with creating triggers where the PC enters and speaks but what if you want someone else to speak. Tried it in SG and got part of the way but then had to work in the include to allow coloured text which in turn changes the way you script the speech (code for colour I want is “070”).
Bottom line is that I have a script which compiles but then doesn’t fire. Any thoughts on why this might be would be appreciated. I have a feeling I’m halfway between two stools at the moment.
#include "x3_inc_string"
/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.com/View.php?view=Other.Detail&id=1502
*/
// Put this script OnEnter.
void main()
{
object oPC = GetEnteringObject();
object oGdad = GetObjectByTag("Grandad");
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
return;
if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
return;
SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);
int i;
string sSpeak = GetLocalString(OBJECT_SELF, "SPEAK_0");
while (sSpeak != "")
{
DelayCommand(IntToFloat(i)*4.0, AssignCommand(oGdad,SpeakString(StringToRGBString(sSpeak, "070"))));
sSpeak = GetLocalString(OBJECT_SELF, "SPEAK_"+IntToString(++i));
}
}
Variable strings are stored properly.