Destroy NPC after Dialogue is completed

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
AJWantsToSleep
Posts: 18
Joined: Wed Jun 19, 2024 2:44 pm

Destroy NPC after Dialogue is completed

Post by AJWantsToSleep »

Hello, I have a short question:

How can I destroy the NPC after I completed the whole Conversation?
I have a Close Button that closes a conversation whenever I want.
So with the Script I have right now the NPC is also being destroyed when I just close it.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Destroy NPC after Dialogue is completed

Post by Tony Li »

Hi,

You could destroy it (or mark it for destruction) in the final dialogue entry of the conversation. For example, use the SendMessage() sequencer command. Say your NPC is the speaker of the final entry, and it has a script with a MarkForDestruction() method. Then set the final entry's Sequence to:

Code: Select all

{{default}}; SendMessage(MarkForDestruction)
AJWantsToSleep
Posts: 18
Joined: Wed Jun 19, 2024 2:44 pm

Re: Destroy NPC after Dialogue is completed

Post by AJWantsToSleep »

Hey Tony, thanks for the reply.
Is there a way I can do that without having to do it for every single NPC?
Sometimes a NPC has up to 4 Options for a dialogue to end.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Destroy NPC after Dialogue is completed

Post by Tony Li »

Maybe in your custom close button mark that the NPC shouldn't be destroyed.
AJWantsToSleep
Posts: 18
Joined: Wed Jun 19, 2024 2:44 pm

Re: Destroy NPC after Dialogue is completed

Post by AJWantsToSleep »

After trying out some things I finally found a solution that worked :D
Post Reply