Skip to main content
GameDev.net gamedev.net
🔒 Locked

Writing Text-Based RPG

Started by Jankos May 17, 2005 at 11:22 PM 33 replies 6.5k views
Original Post
Jankos
Jankos
Hi, im writing a single-player, text-based RPG in C++ using Visual c++ 6, in the console(?). I just started learning c++ last semester, where i had a class on it. The professor didnt know that much himself, but i learned a little on my own. I was looking for a few tips on how i should write classes and stuff like that, and how i should go about doing a game loop. Perhaps I should explain a little more about my game. It will be an RPG, room-based, where you can either type north east south west to go to different rooms, score to look at your character sheet, look to look at the room description and exits and any npcs that might be there. I want you to be able to pick up weapons and armor from npc's and equip them and be able to use their different damages and armor classes. So, any help with this would be appreciated. If you include code, i will write back explaining which parts i understand and which I need explained a little. I also had a question about pointers. I know what they are, and what they do, but i dont understand why you would use them, or HOW you would use them. I know that they point to a variables memory address, but not much more about them. Thank you for your time and help, and for reading this.
Sadness
Sadness
The game loop can be really easy

1 Initialize it.
2 Wait for player input
3 process player input
4 process random element (monster?)
5 Update the game
6 return to 2.

it's a really basic game loop.
If you dig around (search field of the forum) you can find a lot of answer about this topic.

you can check source code of different game too.


Pointer can be used to create your own type of date.

You can create a monster data, with variable like health, location, atk power, a pointer to the next monster and a pointer to the previous one, so you can navigate easily, add more, or remove some monster of the list (we call that a linked list) . It's one way to use pointer. But actually, you could do yourself a favor and learn about the standard template library. Pointer where used a lot in C. With the STL, you don't need to use them so much. Don't bother with it right now. :)
-----------------------Happiness in slavery !-----------------------
Jankos
Jankos
it will be a simple game, sorta like a single player MUD (SUD?!)

How should i make classes and objects and the like?
Jankos
Jankos
Heres my source code so far, dont laugh too hard. I need a little help going from here though.



#include <iostream>#include <time.h>#include <vector>#include <cstdlib>#include <string>using namespace std;class race{public:		string name;		int racenum;		int statmod[5];};class clas{public:		string name;		int classnum;		int statmod[5];};class armor{public: 	string name;	int ac;	int resisttype; //0Regular 1Undead 2Fire 3Ice 4Magic	int armortype;  //Basic Types: 1Helm 2Chest 3boots 4gloves 5greaves 6belt};class weapon{public:	string name; //Weapon Name	int mindmg; //Minimum Weapon Dmg	int maxdmg; //Maximum Weapon Dmg	int weptype; //Basic Types: 1Sword, 2Axe, 3Dagger, 4Wand, 5Staff, 6PoleArm, 7Fists	bool hands; //0 for 1-h 1 for 2-h	int dmgtype; //0Regular 1Undead, 2Fire, 3Frost, 4Magic, 5Elemental, 6Lightning	int magicdmg; //Magic Dmg weapon does, if none, 0	int mpcost; //Cost of using};class character{public:	int calcdmg(int mindmg, int maxdmg, int magdmg, int magresist, int ac)	{		int dmg;		dmg = mindmg + (rand() % (maxdmg - mindmg)) - (ac/(maxdmg - mindmg)) + abs(magdmg / magresist);		return dmg;	}	int calchp(int str, int con)	{		int hp;		hp = ((str * 2 + con * 4) / 4);		return hp;	}	int calcmp(int intel, int wis)	{		int mp;		mp = ((intel*4 + wis*4)/4);		return mp;	}	string name;	int level;	int exp;	int hp;	int mp;	int ac;	clas clas;	race race;	weapon weapon;	armor armor;	vector<int> slot;	int stat[5];};//Unmodified base Statsconst basestat[5] = {10,10,10,10,10}; //Playercharacter player;//Racesrace Dwarf, Elf, Human, Iksar, Minotaur, Halfling, Satyr;//Classesclas Wizard, Warrior, Rogue, Barbarian, Knight, Mystic, Priest;//Armorsarmor LeatherHelm, ChainHelm, ScaleHelm, PlateHelm, EagleHelm;armor LeatherArmor, ChainMail, ScaleMail, PlateMail, EagleMail;armor LeatherBoots, ChainBoots, ScaleBoots, PlateBoots, EagleBoots;armor LeatherGloves, ChainGloves, ScaleGloves, PlateGloves, EagleGloves;armor LeatherGreaves, ChainGreaves, ScaleGreaves, PlateGreaves, EagleGreaves;armor LeatherBelt, ChainBelt, ScaleBelt, PlateBelt, EagleBelt;//Weaponsweapon SilverSword, GreatSword, FireSword, BroadSword, EagleSword;weapon SilverAxe, GreatAxe, FireAxe, BroadAxe, EagleAxe;weapon SilverDagger, GreatDagger, FireDagger, BroadDagger, EagleDagger;weapon MagicWand, ElementalWand, FireWand, IceWand, LightningWand;weapon MagicStaff, ElementalStaff, FireStaff, IceStaff, LightningStaff;weapon SilverHalberd, GreatHalberd, FireHalberd, BroadHalberd, EagleHalberd;weapon Fists, SilverKnuckles, SpikedKnuckles, DragonClaws, EagleClaws;clas getclass(){	int classnum = 0;	//Classes	Wizard.name = "Wizard";	Wizard.classnum = 1;	Wizard.statmod[0] = 0;	Wizard.statmod[0] = 0;	Wizard.statmod[0] = 0;	Wizard.statmod[0] = 10;	Wizard.statmod[0] = 5;	Warrior.name = "Warrior";	Warrior.classnum = 2;	Warrior.statmod[0] = 10;	Warrior.statmod[1] = 7;	Warrior.statmod[2] = 10;	Warrior.statmod[3] = 0;	Warrior.statmod[4] = 0;	Rogue.name = "Rogue";	Rogue.classnum = 3;	Rogue.statmod[0] = 5;	Rogue.statmod[1] = 10;	Rogue.statmod[2] = 5;	Rogue.statmod[3] = 5;	Rogue.statmod[4] = 5;	Barbarian.name = "Barbarian";	Barbarian.classnum = 4;	Barbarian.statmod[0] = 12;	Barbarian.statmod[1] = 5;	Barbarian.statmod[2] = 13;	Barbarian.statmod[3] = -2;	Barbarian.statmod[4] = -3;	Knight.name = "Knight";	Knight.classnum = 5;	Knight.statmod[0] = 7;	Knight.statmod[1] = 7;	Knight.statmod[2] = 7;	Knight.statmod[3] = 5;	Knight.statmod[4] = 5;	Mystic.name = "Mystic";	Mystic.classnum = 6;	Mystic.statmod[0] = 5;	Mystic.statmod[1] = 5;	Mystic.statmod[2] = 5;	Mystic.statmod[3] = 5;	Mystic.statmod[4] = 5;	Priest.name = "Priest";	Priest.classnum = 7;	Priest.statmod[0] = 0;	Priest.statmod[1] = 0;	Priest.statmod[2] = 0;	Priest.statmod[3] = 5;	Priest.statmod[4] = 10;	cout << "\nChoose a Class:\n"		 << "(1) Wizard\n"		 << "(2) Warrior\n"		 << "(3) Rogue\n"		 << "(4) Barbarian\n"		 << "(5) Knight\n"		 << "(6) Mystic\n"		 << "(7) Priest\n"		 << ">> ";	cin >> classnum;	switch(classnum)	{		case 1:			player.clas = Wizard;			player.weapon = MagicStaff;			break;		case 2:			player.clas = Warrior;			break;		case 3:			player.clas = Rogue;			break;		case 4:			player.clas = Barbarian;			break;		case 5:			player.clas = Knight;			break;		case 6:			player.clas = Mystic;			break;		case 7:			player.clas = Priest;			break;		default:			cout << "You Entered an Incorrect Number!";	}		return player.clas;}race getrace(){	int racenum = 0;	//Races	Dwarf.name = "Dwarf";	Dwarf.racenum = 1;	Dwarf.statmod[0] = 11;	Dwarf.statmod[1] = 5;	Dwarf.statmod[2] = 12;	Dwarf.statmod[3] = 0;	Dwarf.statmod[4] = 0;	Elf.name = "Elf";	Elf.racenum = 2;	Elf.statmod[0] = 5;	Elf.statmod[1] = 10;	Elf.statmod[2] = 5;	Elf.statmod[3] = 3;	Elf.statmod[4] = 2;	Human.name = "Human";	Human.racenum = 3;	Human.statmod[0] = 5;	Human.statmod[0] = 5;	Human.statmod[0] = 5;	Human.statmod[0] = 5;	Human.statmod[0] = 5;	Iksar.name = "Iksar";	Iksar.racenum = 4;	Iksar.statmod[0] = 0;	Iksar.statmod[1] = 0;	Iksar.statmod[2] = 5;	Iksar.statmod[3] = 15;	Iksar.statmod[4] = 10;	Minotaur.name = "Minotaur";	Minotaur.racenum = 5;	Minotaur.statmod[0] = 12;	Minotaur.statmod[1] = 5;	Minotaur.statmod[2] = 14;	Minotaur.statmod[3] = -3;	Minotaur.statmod[4] = -2;	Halfling.name = "Halfling";	Halfling.racenum = 6;	Halfling.statmod[0] = 2;	Halfling.statmod[1] = 5;	Halfling.statmod[2] = 2;	Halfling.statmod[3] = 10;	Halfling.statmod[4] = 15;	Satyr.name = "Satyr";	Satyr.racenum = 7;	Satyr.statmod[0] = 0;	Satyr.statmod[1] = 15;	Satyr.statmod[2] = 2;	Satyr.statmod[3] = 10;	Satyr.statmod[4] = 2;	cout << "\nChoose a Race:\n"		 << "(1) Dwarf\n"		 << "(2) Elf\n"		 << "(3) Human\n"		 << "(4) Iksar\n"		 << "(5) Minotaur\n"		 << "(6) Halfling\n"		 << "(7) Satyr\n"		 << ">> ";	cin >> racenum;	MagicStaff.name = "Magic Staff";	MagicStaff.mindmg = 20;	MagicStaff.maxdmg = 30;	switch(racenum)	{		case 1:			player.race = Dwarf;			break;		case 2:			player.race = Elf;			break;		case 3:			player.race = Human;			break;		case 4:			player.race = Iksar;			break;		case 5:			player.race = Minotaur;			break;		case 6:			player.race = Halfling;			break;		case 7:			player.race = Satyr;			break;		default:			cout << "You Entered an Incorrect Number!";	}	return player.race;}string getname(){	cout << "Enter Your Name:"		 << "\n>> ";	cin >> player.name;	return player.name;}character getcharacter(){	player.name = getname();	player.race = getrace();	player.clas = getclass();	player.level = 1;	for(int a=0;a<5;a++) //Fill stats array from race and class	{		player.stat[a] = player.stat[a] + basestat[a] + player.race.statmod[a] + player.clas.statmod[a];	}	player.hp = player.calchp(player.stat[0], player.stat[2]);	player.mp = player.calcmp(player.stat[3], player.stat[4]);	return player;}void score(character player){	cout << "+-------------------------+\n";	cout << " Name: " << player.name << endl;	cout << " Str  Agi  Con  Int  Wis\n";	for(int a=0;a<5;a++)		cout << " " << player.stat[a] << " " << " ";	cout << "\n HP: " << player.hp << "\t  MP: " << player.mp << "   AC: " << player.armor.ac << endl;	cout << " Race: " << player.race.name		 << " Class: " << player.clas.name << endl;	cout << " Weapon: " << player.weapon.name << " "		 << player.weapon.mindmg << "-" << player.weapon.maxdmg << endl;}int main(){	player = getcharacter();	score(player);		return 0;}
silverphyre673
silverphyre673
would you like to work with me? I am currently developing an item filing system and working with binary format. This would make the catalogueing of items in the game a lot easier. I've been programming about 3 years in c++ now, and could help you with things like pointers. I've never taken a class, and I'm 16, but I know how you could do something like this.

I'm planning on starting a kind of group-learning programming club for my school next year. No teachers or other students out of the 2000 that go to my high school program! I want to teach them, and I think that I could do that. If you would like me to teach you along the way, it would be good experiance for both of us.

Plus, I'm friendly! :)

Email: silverphyre673@comcast.net

-Ben
my siteGenius is 1% inspiration and 99% perspiration
Jankos
Jankos
Yeah sure, id like your help with c++ and the game, do you have any instant messenger programs?

my email is b3aup@yahoo.com




anyone else have any input BTW?
silverphyre673
silverphyre673
no, but i can get one. what do you use? i prefer to stay away from aim, out of principle. I'll be in touch later - its late where I am (washington state, us). where are you?
my siteGenius is 1% inspiration and 99% perspiration
Jankos
Jankos
Im from Arkansas State, US

i use Yahoo messenger, my name on there is b3aup
hannibal84
hannibal84
A couple of things to mention....

First of all, you have a logic error that you may or may not have already caught. Consider this block of code:

clas getclass(){	int classnum = 0;	//Classes	Wizard.name = "Wizard";	Wizard.classnum = 1;	Wizard.statmod[0] = 0;	Wizard.statmod[0] = 0;	Wizard.statmod[0] = 0;	Wizard.statmod[0] = 10;	Wizard.statmod[0] = 5;


You're assigning a series of different values to the same element of Wizard.statmod. Looking at the following code, that obviously wasn't intentional. Small error, no biggie.

Another thing to mention is that you're using classes more as structs in this case. That's not necessarily bad, but as far as proper OOP goes, it's a little ugly. It's not a big deal, but if you want to make it prettier, you might look into researching public/private members and accessor functions.

Also, a little research into some basic data structures might help you out so you don't have those ugly collections of armor and weapons, but that really depends on how extensive you want your game to be.

For the character creation, you might want to create a function called "CreateCharacter" or similar and pass it the character reference and a 'clas' variable, both by reference (or pointer!), to initialize the characters. That would clean up those 50-ish lines of creation code to about 15 (new function + function calls). By the way, 'clas' is a rather poor choice of names.... Makes it look like a typo. Don't be afraid to use a more desriptive class name, like you did for your armor variables.

And here's the real gem.... Want bullet-proof user input? Do something like this:

	bool endGame = false;	// State of whether or not to continue the game	char buffer[ 10 ];	// Input buffer for user input	while ( !endGame )	// While the user continues to play...	{		// Output menu options		cout << "Descriptive text here";		GetUserInput( buffer, 10, input );  // Get user input                // Some sort of game logic like the following		if ( atoi( buffer ) == 1 )			// Play game			PlayGame( output, input );		else if ( atoi( buffer ) == 2 )		// Quit			endGame = true;	}


where GetUserInput is the following function:

// buffer is the POINTER! to a character array to store user input// characters is the maximum amount of characters you want the user to enter// input is the input method; in this case, just pass "cin"void GetUserInput( char * buffer, int characters, istream & input ){        // Clear unused characters from keyboard buffer	input.ignore ( input.rdbuf()->in_avail() );        // Get user input	input.get ( buffer, characters );        // Clear any bad flags from bad key sequences, like hitting Enter        // without providing input	input.clear();}


That's a little gem I came up with back in my basic C++ classes. From all the testing I've done, it's never been broken by bad user input, plus it allows you to use alternative input methods than just cin. And it uses a pointer to write to a character array of "unknown" size (that's why we pass in the second variable). One thing to note: Don't pass in a number of characters greater than the buffer size. This can be avoided by creating a #define MAX_INPUT 10 to replace the "10" in the buffer declaration and the GetUserInput call.

Good luck on your project!

EDIT: Oh, another thing. When you create something like "char buffer[10]", essentially you're creating a pointer to a sequence of ten allocated char's. You can pass buffer into a function that expects a "char *". The bracket operators "[]" are simply a way to dereference the pointer. The compiler may make a few distinctions between pointers and variables created with brackets, but under the hood, they end up being accessed as a contiguous block of memory that is accessed by pointers.
silverphyre673
silverphyre673
pointers are the best, aren't they! You'll get used to them in time - you just have to crash a lot of programs along the way.

and hannibal - wow, thats really nice if it works. don't have time to test right now, but cool!
my siteGenius is 1% inspiration and 99% perspiration
hannibal84
hannibal84
Like I said, I haven't yet run a test yet that's broken it. It was the culmination of several classes, though.... One of my teachers would challenge us to make user input unbreakable. Mine's the only one I've seen that was unbreakable, but I heard a few others made some, too (although there were MANY who thought their's was unbreakable that died rather quickly :P). For a little better explanation....

The first line was actually provided to us by the teacher I mentioned (although, at the time, it was "cin", not "input" that was used... we didn't get to other I/O methods until later). What it does is a bit tricky: If the previous user input taken in was not all of the input received, those extra characters are sitting in some sort of "in-between" buffer still and need to be cleared. I'm not too clear on the details of how it works, but that's the gist of it.

The second line actually reads in the input. Specify the char * to receive data and the number of characters to grab. I actually ran into some issues with using the more traditional "getline" rather than "get", but I don't remember what they were.... It's been about a year and a half since I developed the function.

The third line is necessary to clear bad flags, as I said. When someone enters in a character that can't be processed or does something else unexpected, like hitting Enter on an empty input and entering in an unprintable character code using Alt, for example, there is a variable built into the istream data type that will mark specific bits for certain conditions (I believe the "Enter" case is one of the bits, there are a number of others). Clearing the bits will restore them all to good values and allow them program to avoid that nasty endless display loop that you may be familiar with. This piece took some digging to find.

Feel free to use it! But, until someone claims it as their own at some point, I'll have to claim it as "beerware":

/* * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" ("Borrowed" from Poul-Henning Kamp): * <stormont@gmail.com> wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. :) Devan Stormont * ---------------------------------------------------------------------------- */
Sadness
Sadness
Some small bug too.

const basestat[5] = {10,10,10,10,10};

If I'm right, you initiate 6 element, but assign only 5. you must count basestat[0] as the first element of the array. So you should initialize it as basestat[4]

your class should have way to access and return value (like get(); and set();)

like for a fighting, you could get the ac of the armor via a fonction (Not sure of the syntax, something like maybe

class armor{private:	string name;	int ac = 0;	int resisttype;	int armortype;public:         void setac(int ac);        int getac(); };void setac(int ac);{    this->ac= ac;}int getac();{    return ac;}


you'll need constructor and destructor too :) but I leave that for you to google it :) Notice the private part too ;) these varibable should be accessed only by the class function. so we hide them from everywhere else.
-----------------------Happiness in slavery !-----------------------
Vesper
Vesper
Sadness, I don't think that's quite right. Declaring an array, such as const int basestat[5], is creating an array of 5 elements. However, it only contains indexes from 0 to 4. 0-1-2-3-4 is actually 5 elements. So he is correct :) I used to make this mistake all the time..
Jankos
Jankos
ok great replies guys, theres just a few things i dont understand yet.

#1) void setac(int ac);

{

this->ac= ac; // What is the -> thing? I dont understand that part

}

Another thing, how is the best way to do movement in this sort of game? Like roombased movement?
Sadness
Sadness
-> is a class operator.

"this" is a pointer of the object, so it refer to the current instance of the objet. So supose you have the armor class, you intiate one like

armor PlayerArmor;

then you do somewhere in your program

PlayerArmor.setac(10);

then later, in a fight, the player is hit, you need to calculate the dmg. The armor substract some dmg based on it value. you need to store the value in the calculation.

int playerac;
ac = PlayerArmor.getac();

In that case "this->ac = ac;" will give you the ac of the PlayerArmor.

you can read this like " Member ac of object pointed by "this" "

Hope it helped you !
-----------------------Happiness in slavery !-----------------------
Jankos
Jankos
but how do i define "this" can you give me an example of that, because i am thoroughly confused.

i get the PlayerArmor.setac(10); part

and the ac = PlayerArmor.getac(); part

but what does this->ac = ac; do exactly? and how can i use it?
Sadness
Sadness
You don't need to define it. It's in fact a pointer of the current object.

here's a good tutorial about class. I'm sure it will help you understand many thing after you read that :)

http://www.cplusplus.com/doc/tutorial/tut4-1.html
-----------------------Happiness in slavery !-----------------------
Jankos
Jankos
Ok, thank you, that helped alot. So like when you have a pointer to a class, instead of using the dot operator like a.set_values as in the example, you would use the -> operator, as in b->set_values, which is equivalent to saying (*b).set_values.

in the example on that page though, it make a rectangle a, *b, *c and then makes *c equal to the address of a (&a), and then when it prints the values out, they are both 2, so why not just usa a instead of making a pointer to it with *c, what use does this have?
Sadness
Sadness
For the example, there's no real use in it. most of the tutorial show you concept of coding without giving a lot of detail. You should check real coding example, find some src code of game, and look at them.

-----------------------Happiness in slavery !-----------------------
Jankos
Jankos
ok i started my program over, but something is wrong and i dont know what:

#include <iostream>#include <string>using namespace std;class race{public:	race()	{	};	race(string Cname, int Cracenum, int Cstatmod[])	{		name = Cname;		racenum = Cracenum;		statmod[5] = Cstatmod[5];	}	void set(int setmod[])	{		for(int a = 0; a< 5;a++)		this->statmod[a] = setmod[a] + statmod[a];	};private:	string name;	int racenum;	int statmod[5];};class clas{public:	clas()	{	};	clas(string Cname, int Cclassnum, int Cstatmod[])	{		name = Cname;		classnum = Cclassnum;		statmod[5] = Cstatmod[5];	};private:	string name;	int classnum;	int statmod[5];};class armor{public:	armor()	{	};	armor(string Cname, int Cac, int Cresisttype, int Carmortype)	{		name = Cname;		ac = Cac;		resisttype = Cresisttype;		armortype = Carmortype;	};	void setac(int ac)	{		this->ac = ac;	};    int getac()	{		return ac;	};private:	string name;	int ac;	int resisttype; //0Regular 1Undead 2Fire 3Ice 4Magic	int armortype; //Basic Types: 1Helm 2Chest 3boots 4gloves 5greaves 6belt};class weapon{public:	weapon()	{	};	weapon(string Cname, int Cmindmg, int Cmaxdmg, int Cweptype, bool Chands, int Cdmgtype, int Cmagicdmg, int Cmpcost)	{		name = Cname;		mindmg = Cmindmg;		maxdmg = Cmaxdmg;		weptype = Cweptype;		hands = Chands;		dmgtype = Cdmgtype;		magicdmg = Cmagicdmg;		mpcost = Cmpcost;	};private:	string name; //Weapon Name	int mindmg; //Minimum Weapon Dmg	int maxdmg; //Maximum Weapon Dmg	int weptype; //Basic Types: 1Sword, 2Axe, 3Dagger, 4Wand, 5Staff, 6PoleArm, 7Fists	bool hands; //0 for 1-h 1 for 2-h	int dmgtype; //0Regular 1Undead, 2Fire, 3Frost, 4Magic, 5Elemental, 6Lightning	int magicdmg; //Magic Dmg weapon does, if none, 0	int mpcost; //Cost of using};class character{public:	character(string Cname, int Clevel, int Cexp, int Chp, int Cmp, int Cac, clas Cclas, race Crace, weapon Cweapon, armor Carmor[], int Cslot[])		:race(Crace), clas(Cclas),weapon(Cweapon)	{		name = Cname;		level = Clevel;		exp = Cexp;		hp = Chp;		mp = Cmp;		ac = Cac;		armor[6] = Carmor[6];		slot[10] = Cslot[10];	};private:	string name;	int level;	int exp;	int hp;	int mp;	int ac;	clas clas;	race race;	weapon weapon;	armor armor[6];	int slot[10];	int stat[5];};//Globalsconst int basestat[5] = {10,10,10,10,10}; 	//Racesint Dwarfstat[5] = {11, 5, 12, 0, 0};int Elfstat[5] = {5, 10, 5, 3, 2};int Humanstat[5] = {5, 5, 5, 5, 5};int Iksarstat[5] = {0, 0, 5, 15, 10};int Minotaurstat[5] = {12, 5, 14, -3, -2};int Halflingstat[5] = {2, 5, 2, 10, 15};int Satyrstat[5] = {0, 15, 2, 10, 2};race Dwarf("Dwarf", 1, Dwarfstat), Elf("Elf", 2, Elfstat), Human("Human", 3, Humanstat), Iksar("Iksar", 4, Iksarstat), Minotaur("Minotaur", 5, Minotaurstat), Halfling("Halfling", 6, Halflingstat), Satyr("Satyr", 7, Satyrstat);	//Classesint Wizardstat[5] = {0,0,0,10,5};int Warriorstat[5] = {10, 7, 10, 0, 0};int Roguestat[5] = {5, 10, 5, 5, 5};int Barbarianstat[5] = {12, 5, 13, -2, -3};int Knightstat[5] = {7, 7, 7, 5, 5};int Mysticstat[5] = {5, 5, 5, 5, 5};int Prieststat[5] = {2, 3, 5, 5, 10};clas Wizard("Wizard", 1, Wizardstat), Warrior("Warrior", 2, Warriorstat), Rogue("Rogue", 3, Roguestat), Barbarian("Barbarian", 4, Barbarianstat), Knight("Knight", 5, Knightstat), Mystic("Mystic", 6, Mysticstat), Priest("Priest", 7, Prieststat);	//Armorsarmor	LeatherHelm("Leather Helm", 1, 0, 1), 		ChainHelm("Chain Helm", 2, 0 , 1),		ScaleHelm("Scale Helm", 3, 0, 1),		PlateHelm("Plate Helm", 4, 0, 1),		EagleHelm("Eagle Helm", 10, 4, 1);armor	LeatherArmor("Leather Armor", 1, 0,2), 		ChainMail("Chain Mail", 2, 0,2), 		ScaleMail("Scale Mail", 3, 0,2), 		PlateMail("Plate Mail", 4, 0,2), 		EagleMail("Eagle Mail", 10, 4,2);armor   LeatherBoots("Leather Boots", 1, 0,3), 		ChainBoots("Chain Boots", 2, 0,3), 		ScaleBoots("Scale Boots", 3, 0,3), 		PlateBoots("Plate Boots", 4, 0,3), 		EagleBoots("Eagle Boots", 10, 4,3);armor   LeatherGloves("Leather Gloves", 1, 0,4), 		ChainGloves("Chain Gloves", 2, 0,4), 		ScaleGloves("Scale Gloves", 3, 0,4), 		PlateGloves("Plate Gloves", 4, 0,4), 		EagleGloves("Eagle Gloves", 10, 4,4);armor	LeatherGreaves("Leather Greaves", 1, 0,5), 		ChainGreaves("Chain Greaves", 2, 0,5), 		ScaleGreaves("Scale Greaves", 3, 0,5), 		PlateGreaves("Plate Greaves", 4, 0,5), 		EagleGreaves("Eagle Greaves", 10, 4,5);armor	LeatherBelt("Leather Belt", 1, 0,6), 		ChainBelt("Chain Belt", 2, 0,6), 		ScaleBelt("Scale Belt", 3, 0,6), 		PlateBelt("Plate Belt", 4, 0,6), 		EagleBelt("Eagle Belt", 10, 4,6);	//Weaponsweapon	SilverSword("Silver Sword", 12, 24, 1, 0, 1, 0, 0), 		GreatSword("Great Sword", 20, 30, 1, 0, 0, 0, 0), 		FireSword("Fire Sword", 25, 40, 1, 0, 2, 5, 0), 		BroadSword("Broad Sword", 30, 50, 1, 0, 0, 0, 0), 		EagleSword("Eagle Sword", 40, 80, 1, 0, 4, 10, 0);weapon	SilverAxe("Silver Axe", 15, 30, 2, 1, 1, 0, 0), 		GreatAxe("Great Axe", 23, 33, 2, 1, 0, 0, 0), 		FireAxe("Fire Axe", 28, 43, 2, 1, 2, 5, 0), 		BroadAxe("Broad Axe", 33, 53, 2, 1, 0, 0, 0), 		EagleAxe("Eagle Axe", 43, 83, 2, 1, 4, 10, 0);weapon	SilverDagger("Silver Dagger", 10, 18, 3, 0, 1, 0, 0), 		GreatDagger("Great Dagger", 18, 28, 3, 0, 0, 0, 0), 		FireDagger("Fire Dagger", 22, 36, 3, 0, 2, 5, 0), 		BroadDagger("Broad Dagger", 28, 46, 3, 0, 0, 0, 0), 		EagleDagger("Eagle Dagger", 38, 75, 3, 0, 4, 10, 0);weapon	MagicWand("Magic Wand", 5, 10, 4, 0, 4, 20, 5), 		ElementalWand("Elemental Wand", 10, 15, 4, 0, 5, 40, 10), 		FireWand("Fire Wand", 15, 20, 4, 0, 2, 60, 15), 		IceWand("Ice Wand", 20, 25, 4, 0, 3, 80, 20), 		LightningWand("Lightning Wand", 35, 65, 4, 0, 4, 150, 30);weapon	MagicStaff("Magic Staff", 10, 15, 5, 1, 4, 30, 7), 		ElementalStaff("Elemental Staff", 15, 20, 5, 1, 2, 60, 14), 		FireStaff("Fire Staff", 20, 25, 5, 1, 2, 90, 21), 		IceStaff("Ice Staff", 25, 30, 5, 1, 3, 120, 28), 		LightningStaff("Lightning Staff", 40, 70, 5, 1, 6, 200, 40);weapon	SilverHalberd("Silver Halberd", 20, 35, 6, 1, 1, 0, 0), 		GreatHalberd("Great Halberd", 30, 45, 6, 1, 0, 0, 0), 		FireHalberd("Fire Halberd", 45, 60, 6, 1, 2, 5, 0), 		BroadHalberd("Broad Halberd", 60, 75, 6, 1, 0, 0, 0), 		EagleHalberd("Eagle Halberd", 100, 200, 6, 1, 4, 10, 0);weapon	Fists("Fists", 10, 10, 7, 0, 0, 0, 0), 		SilverKnuckles("Silver Knuckles", 15, 15, 7, 1, 0, 0, 0), 		SpikedKnuckles("Spiked Knuckles", 20, 20, 7, 0, 0, 0, 0), 		DragonClaws("Dragon Claws", 25, 25, 7, 0, 2, 5, 0), 		EagleClaws("Eagle Claws", 50, 50, 7, 0, 4, 10, 0);	//Playercharacter player("Player",1, 0, 20, 20, 0, Warrior, Human, SilverSword, 0, 0);int main(){	return 0;}


i get no errors in compiling or linking, but when i run i get a critical error, whats wrong?

[Edited by - Jankos on May 23, 2005 11:00:06 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.