Im trying to write a simple txt adv game. I trying to figure how to simulate die rolls to do combat. how do I reset kbhit() to roll every time this, function runs wild!and does not wait for a new random number is there any @$%# hope for this function
///it is called 4 times per round of combat
int die_roll(int power,char who)
int roll;
if(who=='h') //if hero is rolling
{cout<<"engage or somethin";
while(!kbhit())rand();
roll=rand();
roll=roll % power//hero max attack or defense
return roll;}
else//enemy
{cout<<"enemy action";
//same as above
}