Author Topic: Face original direction after conversation.  (Read 1147 times)

Legacy_Ryloth

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Face original direction after conversation.
« on: March 29, 2016, 01:52:32 am »


               

I have an NPC who's busy "working" at a table. When you chat with the NPC, it turns away from the table to chat. After the conversation completes, I'd like to have the PC turn back to the table and "resume" working.


 


I've tried this with a tagged POST_{NPC_TAG} waypoint, but so far no luck. After the conversation, the character continues facing away from his job.


 


Anyone know a nice way to approach this problem?



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Face original direction after conversation.
« Reply #1 on: March 29, 2016, 10:02:07 pm »


               I don't know of a way to do this witnout scripting, but the code can be a one-liner.


On spawn,


SetLocalFloat(OBJECT_SELF, "Facing", GetFacing(OBJECT_SELF);


On normal conversation end, instead of walking waypoints,


SetFacing(GetLocalFloat(OBJECT_SELF, "Facing"));


In practice, conversation may pull the NPC out of position, so I also set a local location. ActionMoveToLocation returns them to post, but then you need to ActionDoCommand the SetFacing so that it happens after the move.


Of course, you can just store the location, then use GetFacingFromLocation, if you find that clearer.


AI is fragile, so if you need a really robust approach, you might walkwaypoints to POST, then set the facing on every heartbeat, using IsInConversation to prevent turning while speaking,
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Face original direction after conversation.
« Reply #2 on: April 01, 2016, 10:07:07 pm »


               

Changing the OnConversation script to have the PC talk to an invisible placeable (With the NPCs portrait assigned to it) at the NPCs location instead, is a work-around I've used in the past.