RANDOMIZE TIMER()
health = 100
opphealth = 100
type class
ranger as string
swordsman as string
theif as string
endtype
type stat
health as integer
str as integer
dex as integer
acc as integer
endtype
dim class(3) as class
dim stat(3) as stat
class(1).ranger = "Ranger"
stat(1).str = 4
stat(1).dex = 7
stat(1).acc = 12
class(2).swordsman = "Swordsman"
stat(2).str = 12
stat(2).dex = 6
stat(2).acc = 4
class(3).theif = "Theif"
stat(3).str = 3
stat(3).dex = 12
stat(3).acc = 6
dim oppclass(3) as class
dim oppstat(3) as stat
class(1).ranger = "Ranger"
stat(1).str = 4
stat(1).dex = 7
stat(1).acc = 12
class(2).swordsman = "Swordsman"
stat(2).str = 12
stat(2).dex = 6
stat(2).acc = 4
class(3).theif = "Theif"
stat(3).str = 3
stat(3).dex = 12
stat(3).acc = 6
do
print ""
print "What class do you want?"
print "1.) Ranger"
print "2.) Swordsman"
print "3.) Theif"
input "", classc
if classc = 1 then plyrclass$ = class(1).ranger
if classc = 2 then plyrclass$ = class(2).swordsman
if classc = 3 then plyrclass$ = class(3).theif
print "Who would you like to battle?"
print "1.) Ranger"
print "2.) Swordsman"
print "3.) Theif"
input "", oppclass
if oppclass = 1 then oppclass$ = oppclass(1).ranger
if oppclass = 2 then oppclass$ = oppclass(2).swordsman
if oppclass = 3 then oppclass$ = oppclass(3).theif
cls
goto battle
loop
battle:
tohit = rnd(5)+ 1 + (stat(class).acc) * (stat(class).str)
oppTohit = rnd(5) + 1 + (stat(oppclass).acc) * (stat(oppclass).str)
plyrdmg = (stat(class).str)
oppdmg = (stat(oppclass).str)
if tohit > oppTohit then dec opphealth, plyrdmg else dec health, oppdmg
goto health
health:
repeat
cls
print health
print opphealth
wait 500
until health or opphealth =< 0
goto battle
This is a battle system, rather basic, but you get the idea. The problem is while its doing the calculations the opptohit will always be higher than the tohit, and the damage is always weird. Can anyone help, and anyone who wants to mod this or use it for theirs just tell me. I would like to see how you used it.