scriptable objects and conditions

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
NedSanders
Posts: 13
Joined: Tue Jun 06, 2023 5:39 pm

scriptable objects and conditions

Post by NedSanders »

Hi!

On the suggestion of Tony Li, I'm using scriptable objects to track certain variables (specifically skills) with numbers attached to them. These obviously are kept separately from the variables in the dialogue system interface. If I want to simply reference them in conversation conditions or use scripts/sequences to change them how do I go about doing this?
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: scriptable objects and conditions

Post by Tony Li »

Hi,

Write C# methods to access those variables. These C# methods will have to act globally -- for example, accepting a character's name:

Code: Select all

public bool HasLockpickingSkill(string characterName) { ... }
or operating on the conversation's current conversant:

Code: Select all

public bool DoesCurrentConversantHaveLockpicking() { /* check DialogueManager.currentConversant ... */ }
Then register those methods with Lua.
NedSanders
Posts: 13
Joined: Tue Jun 06, 2023 5:39 pm

Re: scriptable objects and conditions

Post by NedSanders »

Thanks for the quick reply, Tony.

Could you go into a bit more detail about how to do this? (specifically writing 'methods') - or if not, direct me to some resource that may help me better understand?

Ultimately, all I really need to do is check if a scriptable objects value is above a certain value in the conditions field.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: scriptable objects and conditions

Post by Tony Li »

Hi,

The link in my previous reply contains instructions and a link to a video tutorial. It does require a bit of familiarity with C# scripting, though, so if you have any questions at all please let me know how I can help.
Post Reply