Author Topic: End one conversation by beginning another?  (Read 334 times)

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
End one conversation by beginning another?
« on: March 23, 2012, 09:10:53 am »


               I want to have a conversation branch which calls a script which automatically starts a new conversation using a different conversation file.  So far, it's not working.  The original conversation ends, but the new conversation does not start.

Anyone have any suggestions?
               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #1 on: March 23, 2012, 03:03:13 pm »


               Check the end conversation scripts. The default I think is to WalkWayPoints(), which will
call ClearAllActions().
               
               

               
            

Legacy_wyldhunt1

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #2 on: March 24, 2012, 09:27:29 pm »


               I'd try adding a small 0.1 delay before starting the new convo. That should allow any background nonsense, such as the ClearAllActions() that meaglyn pointed out, to finish before the new convo tries to open.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #3 on: March 25, 2012, 02:07:51 pm »


               Places this on the ACTIONS_TAKEN TAB on the conversation node you want the new conversation to fire.

void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetObjectByTag("TAG_OF_NPC_HERE");

AssignCommand(oPC, ClearAllActions());
AssignCommand(oTarget, ActionStartConversation(oPC, ""));

}


Make sure the new NPC has their own conversation file. Also, if the new NPC that initiates the new conversation is quite a distance away, they'll run to the PC so the conversation can fire, so keep that in mind.

FP!
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #4 on: March 26, 2012, 02:40:32 pm »


               @meaglin:
A good idea, but it didn't work.  I tried altering the end of conversation script to make it fire the new conversation from variables, but with the same result.

@wyldhunt1:
I'd already tried a delay before firing the start conversation command, but it didn't work.

@Fester Pot:
I'm trying to start a new conversation between the player and the same NPC, not transfer to a new NPC.  This is for flexibility, so I don't have to alter the "base" conversation in order to add a new function to the NPC.
I've already tried almost exactly the same method as you showed here, except that I specified the conversation file name as a string variable.  The result was that the current conversation ended without starting the new conversation.

My next move will be to place debugging code into the script to confirm that it is trying to start the correct conversation file at the correct time.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #5 on: March 26, 2012, 03:43:38 pm »


                 Can't you link into a conversation node that's after a conditional that can't ever return true?  Actually, if the first main convo tree is always TRUE, the ones after are there but can't be displayed without linking directly to them anyways.  (Edit:  This one works)

  Also, I've never tried it, but can you link to a node in a different conversation file?  that could be extremely handy if it works.  (Edit: This one doesn't.  It would have been incredibly handy though.)
               
               

               


                     Modifié par Failed.Bard, 26 mars 2012 - 02:50 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #6 on: March 26, 2012, 04:03:10 pm »


               Most likely you are trying to start a new conversation while the  NPC is still in the old conversation.   Try adding your commands to start the new conversation to his Action Que.   Or if you are having the PC start it with him, from his action que,  Have your Action  check to see if the NPC or PC is still in conversation if they are resend after a delay.
               
               

               
            

Legacy_SHOVA

  • Hero Member
  • *****
  • Posts: 893
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #7 on: March 26, 2012, 05:00:49 pm »


               The main question is why do you think you need to start a new conversation?
You can have multiple speakers in a conversation, if all you looking for is to change the who is talking. You can script in checks so those conversation lines do not show up if not meeting the requirements, have the conversation jump to other lines, or what not.

The reason being is when you switch from one conversation to another its very hard to get the flow right for all who read it. you might find that the lines you made in the conversations, are passed over to quickly to be read by your audience. One conversation is easier to ensure lines of dialog are not missed.

good luck!
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #8 on: April 03, 2012, 11:18:45 am »


               Solved it, but first...

@Failed.Bard & @SHOVA:
The whole idea of this exercise is to make it unnecessary for me to edit the main conversation in order to add a new conversation branch to the NPC.  Modularising the conversation branches, if you will.

@Lightfoot8:
I put a ClearAllActions before the attempt to start the new conversation, which seems to be at the heart of the problem.

Which brings me to the solution.

I was doing:
object oPC=GetPCSpeaker();
object oSelf=OBJECT_SELF;
string sConvo=GetLocalString(uses definitions from an include file)
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionStartConversation(oSelf,sConvo,FALSE,FALSE));

When that didn't work, I tried using a delaycommand on the second assigncommand, but 1 second didn't seem to be enough.  5 seconds worked, but was too long.

The solution?  Take out the TRUE from the ClearAllActions command.

I'm not sure exactly why this works, but now the conversation branches to the new conversation file seamlessly, as though it's part of the same conversation file.

Just another of the minor "quirks" of NWN scripting to remember.

My thanks to everyone who tried to help.
               
               

               
            

Legacy_Sprinkles22

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
End one conversation by beginning another?
« Reply #9 on: July 19, 2013, 05:21:42 pm »


               Alright, so sorry for the zombie post, but I was searching the forums for a solution and Fester Pot's is as close as I can find.

I'd like to fire a script for an NPC directly after talking to a different NPC. combining their conversations into one would be FAR too complicated as both NPCs have extensive conversation trees. I tried this script, but as a NWN n00b am not sure if I put it in the right place. In the conversation editor, I went to actions and put in the script...was that correct? It's not working. I can zip and send the .mod if need be. Thanks!!