ICauseDarkDays
New member
- Joined
- Apr 17, 2022
- Messages
- 3
- Programming Experience
- Beginner
I am creating a Text-Based game, and when I first started, I just made it so that if you skipped past the naming process, you would be given a name, but I don't want players to skip past the process anymore. I want them to pick their names out intentionally, but I don't know how to make it so that this line of code would pick up on if you put any random name in there and let you pass.
I also like doing easter eggs with the names, hence all the "if" statements for certain names, and I thought I could use an "else if" to detect any name that a player would put in there but I have no idea how to do that. any help?
If you need more information, let me know, thanks.
I also like doing easter eggs with the names, hence all the "if" statements for certain names, and I thought I could use an "else if" to detect any name that a player would put in there but I have no idea how to do that. any help?
If you need more information, let me know, thanks.
Naming Process:
while (hasName == false)
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine();
Console.WriteLine(" ████████╗ █████╗ ██╗ ███████╗ ██████╗ ███████╗ ██╗ ██╗███████╗██████╗ ██████╗");
Console.WriteLine(" ╚══██╔══╝██╔══██╗██║ ██╔════╝ ██╔═══██╗██╔════╝ ╚██╗██╔╝██╔════╝██╔══██╗██╔════╝");
Console.WriteLine(" ██║ ███████║██║ █████╗ ██║ ██║█████╗ ╚███╔╝ █████╗ ██████╔╝██║ ");
Console.WriteLine(" ██║ ██╔══██║██║ ██╔══╝ ██║ ██║██╔══╝ ██╔██╗ ██╔══╝ ██╔══██╗██║ ");
Console.WriteLine(" ██║ ██║ ██║███████╗███████╗ ╚██████╔╝██║ ██╔╝ ██╗███████╗██║ ██║╚██████╗");
Console.WriteLine(" ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝");
Console.WriteLine();
Console.WriteLine("I'm sorry, traveller, I seem to have forgotten your name. May you remind me?\n");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("Your Name: ");
string name = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.White;
if (name == "Link")
{
atk = 999;
gold = 999;
def = 999;
hp = 999;
maxhp = 999;
mana = 999;
divine = true;
fire = false;
head = "Elf hat";
chest = "Elf Tunic";
legs = "Elf Linen";
boots = "Elf Boots";
hasName = true;
Console.WriteLine("\nJust as the prophecy has foretold...");
Console.ReadLine();
}
if (name == "Boyce")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("\nYou have obtained: The Sword of Dr. Pepper");
weaponname = "The Sword of Dr. Pepper";
hasName = true;
Console.ReadLine();
}
if (name == "Derek")
{
Console.WriteLine("\nGood luck on your Journey, cheater.");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\nDifficulty has been set to: INSANE");
hasName = true;
Console.ReadLine();
}
if (name == "Tyler")
{
Console.WriteLine("\nYou thought flattery would get you somewhere... hahaha!");
Console.ReadLine();
Console.WriteLine("Well you were right...");
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine("\nGODMODE SET");
hp = 1000000;
maxhp = 1000000;
hasName = true;
Console.ReadLine();
}
if (name == "Captain")
{
Console.WriteLine("\nYou'll meet Tennille later.");
hasName = true;
Console.ReadLine();
}
if (name == "")
{
name = "Speedrunner";
hasName = true;
Console.WriteLine("\nYou left your name area blank, so we picked one out for you.");
}
if (name == "Speedrunner")
{
Console.WriteLine("\nGood luck.");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\nDifficulty has been set to: INSANE");
hp = 1;
maxhp = 1;
atk = 5;
def = 0;
hasName = true;
Console.ReadLine();
}
else if ()
{
hasName = true;
}
}
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("\n" + name + "... ah, yes, that's right... " + name + "...");
Console.WriteLine("\nNow onto the story!");
Console.ReadLine();