TimBob12 Posted November 19, 2010 Share Posted November 19, 2010 Hi there, I am currently working on a script to make an NPC run towards and start a converstaion. Unfortunately I am getting an unexpected end of file error on the last line and I can't see the problem. Any help would be appreciated. Thanks. TimBob12 void main() { // ST: Check if it's the player entering the trigger, and that it hasn't already fired if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) { // ST: Make sure the trigger only fires once. SetLocalBoolean(OBJECT_SELF, 40, TRUE); object oNPC1 = CreateObject(OBJECT_TYPE_CREATURE, "twilek", Location(Vector(6.32,-6.96,-0.18), 180.0)); location lMe=GetLocation(GetFirstPC()); ActionDoCommand(SetCommandable(TRUE,oNPC)); AssignCommand (oNPC, ActionStartConversation(GetFirstPC("protect_hostile"))); AssignCommand (oNPC,ActionForceMoveToLocation(lMe,TRUE)); } Link to comment Share on other sites More sharing options...
DarthNandis Posted November 19, 2010 Share Posted November 19, 2010 Try this? void main() { // ST: Check if it's the player entering the trigger, and that it hasn't already fired if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) { // ST: Make sure the trigger only fires once. SetLocalBoolean(OBJECT_SELF, 40, TRUE); object oNPC1 = CreateObject(OBJECT_TYPE_CREATURE, "twilek", Location(Vector(6.32,-6.96,-0.18), 180.0)); location lMe=GetLocation(GetFirstPC()); ActionDoCommand(SetCommandable(TRUE,oNPC)); AssignCommand (oNPC, ActionStartConversation(GetFirstPC("protect_hostile"))); AssignCommand (oNPC,ActionForceMoveToLocation(lMe,TRUE)); } } Link to comment Share on other sites More sharing options...
TimBob12 Posted November 19, 2010 Author Share Posted November 19, 2010 I've already tried. It brings up loads of errors and there is no need for it as there is only one open curly bracket. Link to comment Share on other sites More sharing options...
bead-v Posted November 19, 2010 Share Posted November 19, 2010 I've already tried. It brings up loads of errors and there is no need for it as there is only one open curly bracket. Not true, there are two open brackets, for void main(), and if(). Anyways, there was also another mistake (at ActionStartConversation()), here is the script that should work: void main() { // ST: Check if it's the player entering the trigger, and that it hasn't already fired if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) { // ST: Make sure the trigger only fires once. SetLocalBoolean(OBJECT_SELF, 40, TRUE); object oNPC1 = CreateObject(OBJECT_TYPE_CREATURE, "twilek", Location(Vector(6.32,-6.96,-0.18), 180.0)); location lMe=GetLocation(GetFirstPC()); ActionDoCommand(SetCommandable(TRUE,oNPC)); AssignCommand (oNPC, ActionStartConversation(GetFirstPC(), "protect_hostile")); AssignCommand (oNPC,ActionForceMoveToLocation(lMe,TRUE)); } } Link to comment Share on other sites More sharing options...
TimBob12 Posted November 20, 2010 Author Share Posted November 20, 2010 Thanks, I was just a bit annoyed at that not working cos its the script from a tutorial page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.