Jump to content

Home

need npc script that makes npc walk to you for the on notice field.


randydg

Recommended Posts

Originally posted by randydg

need npc script that makes npc walk to you for the on notice field.

or to make the pc walk to the npc. either will work.

thanks ahead of time.

 

There's a script here:

 

http://www.lucasforums.com/showthread.php?s=&threadid=143412

 

that has a "How can I make an NPC walk up to me and start a conversation?" type script... not sure if that's what you're looking for however? I'm a script-tard® :p

 

void main() {
 object oNPC=GetObjectByTag("npc_tag");
 location lMe=GetLocation(GetFirstPC());
   ActionDoCommand(SetCommandable(TRUE,oNPC));
 AssignCommand (oNPC,ActionForceMoveToLocation(lMe,FALSE));
 AssignCommand (oNPC, ActionStartConversation(GetFirstPC()));
}

Link to comment
Share on other sites

you could setup a script off of a trigger placed infront of the person you want the conversation to begin off of.

 

And to make it fire just once setup of a global number.

 

I think you know how to do this already though.

If you are like me you have a good idea, but then have to settle with doing something you know will work but won't look as good. Dems da breaks.

Link to comment
Share on other sites

You should probably use MoveToObject rather than MoveToLocation, otherwise the NPC will move to where the player was when the script triggered, rather than to where the player really is, which isn't necessarily the same if the player is moving when spotted.

 

Here is an untested variant which I think would work (which is no guarantee that it actually does work :) ).

 

Compile and put this script as the OnPerception event script of the NPC:

void main() {
   object oSeen = GetLastPerceived();

   if (GetLastPerceptionSeen() 
       && (oSeen == GetFirstPC())
       && !GetLocalBoolean(OBJECT_SELF, 61)
       && (GetCurrentAction() != ACTION_MOVETOPOINT)) 
   {
       // ST: Spotted the player, move to them...
       ClearAllActions();
       ActionForceMoveToObject(oSeen, FALSE, 2.0, 10.0);
       ActionDoCommand(SetLocalBoolean(OBJECT_SELF, 61, TRUE));
   }
   else if (!GetLocalBoolean(OBJECT_SELF, 61)
       && (GetCurrentAction() == ACTION_MOVETOPOINT))
   {
       // ST: (Hopefully) moving to PC, do nothing...  
   }
   else {
       // ST: Do the usual on-perception AI....
       ExecuteScript("k_ai_master", OBJECT_SELF, 1002);
   }
}

Link to comment
Share on other sites

thanks for the script.

 

 

and yea, your right about that.

 

think you know how to do this already though.

If you are like me you have a good idea, but then have to settle with doing something you know will work but won't look as good. Dems da breaks

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...