Alright, this is the best text based RPG I have created, and I have refined all the bugs and such. I have gotten a few questions on whether it is beatable without dying, and it IS beatable without dying, but be aware that you most likely will die quite a few times unless you use a cheat code..but hey, games aren't tough if there is no challenge. :P
Anyway, there are still probably a few minor bugs. Please let me know if you find any!!

Here is a list of features:

- Lots of Random! There are random events, random earnings, etc.

- Alignment system! The game will take note of your decisions and decide whether or not your character is good...or bad. These two factors will determine the monsters you face..and the final boss. (Satan or God)

- Many Options! Here are some of the options:
• Upgrade Armor
• Upgrade Weapons
• Look around the area
• Train
• Increase Health
• Spell Shop
• Armory
• Weapon-smith
• etc.

- AutoSaving! Every time you enter the main screen, it autosaves your progress..this may come in handy if your PC crashes or you just don't feel like playing.

- Cheatcodes! Heh..don't resort to these too fast..

Well, that's about it. I haven't had many people play it yet so it may be good, or it may be bad. Don't expect too much from text-based games though..maybe I will make another/better game once I learn more efficient coding.

Edited 6 Years Ago by restrictment: n/a

Comments
Keep it up.
Attachments
/*  Game Created by Jacob Caron. Started on 11/2/09  */
//version 2
//header declarations
#include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <iomanip>
#include <string>
#include <time.h>
#include <fstream>
#include <windows.h>
using namespace std;
//used to maximize screen
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
//initializing functions
void spell(int & money, int spells[10]);
void look(int material[3], int & money, int & lookaround);
void upgrade(int material[3], int & money, int upgradeitem[2], int weapon, int armor);
void attribute(int stats[4], int & attributes);
void levels(int & level, int & enemy, int & alignment);
void medic(int & money,int potionsize[5]);
void weapons(int & money, int & weapon, int upgradeitem[2]);
void armory(int & money, int & armor, int upgradeitem[2]);
void statistics(int money,int mondef,int potionsize[5],int armor,int weapon,string name,int stats[4], int health, int attributes, int alignment, int deaths, int hp, int tp, int upgradeitem[2], int lookaround, int material[3], int spells[10]);
void heal(int & health, int & hp);
void train(int stats[4], int & tp);
void battlephase(int stats[4], int & enemy, int potionsize[5], string name, int & weapon, int & armor, int & money, int & mondef, int & health, int & level, int & attributes, int & alignment, int & hp, int & tp, int & deaths, int & lookaround, int upgradeitem[2], int spells[10]);
char spellname[10][25] = {"Lower Enemy Health", "Lower Enemy Attack", "Lower Enemy Defence", "Lower Enemy Speed", "Lower Enemy Accuracy", "Raise Health", "Raise Attack", "Raise Defence", "Raise Speed", "Raise Accuracy"};

//main function
int main()
{
	system("color 0f");
	//tells screen to maximize
	HWND hWnd = GetConsoleWindow();
	ShowWindow(hWnd,SW_MAXIMIZE);
	/*****array declarations*****/
	//potions
	int potionsize[5] = {0, 0, 0, 0, 0};
	//armor
	int armor = 0;
	//weapons
	int weapon = 0;
	//menu array
	char menu[6][50] = {"Go to a Town", "View Stats", "Add Attributes", "Heal", "Train", "Look around the area"};
	char town[5][50] = {"Visit the town medic", "Visit the Weapon Smith", "Go to the Armory", "Upgrade Weapon and Armor", "Go to the spell shop"};
	//area
	char monsters[16][25] = {"Wolf", "Bear", "Bandit", "Traveler", "Gargoyle", "Knight", "Warlock", "Mammoth", "Cyclops", "Unicorn", "Dragon", "Your Mother", "Demon", "Jesus", "Satan", "God"};
	char area[7][25] = {"Go to the Trail", "Go to the Mountains", "Go to the Valley", "Go to the Lake", "Go to the Cliff", "Go to the Cave", "Go to the Land of Fire"};
	int level = 0;
	//character Stats
	int stats[4] = {10, 10, 10, 10};
	//counter
	int count1;
	//name
	string name;
	//money
	int money = 50;
	//which enemy to fight
	int enemy = 0;
	//monsters defeated
	int mondef = 0;
	//User Health
	int health = 100;
	//amount of attributes
	int attributes = 0;
	//alignment
	int alignment = 0;
	//number of times died
	int deaths = 0;
	//health points
	int hp = 0;
	//training points
	int tp = 0;
	//enter page
	char title;
	//decides whether or not you will move on
	int moveon = 0;
	//menu
	char menu1;
	//upgraded weapon/armor
	int material[3] = {0,0,0};
	//amount of material
	int upgradeitem[2] = {0,0};
	//looking around the area
	int lookaround = 1;
	//spells
	int spells[10] = {0,0,0,0,0,0,0,0,0,0};
	//cheat code
	string cheatcode;
	do{
		system("cls");
		cout << "*************Helsmich*************" << endl
			<< "----------by: Jake Caron----------" << endl << endl << endl;
		cout << "Welcome, what would you like to do?\n\n"
			<< "1. Start a New Game" << endl
			<< "2. Load Saved Game" << endl
			<< "3. Help/Rules" << endl
			<< "4. Enter Cheat Codes" << endl << endl << ">> ";
		cin >> title;
		if(title == 'q')
			return 0;
		system("cls");
		switch(title)
		{
		case '1':
			/*****Introduction*****/
			cout << "If you have a saved game this will erase it!!\n"
				<< "Are you sure you wish to continue?\n\n"
				<< "1. Yes\n"
				<< "2. No\n\n>> ";
			cin >> count1;
			system("cls");
			if(count1 == 1)
			{
				cout << "Please Enter your name (One Word): ";
				cin >> name;
				system("cls");
				cout << "Welcome to Grundor, " << name << ", the village where you were born.\n"
					<< "Your mother, Marlene was abducted by the Horrid Dragon, Helsmich, in the land \n"
					<< "of fire. In order for you to save your mother, you must travel along the \n"
					<< "twisted trail into lands that are filled with terror. I bid you the best of \n"
					<< "luck, and here is $50 to spend on supplies. I know it is not much, but I am \n"
					<< "not the wealthiest man alive!\n\n";
				system("pause");
				system("cls");
				moveon = 1;
			}
			break;
		case '3':
			cout << "                       **********Rules**********" << endl << endl
				<< "The Rules of Helsmich are simple. Just enter a number that is available, and\n"
				<< "try to make the CORRECT selection to survive. Every choice or thing that you\n"
				<< "do will impact either your character or the way you play the game. As you make\n"
				<< "choices, your alignment will change. If your alignment is in the negative, you\n"
				<< "will become 'evil'. Thus, the monsters you battle will differ depending on how\n"
				<< "your alignment is. Your score nearly depends on ALL the variables in the game,\n"
				<< "so don't slack on one aspect and think it won't effect you. Your game has an\n"
				<< "auto-save that will save your game each and every time you hit the enter page!\n"
				<< "This was a brief review of the game, so have fun!" << endl << endl;
			system("pause");
			break;
		case '4':
			cout << "If you have a saved game this will erase it!!\n"
				<< "Are you sure you wish to continue?\n\n"
				<< "1. Yes\n"
				<< "2. No\n\n>> ";
			cin >> count1;
			system("cls");
			if(count1 == 1)
			{
				do{
					cout << "Please enter your cheat code: \n"
						<< "Type '123' to exit.\n\n>> ";
					cin >> cheatcode;
					if(cheatcode == "GiveMeExcaliberPlease")
						weapon = 9;
					else if(cheatcode == "GiveMeBerzerkerArmorPlease")
						armor = 9;
					else if(cheatcode == "MOOONEY")
						money = 9999999;
					else if(cheatcode == "MusclesRule")
						stats[0] = 999;
					else if(cheatcode == "ArmoredLikeAnAnt")
						stats[1] = 999;
					else if(cheatcode == "RunningShoes")
						stats[2] = 999;
					else if(cheatcode == "EagleEye")
						stats[3] = 999;
					else if(cheatcode == "HealthNut")
						health = 9999;
					else if(cheatcode == "LetMeGuess")
						tp = 999;
					else if(cheatcode == "HealMe")
						hp = 999;
					else if(cheatcode == "ILikeAttributes")
						attributes = 999;
					else if(cheatcode == "MakeMeGoodNow")
						alignment = 6;
					else if(cheatcode == "MakeMeEvilNow")
						alignment = -6;
					else if(cheatcode == "MedicMan")
					{
						for(int x=0;x<5;x++)
							potionsize[x]+=999;
					}
					else if(cheatcode == "EvilBoss")
					{
						alignment = 3;
						level = 8;
					}
					else if(cheatcode == "GoodBoss")
					{
						alignment = -3;
						level = 8;
					}
					else if(cheatcode == "IDontFeelLikeActuallyPlaying")
					{
						for(int x=0;x<5;x++)
							potionsize[x]+=999;
						attributes = 999;
						tp = 999;
						hp = 999;
						weapon = 9;
						armor = 9;
						for(int x=0;x<4;x++)
							stats[x]+=999;
						health = 999;
						money = 999;
						mondef = 8;
					}
					else if(cheatcode != "123")
					{
						system("cls");
						cout << "Invalid Cheat Code!!!\n\n";
						system("pause");
					}
					system("cls");
				}while(cheatcode != "123");
				cout << "Please Enter your name (One Word): ";
				cin >> name;
				system("cls");
				moveon = 1;
			}
			break;
		case '2':
			ifstream infoout("test.txt");
			if (infoout.is_open())
			{
				infoout >> name;
				infoout >> money;
				infoout >> mondef;
				infoout >> potionsize[0];
				infoout >> potionsize[1];
				infoout >> potionsize[2];
				infoout >> potionsize[3];
				infoout >> potionsize[4];
				infoout >> armor;
				infoout >> weapon;
				infoout >> deaths;
				infoout >> hp;
				infoout >> tp;
				infoout >> health;
				infoout >> stats[0];
				infoout >> stats[1];
				infoout >> stats[2];
				infoout >> stats[3];
				infoout >> attributes;
				infoout >> alignment;
				infoout >> level;
				infoout >> material[0];
				infoout >> material[1];
				infoout >> material[2];
				infoout >> upgradeitem[0];
				infoout >> upgradeitem[1];
				infoout >> lookaround;
				infoout >> spells[0];
				infoout >> spells[1];
				infoout >> spells[2];
				infoout >> spells[3];
				infoout >> spells[4];
				infoout >> spells[5];
				infoout >> spells[6];
				infoout >> spells[7];
				infoout >> spells[8];
				infoout >> spells[9];
				infoout.close();
			}
			moveon = 1;
			break;
		}
	}while(moveon == 0);
	do{
		ofstream infoin("test.txt");
		infoin << name << endl;
		infoin << money << endl;
		infoin << mondef << endl;
		infoin << potionsize[0] << endl;
		infoin << potionsize[1] << endl;
		infoin << potionsize[2] << endl;
		infoin << potionsize[3] << endl;
		infoin << potionsize[4] << endl;
		infoin << armor << endl;
		infoin << weapon << endl;
		infoin << deaths << endl;
		infoin << hp << endl;
		infoin << tp << endl;
		infoin << health << endl;
		infoin << stats[0] << endl;
		infoin << stats[1] << endl;
		infoin << stats[2] << endl;
		infoin << stats[3] << endl;
		infoin << attributes << endl;
		infoin << alignment << endl;
		infoin << level << endl;
		infoin << material[0] << endl;
		infoin << material[1] << endl;
		infoin << material[2] << endl;
		infoin << upgradeitem[0] << endl;
		infoin << upgradeitem[1] << endl;
		infoin << lookaround << endl;
		infoin << spells[0] << endl;
		infoin << spells[1] << endl;
		infoin << spells[2] << endl;
		infoin << spells[3] << endl;
		infoin << spells[4] << endl;
		infoin << spells[5] << endl;
		infoin << spells[6] << endl;
		infoin << spells[7] << endl;
		infoin << spells[8] << endl;
		infoin << spells[9] <<

Its good. The source is just not so flexible. You should separate it into
files. Make use of structures, if you know how. You use mostly brute force,
even with variables. Also do not use magic numbers, use constants, so
its more readable and clear. Your source has a lot of redundant code. So far its good though. Nice job.

Its good. The source is just not so flexible. You should separate it into
files. Make use of structures, if you know how. You use mostly brute force,
even with variables. Also do not use magic numbers, use constants, so
its more readable and clear. Your source has a lot of redundant code. So far its good though. Nice job.

Yeah, I know my code efficiency could be drastically improved, but this was all our class accomplished in the first semester, and I don't plan on extending my knowledge of C++. As far as separating it into files..that may come later on if I make another game, since it would make it a whole lot easier to navigate.

Thanks for the feedback. =)

>> I don't plan on extending my knowledge of C++

Thats too bad. I guess you don't wan't to further your knowledge about
programming.

>>that may come later on if I make another game, since it would make it a whole lot easier to navigate

Ok, I will be waiting for the next game with separated files.

Interesting game,adding class and maybe small structs will make the code clearer and make it simpler to add features to it.

Interesting game,adding class and maybe small structs will make the code clearer and make it simpler to add features to it.

Yeah, I am quite sure it would. Sadly I do not know classes, and probably never will. =(
Are 'small structs' the same as comments, or is that a whole different thing? Because I do have small comments every once in a while just to tell me what/where the functions are.

Thanks for the critique. Who knows, maybe I will change my mind and learn classes, OOP, Structures, etc.

Classes and structs are very similar but differ in different ways to each other.They act like a container of functions or variables or both and allow you to use them as a blueprint for creating objects etc. Comments are just text in different places in the code that help explain whats going on in the program the two are very different things.

Edited 6 Years Ago by rom87: n/a

This article has been dead for over six months. Start a new discussion instead.