Tutorial of Karma System in Dialogue System

Announcements, support questions, and discussion for the Dialogue System.
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Tutorial of Karma System in Dialogue System

Post by HaiiroMukuro »

Good day! Is there any tutorials for making a Karma system in the dialogue system?
bohnstudios
Posts: 68
Joined: Sun Aug 16, 2015 3:01 am
Location: St. Louis, MO
Contact:

Re: Tutorial of Karma System in Dialogue System

Post 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/
User avatar
Tony Li
Posts: 21079
Joined: Thu Jul 18, 2013 1:27 pm

Re: Tutorial of Karma System in Dialogue System

Post 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.
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: Tutorial of Karma System in Dialogue System

Post 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?
User avatar
Tony Li
Posts: 21079
Joined: Thu Jul 18, 2013 1:27 pm

Re: Tutorial of Karma System in Dialogue System

Post 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. ;) )
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: Tutorial of Karma System in Dialogue System

Post by HaiiroMukuro »

Thanks for the help! I'll ask more if I still have questions. Have a great day! :D
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: Tutorial of Karma System in Dialogue System

Post 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? :?:
User avatar
Tony Li
Posts: 21079
Joined: Thu Jul 18, 2013 1:27 pm

Re: Tutorial of Karma System in Dialogue System

Post 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.
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: Tutorial of Karma System in Dialogue System

Post 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.
User avatar
Tony Li
Posts: 21079
Joined: Thu Jul 18, 2013 1:27 pm

Re: Tutorial of Karma System in Dialogue System

Post 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.
Post Reply