Page 1 of 1

Destroy NPC after Dialogue is completed

Posted: Tue Jul 02, 2024 5:10 am
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.

Re: Destroy NPC after Dialogue is completed

Posted: Tue Jul 02, 2024 8:20 am
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)

Re: Destroy NPC after Dialogue is completed

Posted: Tue Jul 02, 2024 9:55 am
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.

Re: Destroy NPC after Dialogue is completed

Posted: Tue Jul 02, 2024 10:09 am
by Tony Li
Maybe in your custom close button mark that the NPC shouldn't be destroyed.

Re: Destroy NPC after Dialogue is completed

Posted: Wed Jul 03, 2024 4:41 am
by AJWantsToSleep
After trying out some things I finally found a solution that worked :D