Simple gifting based on items?
Posted: Fri Sep 09, 2022 12:52 pm
Hi there other Tony,
So.. i have a question, i hope this is not too complicated / crazy.
I'd like to have the player be able to choose from items he has to gift and have that displayed in the dialog options?
I have an Inventory script with a list which contains a List of 'Item'
(a class... Derived from scriptable object.)
Until now was my method was:
- I have a bool 'HasDrink' (in the dialogue system / variable tab).
- This worked as a condition that opens up a dialog path, allowing gift options.. once you gift something, the conversation ends...
But i would like to make it so the player can choose which of his items he can give away...
I have a few basic question i guess:
- Am i doing this 'wrong' is there an easier way to do this... ? I'm not a physicist, nor do i want to learn anymore programming if i can help it lol.. But... sure would like an easier way to organise this lol...
- Is the stuff below valid? I think im registering these string functions... But last i tested, they were not showing up anywhere in the dialog GUI.. and when i put them in the condition box... the conversation never went down that route...
and it's somewhat hard to test? because its buried deep in a conversation...
-- which brings me to question 3.. how can i more easily debug this condition / situation? any advice appreciated!
cheers,
another Tony
So.. i have a question, i hope this is not too complicated / crazy.
I'd like to have the player be able to choose from items he has to gift and have that displayed in the dialog options?
I have an Inventory script with a list which contains a List of 'Item'
(a class... Derived from scriptable object.)
Until now was my method was:
- I have a bool 'HasDrink' (in the dialogue system / variable tab).
- This worked as a condition that opens up a dialog path, allowing gift options.. once you gift something, the conversation ends...
But i would like to make it so the player can choose which of his items he can give away...
I have a few basic question i guess:
- Am i doing this 'wrong' is there an easier way to do this... ? I'm not a physicist, nor do i want to learn anymore programming if i can help it lol.. But... sure would like an easier way to organise this lol...
- Is the stuff below valid? I think im registering these string functions... But last i tested, they were not showing up anywhere in the dialog GUI.. and when i put them in the condition box... the conversation never went down that route...
and it's somewhat hard to test? because its buried deep in a conversation...
-- which brings me to question 3.. how can i more easily debug this condition / situation? any advice appreciated!
Code: Select all
void OnEnable()
{
Lua.RegisterFunction("HasDrinkA", this, SymbolExtensions.GetMethodInfo(() => HasDrink1()));
Lua.RegisterFunction("HasDrinkB", this, SymbolExtensions.GetMethodInfo(() => HasDrink1()));
}
[SerializeField] string hasDrink1;
public string HasDrink1()
{
if (Items.FindAll(x => x.thirstItem == true).Count == 0)
return "";
return Items.Find(x => x.thirstItem == true).name;
}
cheers,
another Tony