Jump to content

Home

Weird Script Error


TimBob12

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...