Changing facing while sitting in conversation

I’m trying to improve the feel of some conversations by having the NPC and PC actually sit down partway through instead of just saying "[We sit down.]. One problem I ran into, though, is that they don’t always sit down facing the direction I expect. The PC especially seems to like to sit down facing the NPC that they’re in conversation with. I’ve tried some tricks with SetFacing to counteract this and haven’t had much success yet.

Anyone else tried this? Know of any quirks that could be messing me up?

ActionPauseConversation is the key here. SetFacing is not needed.

This script will make PC and NPC sit on their chairs (C1, C2) with correct facing and no pause in the conversation.

void SitNow(object oChair, object oUser=OBJECT_SELF)
    // pause the conversation
    AssignCommand(oUser, ActionPauseConversation());
    // clear action queue - purge APC
    AssignCommand(oUser, ClearAllActions());
    // sit with correct facing
    AssignCommand(oUser, ActionSit(oChair));

void main()
    SitNow(GetObjectByTag("C1"), GetPCSpeaker());
    SitNow(GetObjectByTag("C2"), OBJECT_SELF);

You can DelayCommand this script to sit mid-sentence.

If you need however to pause the conversation until both creatures settle down on their chairs, that’s a different story.

EDIT: using ActionResumeConversation in place of ClearAllActions works too and might actually be the expected course of actions, but in the end the result is the same.

The way to do that is to use GetSittingCreature on the chair. That is set when, and only when, the creature is actually sitting. A recursive script, testing that, say, every second, can be used to ActionResumeConversation when both are sitting.

1 Like

That’s what I have in the other script. I only added a sentinel to break the loop (prevent a convo deadlock) if some of the creatures do not sit for whatever reason after some time (i.e. 30 x 0.1s check delay = 3 seconds). Now that I think of it, this value could also be estimated from creature’s speed and distance to the chair…

I do something similar, because sometimes the engine simply has the creature thrashing about without actually sitting.

If the creature isn’t sitting after a couple of seconds, I clear actions and try again.

At each iteration, I increase the wait time by 50%, to prevent another kind of thrashing where the creature is constantly interrupted by the script before they reach the chair.

When sitting larger groups, I will sometimes use a black screen or other subterfuges to stop the player seeing all this activity.

Strangely, when simply spawning a room full of seated creatures, these problems are rare. It’s more noticeable when they walk /jump into the room before sitting.

Thanks, but unfortunately it didn’t work. My original script was pretty similar, though I basically had the conversation paused through both sit actions rather than resuming in between. Now I’m thinking the issue has to do with how I set up the chair objects. One was a regular chair placeable, but the other was an invisible object placed in a somewhat unusual location. The first time I set it up, the PC sat with the same facing as the placeable, but once I moved it around some more, particularly vertically, the whole arrangement seemed to stop working. :confused:

After some more experimentation, it looks like increasing the vertical height of a chair doesn’t increase the vertical position of a creature when they sit on it. Oh well, I’ll just live with that; it’s a small detail.

I assumed your creatures keep sitting towards each other rather than the way they should sit on the chairs is the main issue.

But the Lexicon page may have some possibly useful info.

You’re right though that the sitting direction may depend on the Z-offset of the placeable. With 0 (default), the creature sits in alignment to the invisible object’s facing, but with 1 it sits at +90 deg from it.

But since placeables can be - well - placed anywhere (out of map or intersect other objects and level geom), you can put your invisible chair right on the ground (Z = 0.0) and the creature should sit on it facing the correct direction as long as it can walk up to it.

To make the creature sit higher vertically you’d need to change the sitting animation, but that would affect all chairs and is thus not recommended.

Yeah, when screen goes dark, its probably easiest to apply ghost, jump them to the chairs, and then try to sit again.

My guess is the only way to move a sitting position up vertically (like having your feet dangling off the side of that bed) would be to modify the walkmesh in that spot so that it’s raised up. Or I suppose you could create a custom animation that just raises the creature up a certain amount as part of the animation. Seems like a custom walkmesh would be (relatively) more flexible though.