okay, I'm lost. hope is dwindling.

LETS TRY THIS AGAIN!!!!!!!

I did some "revamping on code but it appears i had a singularity manifest in my mind as I was doing so BECAUSE I MADE 564 ERRORS!!!! it all points to the player files. please show me the path.

Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;



int main()
{
	Combat combat;
	combat.runCombat();

	system("PAUSE");
	return 0;
}


Combat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
#include <iostream>
#include <ctime>
#include <string>
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;

class Combat
{
public:
	Combat();
	
	bool runCombat();

private:
	
};


Combat.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;

Combat::Combat()
{
}

bool Combat::runCombat()
{
	void playerCharacters();
	void equipment();

	const int entities = 7;

	Combatant combatants[entities];
	combatants[0] = fighter;
	combatants[1] = mage;
	combatants[2] = marksman;
	combatants[3] = assassin;
	combatants[4] = support;
	combatants[5] = tank;
	combatants[6] = blank;

	bool cbat = true;

	while (cbat == true)
	{
		int swapHolder;
		Combatant swapper;
		int end = entities;
		int length = entities;

		int position[entities] = {combatants[0]._speed, combatants[1]._speed, combatants[2]._speed, combatants[3]._speed, combatants[4]._speed, combatants[5]._speed, combatants[6]._speed};

		for (int counter = length - 1; counter > 0; counter--) {
			for (int index = 0; index < end; index++) {
				if (position[index] < position[index + 1]) {
					swapHolder = position[index + 1];
					swapper = combatants[index + 1];
					position[index + 1] = position[index];
					combatants[index + 1] = combatants[index];
					position[index] = swapHolder;
					combatants[index] = swapper;
				}
			}
		}
		
		cout << "Turn Order" << endl;
		cout << combatants[0]._name << endl;
		cout << combatants[1]._name << endl;
		cout << combatants[2]._name << endl;
		cout << combatants[3]._name << endl;
		cout << combatants[4]._name << endl;
		cout << combatants[5]._name << endl;

		for (int counter = 0; counter < 6; counter++) {
			
		}
	
	return true;
}


Combatant.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;

class Combatant
{
public:
	Combatant();
	
	void stats(int speed, float health, float stamina, float mana, float defense, int mAccuracy, int rAccuracy, float critChance, float power);

	string _name;

	bool _alive;
	bool _ally;

	int _level;
	int _experience;
	int _gold;

	int _speed;
	float _health;
	float _currentHealth;
	float _stamina;
	float _currentStamina;
	float _mana;
	float _currentMana;
	float _defense;
	int _mAccuracy;
	int _rAccuracy;
	float _critChance;
	float _power;
	
	float _aArmor;
	float _aResist;
	float _aDefPenalty;

	int _rAccuracyDie;
	int _rDamageDie;
	int _rFireSpeed;
	int _rManaCost;
	int _rStaminaCost;

	int _mAccuracyDie;
	int _mDamageDie;
	int _mCritChanceMod;
	int _mStaminaCost;

	void chosenWeapon(weapon chosen);
	void chosenArmor(armor chosen);

	//create functions and variables for abilities 1-4, and defense actions, range attacks.

	int pickAction();

	void printStats();

	int attack(Combatant target);
	void block();
	void roll();
	void protect();

};


Combatant.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Combatant.h"
#include "Players.h"

using namespace std;


Combatant::Combatant()
{
}
void Combatant::stats(int speed, float health, float stamina, float mana, float defense, int mAccuracy, int rAccuracy, float critChance, float power)
{
	string _name;
	bool _alive = true;

	_level = 1;

	_speed = speed;
	_health = health;
	_currentHealth = health;
	_stamina = stamina;
	_currentStamina = stamina;
	_mana = mana;
	_currentMana = mana;
	_defense = defense;
	_mAccuracy = mAccuracy;
	_rAccuracy = rAccuracy;
	_critChance = critChance;
	_power = power;
}
void Combatant::chosenWeapon(weapon chosen)
{
	if (chosen.melee == true) {
		_mAccuracyDie = chosen._attackDice;
		_mDamageDie = chosen._damageDice;
		_mCritChanceMod = chosen._critChanceMod;
		_mStaminaCost = chosen._staminaCost; 
	}
	else {
		_rAccuracyDie = chosen._attackDice;
		_rDamageDie = chosen._damageDice;
		_rFireSpeed = chosen._fireSpeed;
		_rStaminaCost = chosen._staminaCost;
		_rManaCost = chosen._manaCost;
	}
}
void Combatant::chosenArmor(armor chosen)
{
	_aArmor = chosen._armor;
	_aResist = chosen._resist;
	_aDefPenalty = chosen._defPenalty;
}
int Combatant::pickAction()
{
whoops:
	int actionChoice;

	cout << "Please pick an action!" << endl;
	cout << "1). View Stats!" << endl;
	cout << "2). Attack!" << endl;
	cout << "3). Cast Spell!" << endl;

	cin >> actionChoice;


	if (actionChoice == 1) {
		return 1;
	}
	else if (actionChoice == 2) {
		return 2;
	}
	else if (actionChoice == 3) {
		return 3;
	}
	else {
		cout << "You cannot do that now!" << endl;
		goto whoops;
	}

}
void Combatant::printStats()
{
	cout << "NAME.................." << _name << endl;
	cout << "LEVEL................." << _level << endl;
	cout << "SPEED................." << _speed << endl;
	cout << "HEALTH................" << _currentHealth << "/" << _health << endl;
	cout << "STAMINA..............." << _currentStamina << "/" << _stamina << endl;
	cout << "MANA.................." << _currentMana << "/" << _mana << endl;
	cout << "DEFENSE..............." << _defense << endl;
	cout << "MELEE................." << _mAccuracy << endl;
	cout << "RANGE................." << _rAccuracy << endl;
	cout << "CRITICAL CHANCE......." << _critChance << "%" << endl;
	cout << "POWER................." << _power << endl;
	cout << endl;

	cout << "MELEE CHANCE.........." << _mAccuracyDie << endl;
	cout << "MELEE DAMAGE.........." << _mDamageDie << endl;
	cout << "CRITICAL MODIFIER....." << _mCritChanceMod << endl;
	cout << "STAMINA COST.........." << _mStaminaCost << endl;
	cout << endl;

	cout << "ARMOR................." << _aArmor << endl;
	cout << "RESIST................" << _aResist << endl;
	cout << "DEFENSE PENALTY......." << _aDefPenalty << endl;
}
int Combatant::attack(Combatant target)
{

	int aTotal;
	float dTotal;
	int iTotal;

	//Roll dice for Attack and Damage "ranges"
	Dice ATTACK;
	Dice DAMAGE;


	int attackDiceResults = ATTACK.diceRoller(_mAccuracyDie);
	float damageDiceResults = DAMAGE.diceRoller(_mDamageDie);

	//Add dice results with player stats.
	aTotal = _mAccuracy + attackDiceResults;
	dTotal = _power + damageDiceResults;

	if (aTotal >= target._defense) {
		iTotal = dTotal - 40;
		
		cout << "You have been dealt " << iTotal << " damage to " << target._name << "!" << endl;
		target._currentHealth -= iTotal;
		cout << target._name << " has " << target._currentHealth << " Health left!" << endl;
		return iTotal;
	}
	else {
		cout << _name << " has missed!" << endl;
		return 0;
	}
}


Equipment.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Players.h"


using namespace std;


class weapon
{
public:
	weapon();

	void rStats(string name, int accuracyDice, int damageDice, int fireSpeed, int staminaCost, int manaCost);
	void mStats(string name, int accuracyDice, int damageDice, float critChanceMod, int staminaCost);

	bool melee; 

	string _name;
	int _attackDice;
	int _damageDice;

	float _critChanceMod;

	int _fireSpeed;
	int _staminaCost;
	int _manaCost;
};

class armor
{
public:
	armor();

	void stats(string name, float armor, float resist, float defPenalty);

	string _name;
	float _armor;
	float _resist;
	float _defPenalty;
};



Equipment.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;


weapon::weapon()
{
}
void weapon::mStats(string name, int accuracyDice, int damageDice, float critChanceMod, int staminaCost)
{
	_name = name;
	_attackDice = accuracyDice;
	_damageDice = damageDice;
	_critChanceMod = critChanceMod;
	_staminaCost = staminaCost;
}
void weapon::rStats(string name, int accuracyDice, int damageDice, int fireSpeed, int staminaCost, int manaCost)
{
	_name = name;
	_attackDice = accuracyDice;
	_damageDice = damageDice;
	_fireSpeed = fireSpeed;
	_staminaCost = staminaCost;
	_manaCost = manaCost;
}


armor::armor()
{
}
void armor::stats(string name, float armor, float resist, float defPenalty)
{
	_name = name;
	_armor = armor;
	_resist = resist;
	_defPenalty = defPenalty;
}



Players.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"

using namespace std;

Combatant blank;
Combatant fighter;
Combatant mage;
Combatant marksman;
Combatant assassin;
Combatant support;
Combatant tank;

weapon wblank;
weapon greatSword;
weapon greatHammer;
weapon dagger;
weapon marksmanRifle;
weapon longStaff;
weapon assaultRifle;

armor ablank;
armor fighterArmor;
armor mageArmor;
armor marksmanArmor;
armor assassinArmor;
armor supportArmor;
armor tankArmor;


Players.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;


void playerCharacters()
{
	void equipment();

	Combatant blank;
	blank._name = "Blank";
	blank.stats(0, 0, 0, 0, 0, 0, 0, 0, 0);
	blank.chosenArmor(wblank);
	blank.chosenWeapon(ablank);

	Combatant fighter;
	fighter._name = "Fighter";
	fighter.stats(30, 1030, 1075, 850, 125, 96, 64, 1.8, 115);
	fighter.chosenArmor(fighterArmor);
	fighter.chosenWeapon(greatSword);
	
	Combatant mage;
	mage._name = "Mage";
	mage.stats(28, 1000, 850, 1150, 146, 90, 96, 1.5, 88);
	mage.chosenArmor(mageArmor);
	mage.chosenWeapon(longStaff);
	
	Combatant marksman;
	marksman._name = "Marksman";
	marksman.stats(35, 1120, 1030, 970, 140, 70, 100, 2.8, 85);
	marksman.chosenArmor(marksmanArmor);
	marksman.chosenWeapon(marksmanRifle);
	
	Combatant assassin;
	assassin._name = "Assassin";
	assassin.stats(32, 850, 1075, 880, 164, 80, 76, 3.0, 92.5);
	assassin.chosenArmor(assassinArmor);
	assassin.chosenWeapon(dagger);

	Combatant support;
	support._name = "Support";
	support.stats(22, 970, 925, 1120, 170, 80, 90, 1.0, 103);
	support.chosenArmor(supportArmor);
	support.chosenWeapon(assaultRifle);
	
	Combatant tank;
	tank._name = "Tank";
	tank.stats(25, 1150, 1075, 1000, 110, 84, 76, 1.2, 112);
	tank.chosenArmor(tankArmor);
	tank.chosenWeapon(greatHammer);
}

void equipment()
{
	wblank.mStats("Blank", 0, 0, 0, 0);
	wblank.melee = true;
	greatSword.mStats("Great Sword", 85, 150, 2, 275);
	greatSword.melee = true;
	greatHammer.mStats("Great Hammer", 65, 210, 1, 340);
	greatHammer.melee = true;
	dagger.mStats("Dagger", 100, 100, 3, 175);
	dagger.melee = true;
	marksmanRifle.rStats("Marksman Rifle", 90, 115, 5, 50, 50, 172.5);
	marksmanRifle.melee = false;
	longStaff.rStats("Staff", 80, 150, 1, 10, 225);
	longStaff.melee = false;
	assaultRifle("Assault Rifle", 70, 80, 10, 100, 120);
	assaultRifle.melee = false;

	ablank("Blank Armor", 0, 0, 0);
	fighterArmor("Fighter's Armor", 60, 40, 30);
	mageArmor("Mage's Armor", 40, 60, 30);
	marksmanArmor("Marksman Armor", 20, 20, 12);
	assassinArmor("Assassin Armor", 40, 20, 18);
	supportArmor("Support Armor", 40, 40, 24);
	tankArmor("Tank Armor", 60, 60, 36);
}


Dice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
#include <iostream>
#include <ctime>
#include <string>
#include <random>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;

class Dice
{
public:
	Dice();
	int Dice::diceRoller(int x);
	
private:
	
};


Dice.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;

Dice::Dice()
{
	
}

int Dice::diceRoller(int x)
{
	random_device rd;
	default_random_engine randomGenerator(rd());
	uniform_int_distribution<int> roll(1, x);
	return roll(randomGenerator);
}
post the first 2 or 3 errors.

and why are you declaring global variables in your header file?

This:
void playerCharacters()
creates a bunch of Combatants that you don't do anything with.

also why have you declared void equipment(); inside your playerCharacters method?
Last edited on
and now for my errors. I wont print over 500 errors so I'll simplify it since most of them are repeats of the same kind of error.


Error C2065 'mage': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 26

Error C2146 syntax error: missing ';' before identifier 'combatants' C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 24

Error C2065 'combatants': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 24

Error C2065 'combatants': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 25

Error C2065 'fighter': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 25

Error C2065 'combatants': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 26

Severity Code Description Project File Line
Error C2146 syntax error: missing ';' before identifier 'blank' C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 18

Error C2065 'blank': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 18

Error C2065 'blank': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 19

Error C2228 left of '._name' must have class/struct/union C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 19

Error C2065 'blank': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 20

Error C2228 left of '.stats' must have class/struct/union C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 20

Error C2065 'blank': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 21

Error C2228 left of '.chosenArmor' must have class/struct/union C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 21

Error C2065 'wblank': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 21

Error C2065 'blank': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 22

Error C2228 left of '.chosenWeapon' must have class/struct/union C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 22

Error C2065 'ablank': undeclared identifier C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\players.cpp 22

im still very new so keep that in mind :P i was trying to create a way for me to list all players because while right now, each combatant doesn't use a lot of lines to declare their stats, eventually each combatant will have 4 unique abilities each that will take up so much space. I need a file or something that I can keep just premade combatants inside. as far as declaring those functions, it was my last ditch effort to see if they would fix anything.
Okay, I revamped it again, only have 2 errors, i took out the player files and incorporated them into the combat files. here is the new copy of combat files and the errors im coming across.



Error C3867 'Combatant::printStats': non-standard syntax; use '&' to create a pointer to member C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 68

Error C3867 'Combatant::pickAction': non-standard syntax; use '&' to create a pointer to member C++ Course Work c:\users\kyle\documents\visual studio 2015\projects\c++ course work\c++ course work\combat.cpp 65



Combat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <iostream>
#include <ctime>
#include <string>
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;

class Combat
{
public:
	Combat();
	
	bool runCombat();

	void introduceCharacters();

	void introduceEquipment();

	Combatant blank;
	Combatant fighter;
	Combatant mage;
	Combatant marksman;
	Combatant assassin;
	Combatant support;
	Combatant tank;

	weapon wblank;
	weapon greatSword;
	weapon greatHammer;
	weapon dagger;
	weapon marksmanRifle;
	weapon longStaff;
	weapon assaultRifle;

	armor ablank;
	armor fighterArmor;
	armor mageArmor;
	armor marksmanArmor;
	armor assassinArmor;
	armor supportArmor;
	armor tankArmor;

private:
	
};


Combat.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
#include "Players.h"

using namespace std;

Combat::Combat()
{
}

bool Combat::runCombat()
{
	void introduceCharacters();

	const int entities = 7;

	Combatant combatants[entities];
	combatants[0] = fighter;
	combatants[1] = mage;
	combatants[2] = marksman;
	combatants[3] = assassin;
	combatants[4] = support;
	combatants[5] = tank;
	combatants[6] = blank;

	bool cbat = true;

	while (cbat == true)
	{
		int swapHolder;
		Combatant swapper;
		int end = entities;
		int length = entities;

		int position[entities] = { combatants[0]._speed, combatants[1]._speed, combatants[2]._speed, combatants[3]._speed, combatants[4]._speed, combatants[5]._speed, combatants[6]._speed };

		for (int counter = length - 1; counter > 0; counter--) {
			for (int index = 0; index < end; index++) {
				if (position[index] < position[index + 1]) {
					swapHolder = position[index + 1];
					swapper = combatants[index + 1];
					position[index + 1] = position[index];
					combatants[index + 1] = combatants[index];
					position[index] = swapHolder;
					combatants[index] = swapper;
				}
			}
		}

		cout << "Turn Order" << endl;
		cout << combatants[0]._name << endl;
		cout << combatants[1]._name << endl;
		cout << combatants[2]._name << endl;
		cout << combatants[3]._name << endl;
		cout << combatants[4]._name << endl;
		cout << combatants[5]._name << endl;

		for (int counter = 0; counter < 6; counter++) {
			switch (combatants[counter].pickAction)
			{
			case 1:
				combatants[counter].printStats;
				break;
			case 2:

				break;
			}
		}

		return true;
	}
}

void Combat::introduceCharacters()
{
	Combatant blank;
	blank._name = "Blank";
	blank.stats(0, 0, 0, 0, 0, 0, 0, 0, 0);
	blank.chosenArmor(ablank);
	blank.chosenWeapon(wblank);

	Combatant fighter;
	fighter._name = "Fighter";
	fighter.stats(30, 1030, 1075, 850, 125, 96, 64, 1.8, 115);
	fighter.chosenArmor(fighterArmor);
	fighter.chosenWeapon(greatSword);

	Combatant mage;
	mage._name = "Mage";
	mage.stats(28, 1000, 850, 1150, 146, 90, 96, 1.5, 88);
	mage.chosenArmor(mageArmor);
	mage.chosenWeapon(longStaff);

	Combatant marksman;
	marksman._name = "Marksman";
	marksman.stats(35, 1120, 1030, 970, 140, 70, 100, 2.8, 85);
	marksman.chosenArmor(marksmanArmor);
	marksman.chosenWeapon(marksmanRifle);

	Combatant assassin;
	assassin._name = "Assassin";
	assassin.stats(32, 850, 1075, 880, 164, 80, 76, 3.0, 92.5);
	assassin.chosenArmor(assassinArmor);
	assassin.chosenWeapon(dagger);

	Combatant support;
	support._name = "Support";
	support.stats(22, 970, 925, 1120, 170, 80, 90, 1.0, 103);
	support.chosenArmor(supportArmor);
	support.chosenWeapon(assaultRifle);

	Combatant tank;
	tank._name = "Tank";
	tank.stats(25, 1150, 1075, 1000, 110, 84, 76, 1.2, 112);
	tank.chosenArmor(tankArmor);
	tank.chosenWeapon(greatHammer);

	
}

void Combat::introduceEquipment()
{
	wblank.mStats("Blank", 0, 0, 0, 0);
	wblank.melee = true;
	greatSword.mStats("Great Sword", 85, 150, 2, 275);
	greatSword.melee = true;
	greatHammer.mStats("Great Hammer", 65, 210, 1, 340);
	greatHammer.melee = true;
	dagger.mStats("Dagger", 100, 100, 3, 175);
	dagger.melee = true;
	marksmanRifle.rStats("Marksman Rifle", 90, 115, 5, 50, 172.5);
	marksmanRifle.melee = false;
	longStaff.rStats("Staff", 80, 150, 1, 10, 225);
	longStaff.melee = false;
	assaultRifle.rStats("Assault Rifle", 70, 80, 10, 100, 120);
	assaultRifle.melee = false;

	ablank.stats("Blank Armor", 0, 0, 0);
	fighterArmor.stats("Fighter's Armor", 60, 40, 30);
	mageArmor.stats("Mage's Armor", 40, 60, 30);
	marksmanArmor.stats("Marksman Armor", 20, 20, 12);
	assassinArmor.stats("Assassin Armor", 40, 20, 18);
	supportArmor.stats("Support Armor", 40, 40, 24);
	tankArmor.stats("Tank Armor", 60, 60, 36);
}
65
66
67
68
69
70
71
72
switch (combatants[counter].pickAction) //should be pickAction()
{
case 1:
    combatants[counter].printStats;  //should be printStats()
    break;
case 2:
    break;
}

In this segment of code, pickAction and printStats are functions that you are trying to call. You forgot the parentheses after each.
yup, a small fix i was certain. now I have a new problem, the game recognizes my Combatants from the "introduce Characters" function but it doesn't retain the stats. how do i have the stats stick with the combatants without flooding my runcombat function with stats.
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
void Combat::introduceCharacters()
{
	Combatant blank;
	blank._name = "Blank";
	blank.stats(0, 0, 0, 0, 0, 0, 0, 0, 0);
	blank.chosenArmor(ablank);
	blank.chosenWeapon(wblank);

	Combatant fighter;
	fighter._name = "Fighter";
	fighter.stats(30, 1030, 1075, 850, 125, 96, 64, 1.8, 115);
	fighter.chosenArmor(fighterArmor);
	fighter.chosenWeapon(greatSword);

        //etc... 

You're redeclaring those variable names, creating local instances that go away when they go out of scope (when the function returns). Remove the redeclarations.
oh, very true. whoops. It didn't change anythign though because I'm declaring the combatant's stats within this function so as the function closes, so does all the data that was inputted. I need a way to let that info stick outside of the function.
Line 19 in Combat.cpp is also wrong. You need to be able to tell the difference between calling a function and declaring one. When you call a function, you don't have to specify any of the types (return type, parameter types) associated with it.
17
18
19
bool Combat::runCombat()
{
	void introduceCharacters();
Last edited on
Topic archived. No new replies allowed.