#include <iostream>
#include <ctime>
#include <cstdlib>
#include <string>
usingnamespace std;
int main()
{
srand(time(0));
int exp = 1; // Experiance
int life = 40;
int e1health = 10; // Bloodfly Health
int gold = 0; // starting gold
int level = 1; // starting level
int hp = 15; // Health points
int mp = 10; // Mana Points
int la = 2; // LA = Leather Armour
int LS = 1; // LS = Leather Sheild
int ndmg = rand(); // npc damage
char dagger = 3; // Dagger = Weapon
int weapon = dagger; // Equipped Weapon
int armour = la; // Equipped Armour
int sheild = LS; // Equipped Sheild
int damage = (weapon); // your damage is judged by your equiped wepon
char choice; // allows the user to make choices
constint MAX_ITEMS = 5; // max invintory items (not yet used)
string setup[MAX_ITEMS];
int items = 0; // the amount of items you start with
cout << "Welcome To Krentark, This RPG may be easy at first but it will test your skills\nYou start with a dagger, leather sheild and leather curiass " ;
cin >> choice;
{
if (choice == 'f'|| choice == 'F')
{
weapon = (dagger + 0);
cout << "You hit a " << weapon << endl;
weapon = (dagger + 0);
cout << "You hit a " << weapon << endl;
cin >> choice;
}
}
if (choice = 'c')
{cout << "exp " << exp << endl;
cin >> choice;}
if (choice == 'e')
{
if (exp = 10)
{level = (level + 1);
life = (life + 10);
cout << "you are now level " << level << " congradulations" << endl;
cout << "Your exp is " << exp << endl ;}
elseif (exp < 10)
{cout << "you do not have enough exp\n";}
}
}
at the minute im just setting up the variables and checking they work, the problem is as you see, if you type c it will tell you current exp which should be 1 and it does, but if you type e it checks if you can can level up or not, the problem is if you type e it changes the exp to 10 for no reason and then levels the user up? why is this happening, its a carbon copy of my working use potion on my other script
1 2 3 4 5 6 7 8 9 10
if (choice == 'p')
{
if (potion >= 1)
{potion = (potion - 1);
life = (life + 20);
cout << "you not have" << potion << "left ";
cout << "Your health is now" << life << endl ;}
elseif (potion < 1)
{cout << "you do not have enough potions\n";}
}