Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Weird Script Error

Page: 1 of 1
 TimBob12
11-19-2010, 12:38 PM
#1
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));

}
 DarthNandis
11-19-2010, 1:08 PM
#2
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));
}
}
 TimBob12
11-19-2010, 1:57 PM
#3
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.
 bead-v
11-19-2010, 6:24 PM
#4
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));
}
}
 TimBob12
11-20-2010, 3:03 AM
#5
Thanks, I was just a bit annoyed at that not working cos its the script from a tutorial page.
Page: 1 of 1