Aller au contenu

Photo

Conversation with NPC sitting in a chair


  • Veuillez vous connecter pour répondre
14 réponses à ce sujet

#1
Proleric

Proleric
  • Members
  • 2 356 messages

Conversation with a sitting NPC is easy enough (BeginConversation, ClearAllActions, ActionSit), but does anyone have a foolproof method of switching conversations while the NPC remains seated?

 

My general approach is to start the bespoke NPC conversation, switch to a generic conversation in the first conditional script (ActionStartConversation), then switch back to the rest of the bespoke conversation.

 

With some fine-tuning, I have the NPC sitting throughout, but on about 50% of occasions they stand up or slip sideways for a moment before sitting again.

 

Any improvement on that?

 

 



#2
Kato -

Kato -
  • Members
  • 392 messages

I'm also interested by the answer, if any. It would be nice if we could give a placeable the appearance of a creature but it does not seem feasible...



#3
WhiZard

WhiZard
  • Members
  • 1 204 messages

If you are going to the lengths of conversing with a placeable, then doing this is easy.  You converse with an invisible placeable with the name and portrait of the creature you wish to converse with (see the coding for the talk to item property).



#4
Kato -

Kato -
  • Members
  • 392 messages

If you are going to the lengths of conversing with a placeable, then doing this is easy.  You converse with an invisible placeable with the name and portrait of the creature you wish to converse with (see the coding for the talk to item property).

 

Interesting, WhiZard. Wiring a dynamic convo to anything is fairly simple but I did ignore this technique using an ip. 



#5
Proleric

Proleric
  • Members
  • 2 356 messages

I'm using placeables to handle some of the more complicated set-piece conversations, when seating, distance or cutscene camera movement are an issue. Sometimes the placeable is created for the duration, then deleted to avoid clutter. It does work very well, so I might have to resort to that, but there is a scripting overhead.

 

Also, I was hoping to use the same generic conversation I've developed for standing NPCs when sitting. As it stands, the NPC is OBJECT_SELF throughout. I'd have to make a lot of changes if OBJECT_SELF was a placeable, so I'm still hoping to make the dialogue swap work.

 

Part of the issue is BeginConversation(). The workaround of reseating the NPC only seems to work smoothly with that command, but it can only be used to launch the NPC's default conversation, not dialogue swapping. I also tried assigning ActionStartConversation to the PC. That has an odd bug - for the default conversation, OBJECT_SELF is the NPC, but for any other conversation, it's the PC. It seems like alternate conversations are a feature that was only part-implemented.

 

Here are the script fragments I have so far:

 

Spoiler

 

Sorry about the repetition, it needs tidying up with a function or two. Works quite well, but any suggestions for improvement welcome.



#6
Shadooow

Shadooow
  • Members
  • 4 471 messages

Just use the chair itself, give it a nameof a NPC and his portrait and make PCtalk to chair.


  • 3RavensMore aime ceci

#7
Proleric

Proleric
  • Members
  • 2 356 messages
Sure, that's the same logic as an invisible placeable, which has the additional possibility of being created with the same tag as the NPC.

The issues with a surrogate object in a generic setting are how to determine the NPC's default conversation (a local string on the NPC, perhaps), how to ensure that the conversation scripts refer to the NPC rather than the surrogate, and removal of the surrogate. All feasible, in principle, but a lot of rework unless building from scratch.

I haven't ruled it out, but I'll try to fine-tune what I have first.

#8
Proleric

Proleric
  • Members
  • 2 356 messages
I've now got an 80% success rate with part-based creatures (fixed appearance, low poly are better). Also, the exceptions now only attempt to stand very briefly, which I can probably live with.
 
The improvement came from stripping out redundant actions and enforcing Cutscene Immobilize on both conversations.
 
So what I have now is
 
Spoiler

  • Kato - aime ceci

#9
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

The trick here works flawlessly for me. 

 

http://forum.bioware...can-it-be-done/



#10
Proleric

Proleric
  • Members
  • 2 356 messages
Yes, that works fine if the conversation is all in one file, but here I'm talking about switching files in mid-conversation, to avoid duplicating generic content.

#11
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

Yes, that works fine if the conversation is all in one file, but here I'm talking about switching files in mid-conversation, to avoid duplicating generic content.

 

As long as you've got the action taken scripts linked into the other conversation, I think it should work OK. How are you transitioning into the other conversation - I've only done one such transition and it was using an action taken event to transition to the new conversation file and then, in the same script, making sure the NPC remained sitting. I also used the sitting script in the AT event of the first node of the other conversation as a fail safe.



#12
Proleric

Proleric
  • Members
  • 2 356 messages

Good suggestion, so I tested the "action taken" approach. Sadly, the results were similiar, only about 80% reliable for the full cycle from conversation A to B to A.

 

I prefer to issue ActionStartConversation and handle sitting in the first conditional script (not the "action taken" script). The most important reason is that the first conditional script always happens, even if it returns FALSE, so the code only needs to be in one place. Otherwise, the code has be duplicated in the "action taken" script of every conditional branch of the conversation that might be the first executed.

 

A secondary reason is that very occasionally the engine pauses between the conditional script and the action taken script, so, if ActionStartConversation is in the latter, a blank dialogue panel appears for a moment. This is especially noticeable with henchman scripts, which are executed so often that even tiny glitches are apparent.


  • Pstemarie et kalbaern aiment ceci

#13
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

I've tried that script

void main()
{
    string sChair = GetLocalString(OBJECT_SELF, "MY_CHAIR");
    object oChair = GetObjectByTag(sChair);

    if (GetIsObjectValid(oChair))
    {
        ClearAllActions();
        ActionSit(oChair);
    }
}

But it doesnt seem to work for me. I have it in the onspawn for the npc and in his action taken first line of dialogue and he doesn't budge. But I'm a pretty poor scripter so maybe I did something wrong.



#14
Proleric

Proleric
  • Members
  • 2 356 messages

In that example, you need to set a local variable MY_CHAIR on the NPC to the tag of a chair placeable, which must be unique.

 

Otherwise, the chair is undefined when the NPC spawns.

 

You're using the simple conversation script which Pstemarie referred to earlier. This thread is about the more complicated situation where one conversation launches another. For completeness, though, here's the script I use on spawn, which is slightly more general. It allows more than one NPC to use the same chair, and the same NPC to use several different chairs.

 

Spoiler

  • Nic Mercy aime ceci

#15
Nic Mercy

Nic Mercy
  • Members
  • 181 messages

In that example, you need to set a local variable MY_CHAIR on the NPC to the tag of a chair placeable, which must be unique.

 

Otherwise, the chair is undefined when the NPC spawns.

 

You're using the simple conversation script which Pstemarie referred to earlier. This thread is about the more complicated situation where one conversation launches another. For completeness, though, here's the script I use on spawn, which is slightly more general. It allows more than one NPC to use the same chair, and the same NPC to use several different chairs.

 

Spoiler

 

Thanks so much works great now!