Hello,
I am looking for a way to disable or destroy an NPC object during a conversation if a particular conversation option is chosen. I am using Opsive's TPC. Is there a way with or without integration with Opsive's TPC to destroy the NPC object?
Thank you.
Destroying an NPC Object Within Conversation [Solved]
Destroying an NPC Object Within Conversation [Solved]
Last edited by pegassy on Fri Apr 06, 2018 11:43 pm, edited 1 time in total.
Re: Destroying an NPC Object Within Conversation
Hi,
Use the SetActive() sequencer command. For example:
Use the SetActive() sequencer command. For example:
- Dialogue Text (NPC): "Don't press this button."
- Dialogue Text: (Player) "[press button]"
- Sequence:
Code: Select all
Audio(Explosion); SetActive(Building,false)
- Dialogue Text (NPC): "Don't press this button."
- Dialogue Text: (Player) "[press button]"
- Sequence:
Code: Select all
Audio(Explosion); SetActive(Building,false); SetVariable(DestroyedBuilding,true)
- Target: Building
- Condition > Lua Conditions: Variable["DestroyedBuilding"] == true
Re: Destroying an NPC Object Within Conversation
You can use SendMessage(DestroyGameObject,,yourObject) then the gameobject yourObject must have a script with a method DestroyGameObject like this:
https://docs.unity3d.com/ScriptReferenc ... stroy.html
This destroy the gameobject, you cannot recovery it
https://docs.unity3d.com/ScriptReferenc ... stroy.html
This destroy the gameobject, you cannot recovery it
Re: Destroying an NPC Object Within Conversation
Thank you for the super helpful posts. I will try it. This is opens up many possibilities from within the dialogues!
Re: Destroying an NPC Object Within Conversation
It worked like a charm. Thanks a lot.