Hello, I'm getting the above error when I try to run the following code, and it gets to the marked line. The game stops and I get a blue bar going across that line, and I can't seem to figure out whats wrong with it.
1 2 3 4 5 6 7 8 9 10 11 12
if (mapinfo[clvl][53]==0)
{
ltemp=rand()%1000+1;
ltemp2=allskills[3]*3;
ltemp+=rand()%ltemp2+0; // ** CRASHES
if (ltemp>750)
{
for (cplayer=0;cplayer!=4;cplayer++)
cstats[cplayer][rand()%6]++;
}
else printf ("\n");
}
if (selectedmove==0)
{
// DEX Roll vs. Enmy DEX for hit
theyroll=rand()%cmonstats[selectedenemy][_DEX]-1; // ** CRASHES
myroll=rand()%cstats[cplayer][_DEX]; // ** CRASHES
if (myroll>theyroll)
printf ("Attack sucessful\n");
elseif (theyroll>=myroll)
printf ("Attack dodged\n");
// STR Roll vs. Enmy STA for damage
myroll=rand()%cstats[cplayer][_STR];
theyroll=rand()%cmonstats[selectedenemy][_STA];
weroll=myroll-theyroll;
// Deal damage
if (weroll>0)
{
cmonstats[selectedenemy][_HP]-=weroll;
printf ("You hit for %d\n",weroll);
}
else printf ("Did 0 or less damage\n");
dir=getche(); // ** TEMP
return;
}
Albatross: Thank you for the help, but the information you linked me to went WAY over my head. I tend to get buried in unknown lingo when I try to look it up myself.
helios: That's it! The variables listed were all equal to 0 the times that it crashed, it was only a simple statement of if (variable!=0) away from working perfectly, thank you!