Page 1 of 2

Tutorial of Karma System in Dialogue System

Posted: Sat Sep 10, 2016 5:13 pm
by HaiiroMukuro
Good day! Is there any tutorials for making a Karma system in the dialogue system?

Re: Tutorial of Karma System in Dialogue System

Posted: Sat Sep 10, 2016 6:47 pm
by bohnstudios
Have you checked out Love/Hate? There is an included demo that does a pretty good job of showing how it's set-up. Works seamlessly with Dialogue System.. http://www.pixelcrushers.com/love-hate/

Re: Tutorial of Karma System in Dialogue System

Posted: Sun Sep 11, 2016 1:15 am
by Tony Li
Thanks @bohnstudios! That's the best way to do it.

Another way is to use the Dialogue System's Status and Relationship Functions. There are no tutorials for them, though. If you have questions about using them, just let me know. I'll be happy to answer here.

Re: Tutorial of Karma System in Dialogue System

Posted: Sun Sep 11, 2016 6:09 pm
by HaiiroMukuro
Thank you for replies. :D I have an idea but still I don't know how to do it. For example, I declare a variable named "Karma."
I set the initial value to 50.
Now here's the quest, Sergeant Graves commands the player to rescue a hostages. The player have rescue the hostages but, there's still one missing. Now, the player found the terrorist together with the hostage. The terrorist is pointing his gun to the hostage. The terrorist asking the player to surrender. Now here's the choices which the player will decide. Every choices contains value.
a. Don't Surrender, negotiate with the terrorist. (good = 15 points.)
b. Shoot the terrorist together with the hostage. (Evil = -30 points.)
c. Drop your gun. (Neutral = 0 points.)
Now, I put a script on each response.
a.
Image
b.
Image
c.
Image
-
Now here's my question, is this correct?

Re: Tutorial of Karma System in Dialogue System

Posted: Sun Sep 11, 2016 6:20 pm
by Tony Li
Very close, but you'll want to add/subtract from the current value of Karma, and use the Script field, like this:
  • Dialogue Text: Don't Surrender, negotiate with the terrorist.
  • Script:

    Code: Select all

    Variable["Karma"] = Variable["Karma"] + 15;
  • Dialogue Text: Shoot the terrorist together with the hostage.
  • Script:

    Code: Select all

    Variable["Karma"] = Variable["Karma"] - 30;
You can use the Lua wizard ("..." button) to enter this for you. You don't have to type it manually.


In the Script field, you can also use the ShowAlert() function if you want to show a message like "XYZ will remember that" in Telltale games. For example:
  • Dialogue Text: Don't Surrender, negotiate with the terrorist.
  • Script:

    Code: Select all

    Variable["Karma"] = Variable["Karma"] + 15;
    ShowAlert("Gained 15 karma")
  • Dialogue Text: Shoot the terrorist together with the hostage.
  • Script:

    Code: Select all

    Variable["Karma"] = Variable["Karma"] - 30;
    ShowAlert("<color=red>Lost 30 karma</color>")
(I added a color code to the last one to get fancy. ;) )

Re: Tutorial of Karma System in Dialogue System

Posted: Sun Sep 11, 2016 6:41 pm
by HaiiroMukuro
Thanks for the help! I'll ask more if I still have questions. Have a great day! :D

Re: Tutorial of Karma System in Dialogue System

Posted: Mon Sep 12, 2016 6:03 am
by HaiiroMukuro
How will I use Lua codes to trigger a conversation?
For example, if Player has a 65 karma. He needs to talk to Sergeant Graves that he already finish the quest rescuing the hostages.
Sergeant Graves needs 65 karma to trigger the conversation, else another conversation will trigger.
I have an idea, I hope this is correct.
If player has a 65 karma above.
Image
else
Image.
Are these correct? :?:

Re: Tutorial of Karma System in Dialogue System

Posted: Mon Sep 12, 2016 9:44 am
by Tony Li
Yes. May I make two suggestions?

1. Change the second condition to:

Code: Select all

Variable["Karma"] < 65
Although it's not likely, if Karma were 64.5 then neither condition would be true with your original conditions. By using the condition above, you guarantee that one condition will be true.

2. The Trigger dropdown is set on OnEnable. This means the Conversation Trigger will only try to run when it's enabled (e.g., when the scene starts, if the GameObject is active when the scene starts). You may need to change the Trigger dropdown to a different value such as OnUse, depending on how the player can trigger the conversation.

Re: Tutorial of Karma System in Dialogue System

Posted: Mon Sep 12, 2016 10:52 am
by HaiiroMukuro
Ok, I'll change it later. :lol:
How will I trigger a conversation using a karma required?
I mean using conditionals.
Like if player has a 65 karma, the conversation named "Rescue" will trigger.
Else, the conversation named "Another mission" will trigger.

Re: Tutorial of Karma System in Dialogue System

Posted: Mon Sep 12, 2016 1:08 pm
by Tony Li
How do you normally trigger conversations in your game?

For example, in the Feature Demo, the player must put an NPC in its crosshairs (using the Selector component) and press the spacebar. This sends an "OnUse" message to the NPC. If the NPC has a Conversation Trigger set to OnUse, it will start the conversation.