Author Topic: Conversation with NPC sitting in a chair  (Read 493 times)

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« on: March 11, 2015, 06:06:49 pm »


               

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?


 


 



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #1 on: March 12, 2015, 01:17:01 am »


               

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...



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #2 on: March 12, 2015, 03:13:50 am »


               

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).



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #3 on: March 12, 2015, 03:18:10 am »


               


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. 


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #4 on: March 12, 2015, 06:28:57 am »


               

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.


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #5 on: March 12, 2015, 09:51:50 am »


               

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



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #6 on: March 12, 2015, 10:31:27 pm »


               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.
               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #7 on: March 13, 2015, 09:11:06 am »


               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
   


               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #8 on: March 21, 2015, 10:47:53 pm »


               

The trick here works flawlessly for me. 


 


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



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #9 on: March 21, 2015, 11:50:54 pm »


               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.
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #10 on: March 22, 2015, 02:20:32 pm »


               


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.



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #11 on: March 23, 2015, 08:28:50 am »


               

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.



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #12 on: March 24, 2015, 03:29:46 am »


               

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.



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #13 on: March 24, 2015, 07:09:21 am »


               

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
   



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Conversation with NPC sitting in a chair
« Reply #14 on: March 24, 2015, 02:47:04 pm »


               


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!