I have been having issues with managing a conversation tree. I am using PAWN as a scripting language (I have no other options, unfortunately) and I use MySQL databases to store user and game data.
My current issue is storing game conversation trees using SQL. Currently, I have the following table:
TABLE NAME: dialogue
ID: global ID of conversation option
Prompt: question or sentence shown on player's screen
Answer: NPC's answer
[some other stuff related to conditions and mood checks, etc.]
Now, my problem is the following. Suppose I greet the NPC, this would be something like this:
ID: 1
Prompt: Hello there.
Answer: Hi, how's it going?
I want my conversation tree to progress after the player greets the NPC. This is not problematic, I simply use an additional SQL table for that:
TABLE NAME: dialoge_unlock_lock
ID: global ID of dialogue element
Unlocks: option this element unlocks
Locks: option this element locks.
My problem is the following: suppose I greeted the NPC, this would unlock 5 conversation options for the player to choose from (they would have IDs 2-6 for this NPC, and perhaps 241-245 for another NPC). I choose question #2, this would unlock question #8 and lock question #7.
How could I check what questions the player has locked in the current dialogue tree? In this example, I don't want the player to just see question #8, but I want him to see every question that is currently available to him (that is, questions 2-6 & 8).
I have been sitting on this for days and I can't figure out a way to do it. This pretty much sums up my attempts, any help would be greatly appreciated.