basically i've coded for days and tried so many new things that I dont recognize my own code.... so can someone debug this for me?
Known bugs:
Experience System
Combat System
Laggy interface
thanks- heres the code:
Known bugs:
Experience System
Combat System
Laggy interface
thanks- heres the code:
Code:
{//////////////////////////////////////////////////////////////////////')
{// // // ////////////////////////////////// // // //
{// ///////////// RPG By ZFaith /////////////// //
{// // // ////////////////////////////////// // // //
{//////////////////////////////////////////////////////////////////////
Please set up your stats if you want to start out ahead
of the game, or if you are continuing from a previous game.
The stats setup section starts at line 23.
}
program RPG;
var
yourcurrentxp,xp,yourcurrenthp,monsterint:integer;
weapon,answer2,monst:string;
m:array [1..15] of string;
chance,at,st,df,es,hp,hitpoints:integer;
procedure declarestats;
begin
//SET UP STATS HERE\\
HP:= 10;
AT:= 1;
ST:= 1;
DF:= 1;
ES:= 1;
chance:= 3; // if chance = 7 then you have a 1:7 chance of combat
weapon:= 'Dildo'
//DID YOU SET UP YOUR STATS?\\
end;
function anim(text:string):boolean;
var
t:integer;
begin
result:=true
repeat
writeln(text)
writeln('-')
wait(100)
cleardebug;
writeln(text)
writeln('\')
wait(100)
cleardebug;
writeln(text)
writeln('|')
wait(100)
cleardebug;
writeln(text)
writeln('/')
t:=t+1
wait(100)
cleardebug;
until(t=5)
end;
procedure start; forward;
procedure fight; forward;
procedure declaremonsters; forward;
procedure idle;
var
answer:string;prob:integer;
begin
prob:=random(chance)
writeln(inttostr(prob))// debug
anim('...you venture further into the dungeon...')
anim('...you venture further into the dungeon...')
if prob = 0 then
begin
DeclareMonsters;
hitpoints:=random(hp)
if hitpoints = 0 then
begin
hitpoints:= 1
end;
writeln('You have encountered a level '+inttostr(hitpoints)+' '+monst+'!')
wait(3000)
cleardebug
anim('Get Ready')
answer:=readln('What do you want to do? type "Run" or "Fight"')
if answer = 'run' then
begin
cleardebug
anim('You run away...')
idle
end;
if answer = 'fight' then
begin
cleardebug
wait(500)
fight
end else
anim('You find nothing of interest...')
end else
anim('You find nothing of interest...')
end;
//Readys the monster list for usage
Procedure declaremonsters;
begin
MonsterInt := Random(14);
case Random(14) of
0: Monst :='Wolf'
1: Monst :='Bat'
2: Monst :='Spider'
3: Monst :='Rouge'
4: Monst :='Spirit'
5: Monst :='Slime'
6: Monst :='Soul Collecter'
7: Monst :='Reaper'
8: Monst :='Mage'
9: Monst :='Swordsman'
10: Monst :='Dwarf'
11: Monst :='Elf'
12: Monst :='Bowman'
13: Monst :='Valkrie'
14: Monst :='Sythe'
end;
end;
procedure reportstats;
begin
writeln('/////////////////////////')
writeln('// Your Stats //')
writeln('/////////////////////////')
writeln('')
writeln(' AT:'+inttostr(at))
writeln(' ST:'+inttostr(ST))
writeln(' DF:'+inttostr(df))
writeln(' HP:'+inttostr(hp))
writeln(' Weapon:'+weapon)
writeln('')
writeln('/////////////////////////')
end;
procedure lvlup;
var
stat:string;
begin
stat:=readln('You have enough XP to increase a level! what do you want to increase? (AT, DF, ST, HP)')
if stat='AT' then
begin
at:=at+1
xp:=xp-100
end;
if stat='ST' then
begin
st:=st+1
xp:=xp-100
end;
if stat='DF' then
begin
df:=df+1
xp:=xp-100
end;
if stat='HP' then
begin
hp:=hp+1
xp:=xp-100
end;
end;
procedure fight;
var
lasthit,lasthit2,currentxp,currenthp:integer;
begin
begin
repeat
wait(2500)
currenthp:=hitpoints-(lasthit-random(at+st*2))
lasthit:=hitpoints-currenthp
anim('You attack the '+monst+' with your '+weapon+'. You have dealt a total of '+inttostr(hitpoints-currenthp)+' damage so far.')
anim('You attack the '+monst+' with your '+weapon+'. You have dealt a total of '+inttostr(hitpoints-currenthp)+' damage so far.')
wait(2500)
yourcurrenthp:=hp-(lasthit2-random(hitpoints-df))
lasthit2:=hp-yourcurrenthp
anim('The '+monst+ ' lunges at you ferociously. It has dealt a total of '+inttostr(hp-yourcurrenthp)+' damage so far.')
anim('The '+monst+ ' lunges at you ferociously. It has dealt a total of '+inttostr(hp-yourcurrenthp)+' damage so far.')
until(currenthp or yourcurrenthp=0)
if currenthp<=0 then
begin
currentxp:=xp+(hitpoints/2)
anim('You killed a level '+inttostr(hitpoints)+' with your '+weapon+' and gained '+inttostr(currentxp)+' experience!')
xp:=currentxp
if xp>100 then
begin
lvlup
end;
end;
if yourcurrentxp=0 then
begin
anim('You have died.... GAME OVER')
reportstats
terminatescript
end;
end;
end;
procedure start;
begin
writeln('//////////////////////////////////////////////////////////////////////')
writeln('// // // ////////////////////////////////// // // //')
writeln('// ///////////// Welcome to RPG By ZFaith /////////////// //')
writeln('// // // ////////////////////////////////// // // //')
writeln('//////////////////////////////////////////////////////////////////////')
wait(5000)
cleardebug
wait(500)
repeat
anim('Press F11 to start')
until(isfkeydown(11)=true)
anim('You face the opening to an unknown dungeon...')
anim('You face the opening to an unknown dungeon...')
anim('You face the opening to an unknown dungeon...')
repeat
anim('Press F11 to enter the dungeon.')
until(isfkeydown(11)=true)
anim('You warily enter the dungeon- '+weapon+' in hand.')
anim('You warily enter the dungeon- '+weapon+' in hand.')
repeat
idle
answer2:=readln('Continue into the dungeon? type "yes" or "no" (your stats will be saved until you stop the script)')
until(answer2='no')
end;
begin
cleardebug
writeln('Please Wait While The Game Compiles...')
wait(3000)
cleardebug
wait(500)
anim('Loading')
declarestats;
anim('Loading')
declaremonsters;
anim('Loading')
repeat
start
until(false)
end.


