Skip to content

Insert Conversation Onto NPC?

ZephiriusZephirius Member Posts: 411
edited October 2022 in Builders - Scripting
What do I mean by this. I'm using my own dialog (for now) for my NPC. But at a certain juncture, I would like to "insert" the henchman dialog .ini into the conversation box of said NPC. Is this possible using code?
Essentially, I'm simply trying to swap out my conversation and insert the henchman dialog .ini using code.

If I'm missing something incredibly conspicuous (always a distinct possibility) please let me know.

EDIT - I'm embarrassed to admit this entry is quite convoluted and absurd. >:)
Please disregard this post.
Post edited by Zephirius on

Comments

  • ForSeriousForSerious Member Posts: 446
    Not sure why you want to do this, but I'll bet it's possible with json functions.
  • ProlericProleric Member Posts: 1,281
    The simplest way of giving an NPC a new conversation is by conditional scripting in the original conversation.

    No need to change the conversation specified in the template.

    Firstly, ensure that all the conditionals on opening lines in the original conversation are FALSE when the new conversation is required.

    Then, add a final opening NPC line, with no text, with the conditional
      AssignCommand(oPC, ClearAllActions());
      AssignCommand(oPC, ActionStartConversation(oNPC, "new_talk", FALSE, FALSE));
      return TRUE;
    

    In game, it will appear that the original conversation never happened - only the conversation new_talk appears.

    Note that, unusally, the action has to be assigned in the conditional script, not the Action Taken script, for this trick to work seamlessly.

    Tasking the NPC also works e.g.
      ActionStartConversation(oPC, "new_talk");
    

    but, in my experience, that can be a bit slower ard less reliable.

    The final NPC line doesn't need a PC response. If its conditional script can return FALSE with no new conversation under some circumstances, the PC response should definitely be omitted, so that the conversation simply ends.
  • KamirynKamiryn Member Posts: 74
    edited October 2022
    In game, it will appear that the original conversation never happened - only the conversation new_talk appears.
    Keep in mind however that (as far as I know) the original dialog's Cancel script (or Exit script depending of the results of the conditionals of the original dialog) gets called. This can have some unwanted effects.
    It seems that Exit/Cancel scripts of the original dialog are NOT called.
    Post edited by Kamiryn on
  • ProlericProleric Member Posts: 1,281
    IIRC there's an exception if the NPC line that launches the new conversation has multiple PC responses (which it normally won't).

    In that case, set a "switching conversation" flag. Do nothing in the conversation end script(s). Clear the flag in the new conversation.

  • ZephiriusZephirius Member Posts: 411
    ForSerious wrote: »
    Not sure why you want to do this, but I'll bet it's possible with json functions.

    I'm not even sure why I'm doing this. :p Nonetheless, It's good to hear from you again Serious...
Sign In or Register to comment.