What is TutAI?
TutAi is a base file(Meaning you can easily create new NPC's based off this one file, rather than having to code the entire thing from scratch over and over again) that reads keywords and responses from a file, when a player says a keyword, the ai chooses a random response set for that keyword and says it back. For example:
Player: What is a backpack?
AI (searches each word for keywords, lets say you have backpack as a keyword, the AI will now choose a random response set for the keyword backpack and says it to the player): A backpack is a container all players carry to store various items in.
How does the TutAI know what to say?
You have to manually create keywords and responses, so everything (s)he is pre-set by you.
Now lets begin:
First of all, all the following files are included in the zip file:
TutAiFormatter.exe
\TutAI\
--\Miner49.cs
--\questions.csv
--\TutAiBase.cs
TutAiFormatter.exe: This is a program I created to easily create keywords and responses and save them in the correct CSV format. If you choose not to use this program, you can use any spreadsheet program that allows you to save as a CSV(comma seperated value) file, however there are several drawbacks to this method, I suggest sticking with my program to make sure it works correctly.
\TutAI\: This folder needs to be placed in your \Custom\ directory.
\TutAiBase.cs: This is the base file that all and any of your TutAi NPCs will be based off of, there is no need to edit this file.
\Miner49.cs: This is an example of a TutAi NPC, it uses questions.csv file for keywords and responses. You can edit this file as desired, the only things that need to be there are the following:
public class Miner49 : TutAiBase <-- This tells the script that the Miner49 is based off the TutAiBase, you need to have the : TutAiBase on any new Ai's you decide to make.
private string path = Directory.GetCurrentDirectory() + "\\Scripts\\Custom\\TutAi";
private string filename = "questions.csv"; <-- these two lines will need to be edited to the correct location and name of the CSV file you are going to use for the npc.
All occurrences of load_csv(filename, path); <-- This tells the NPC to load all the keywords and responses so it can reply to players in game.
Start_Timer(TimeSpan.FromSeconds(2.0)); <-- You can remove these lines if desired, however if you place these here the script will call the method public override void Timer_Callback() every 2 seconds, so if you want something to happen every couple of seconds, minutes, hours, etc this is how you will do it.
If you have any questions, please post them!
If you want to release your own AI's + the CSV files, feel free to do so, it would be nice to have some unique AI's from other shards to share with everyone!
This is what my TutAIFormatter looks like:
TutAi is a base file(Meaning you can easily create new NPC's based off this one file, rather than having to code the entire thing from scratch over and over again) that reads keywords and responses from a file, when a player says a keyword, the ai chooses a random response set for that keyword and says it back. For example:
Player: What is a backpack?
AI (searches each word for keywords, lets say you have backpack as a keyword, the AI will now choose a random response set for the keyword backpack and says it to the player): A backpack is a container all players carry to store various items in.
How does the TutAI know what to say?
You have to manually create keywords and responses, so everything (s)he is pre-set by you.
Now lets begin:
First of all, all the following files are included in the zip file:
TutAiFormatter.exe
\TutAI\
--\Miner49.cs
--\questions.csv
--\TutAiBase.cs
TutAiFormatter.exe: This is a program I created to easily create keywords and responses and save them in the correct CSV format. If you choose not to use this program, you can use any spreadsheet program that allows you to save as a CSV(comma seperated value) file, however there are several drawbacks to this method, I suggest sticking with my program to make sure it works correctly.
\TutAI\: This folder needs to be placed in your \Custom\ directory.
\TutAiBase.cs: This is the base file that all and any of your TutAi NPCs will be based off of, there is no need to edit this file.
\Miner49.cs: This is an example of a TutAi NPC, it uses questions.csv file for keywords and responses. You can edit this file as desired, the only things that need to be there are the following:
public class Miner49 : TutAiBase <-- This tells the script that the Miner49 is based off the TutAiBase, you need to have the : TutAiBase on any new Ai's you decide to make.
private string path = Directory.GetCurrentDirectory() + "\\Scripts\\Custom\\TutAi";
private string filename = "questions.csv"; <-- these two lines will need to be edited to the correct location and name of the CSV file you are going to use for the npc.
All occurrences of load_csv(filename, path); <-- This tells the NPC to load all the keywords and responses so it can reply to players in game.
Start_Timer(TimeSpan.FromSeconds(2.0)); <-- You can remove these lines if desired, however if you place these here the script will call the method public override void Timer_Callback() every 2 seconds, so if you want something to happen every couple of seconds, minutes, hours, etc this is how you will do it.
If you have any questions, please post them!
If you want to release your own AI's + the CSV files, feel free to do so, it would be nice to have some unique AI's from other shards to share with everyone!
This is what my TutAIFormatter looks like: