hello,
i write a simple party system for the npc of my game, they to follow me, help in fights,, i'm control these functions with a bool on the npc "inParty" so if inParty is true for a npc, it will disable the "conversation trigger" collider and they will follow me etc.
i see there is variables section in dialogue but i'm not sure will help i need to set bool on my script for individual npc. is there a good way this can be with dialogue system?
set Bool for NPC that is convinced to join my party
-
- Posts: 1
- Joined: Sun Apr 01, 2018 12:32 pm
Re: set Bool for NPC that is convinced to join my party
Hi,
Instead of using a bool in your C# script, you can define a field in your NPC actor:
To set the field's value in a dialogue entry, use Script:
To check or set the field's value in a C# script, use DialogueLua:
Fields are included in saved games. When you load a game or change scenes, you can automatically activate/deactivate the NPC's conversation collider using a Persistent Active Data component:
Instead of using a bool in your C# script, you can define a field in your NPC actor:
To set the field's value in a dialogue entry, use Script:
To check or set the field's value in a C# script, use DialogueLua:
Code: Select all
using PixelCrushers.DialogueSystem;
...
// Is Fred in the party?
bool isInParty = DialogueLua.GetActorField("Fred the Warrior", "inParty").AsBool;
...
// Fred leaves the party:
DialogueLua.SetActorField("Fred the Warrior", "inParty", false);
DialogueManager.BarkString("Goodbye for now.", fred.transform);