Jump to content

Home

move npc script


DarthStoney

Recommended Posts

I need help with a little script it is for TSL. I am trying to get an npc to

come towards my character and start a conv. everything works except

the npc does not move. Have even tried adding a specific waypoint for

him to move to with no success. this is the script I am using.

 

void main() {

object oEntering = GetEnteringObject();

object oPC=GetFirstPC();

object oKaah = GetObjectByTag("Kaah", 0);

AssignCommand(oKaah, ClearAllActions());

AssignCommand((GetObjectByTag("Kaah")),ActionMoveToObject(oPC));

AssignCommand(oKaah, ActionStartConversation(GetFirstPC(), "", 0, 0, 0, "", "", "", "", "", "", 0));

DestroyObject(OBJECT_SELF);

}

Link to comment
Share on other sites

object oEntering = GetEnteringObject();

You should use the GetEnteringObject function to check whether the object is a player controlled character so some other object doesn't trip the script. Also you might want to make sure you are using an uppercase K in your .utc's Tag field. (I'd recommend always use lowercase so you don't have to try to remember when it comes time to script.)

 

Try this instead. You can remove the SendMessageToPC lines after you're done debugging. :)

void main() {
 object oPC=GetFirstPC();
 SendMessageToPC(oPC,"DEBUG: My script has fired"); //optional debug line
 if (GetEnteringObject() != oPC) { 
   return; 
 }
 SendMessageToPC(oPC,"DEBUG2: PC has entered"); //optional debug line
 object oKaah = GetObjectByTag("Kaah");
 if (!GetIsObjectValid(oKaah)) {
   SendMessageToPC(oPC,"DEBUG: Eek, could not find Kaah!");
   return;
 }
 SendMessageToPC(oPC,"DEBUG3: Telling Kaah to come here and talk to me"); //optional
 AssignCommand(oKaah, ClearAllActions());
 AssignCommand(oKaah, ActionMoveToObject(oPC));
 AssignCommand(oKaah, ActionStartConversation(oPC));
 SendMessageToPC(oPC,"DEBUG4: Destroying trigger object"); //optional
 DestroyObject(OBJECT_SELF);
}

Link to comment
Share on other sites

If you just want them to fall over and die a simple script like this should work:

 

void main() {
   object oVictim = GetObjectByTag("DeadAsADoorNail");
   AssignCommand(oVictim, SetIsDestroyable(FALSE));
   AssignCommand(oVictim, PlayAnimation(ANIMATION_LOOPING_CHOKE_WORKING, 1.0, 0.5));
   DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oVictim));      
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...