I need help creating random numbers, as the title tells (sort of). I am really quite new to C++ and would like some answers for making the numbers. My problem is simple. I am making an sort of D&d/NWN/RPG, if you are familliar with this sort of gameplay, I am sure you will understand what I am doing. I actually have my source code on another computer and am currently trying to find the means to transfer it to this computer but many of you might know how to help me without looking at my code:
My objective is this:
I want to create a random number that is a varible in which I can change over time within my code. Apparently for me it doen't work. For the game I am creating it is essential that I change the code through the time because the random number stands for my dmg while fighting. (Ex. 1d4, or one "roll" of a dice of four) I need this as my character increases in skill and upgrades his weapons.
I also have another problem. In the game I have to also make a roll that it one roll of twenty, i must add this to my attack bonus and use this to see if I make a hit. ( If this all seems confusing, it is from many RPG's, WARNING: you will lose your life if you get these games because you will be so addicted, JK) what I do is i must compare this against my enemy's AC (Armor Class) to see if i hit him. This all works for me, but my enemy seemes to be unable to hit me no matter how low my ac is.
One last problem. when I finally calculate the damage I make (no matter how absurd it may be) I can't find a way to subtract it from my enemy's HP (I do not mean how to display it, just how to acutally subtract the value of the damage from the enemy's HP.
If anyone has ran into these walls and knows how to beat them please tell a new programmer the answers to these petty questions. If you wish to see my source code, I will try to put it up on the forms, ANY help would be greatly apriciated.