Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Need help with text based rpg

Author
Message
D a r k
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: In ur fridge, eatin ur foodz.
Posted: 23rd Jun 2004 00:21
Ok im new to darkbasic and im using DBC and ive started making a text based rpg. I need someone to show me if there is a way to organize my code better. Like a way to make all the vairable's into an array or whatever so i can make more without using up a whole lot of space and getting mixed up on my code. I also wanted to find out how the player could save the game and save his/her stats so the next time they log in they can start from where they left off with there stats and everything else. I also need help making a login screen and a way to store someones username/password. If anyone else has anything that can help me or any suggest please tell me (by the way some of the magic attack and techniques and monsters are not finished yet because i just started making this a few days ago)
D a r k
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: In ur fridge, eatin ur foodz.
Posted: 23rd Jun 2004 00:23
Here is the code:
Goblinstr=RND(5)
Bandithp=23
Banditstr=RND(8)
Darkmagehp=31
Darkmagestr=RND(10)
Warriorhp=38
Warriorstr=RND(11)
Horsemanhp=46
Horsemanstr=RND(16)
Knighthp=54
Knightstr=RND(21)
Darkknighthp=54
Darkknightstr=RND(29)
Heroinehp=74
Heroinestr=RND(32)
Warlordhp=87
Warlordstr=RND(37)
Darklordhp=102
Darklordstr=RND(43)
Darkhorsemenhp=148
Darkhorsemenstr=RND(56)
DarkWarlordhp=156
Darkwarlordstr=RND(64)
ChaosLordhp=218
Chaoslordstr=RND(75)
Darkangelhp=284
Darkangelstr=RND(100)
Level=1
Exp=0
Exptill=80
Maxhealth=15
Health=15
Maxstrength=3
Strength=RND(maxstrength)
PowerLvl=1
Powerexp=0
Powerexptill=80
Techniquelvl=1
Techexptill=80
Techexp=0
Magiclvl=1
maxmagicp=10
Magicp=10
Magicexp=0
Magicexptill=80
Rubies=10
Items$="None"
Armor$="None"
Weapons$="None"
Doublepunch=RND(8)
Doublekick=RND(11)
Jumpkick=RND(15)
Darkpunch=RND(17)
Darkkick=RND(22)
Doubleslash=RND(27)
Quadraslash=RND(32)
Quadracut=RND(38)
Chaosblade=RND(47)
Spinningslash=RND(54)
Elementblade=RND(59)
Darkcut=RND(64)
Psiblade=RND(70)
Deathblade=RND(76)


rem clear screen start introduction
Introduction:
cls
Print "Welcome to Forbidden Realms"
Sleep 4000
Print "Created by: Drew Leffell"
Sleep 4000
Print "Copyright 2004 Utopia Games"
Sleep 2000

rem Login Screen
login:
cls
Print "You wake up in a room, you are surrounded by white light, you can't see much"
Sleep 4000
Print "You see the figure of a man"
Sleep 4000
Print "As he comes closer you see he has white hair"
Print "Armor made of black and a demonic blade to his side"
Print "The man approches you"
Sleep 4000
Print "Hello my name is Bayln, I am the seer of the Forbidden Realm"
Sleep 4000
Print "Bayln: What is your name?"
Input "Name> ",name$
Print "Bayln: hmm...I don't recognize that name you must be new"
Sleep 4000
Print "We need to get some things straightened out before I can tell you anymore"
Print "First you must decide on a secret word that only I and you shall know,"
Print "What do you want it to be?"
Input "Password> ",pass$
Print "Ok so you have choosen ",pass$," as your password, very well"
Sleep 4000
Print "I will keep this a secret you should do the same, you will"
Print "need this word everytime you wish to enter the Realms"
sleep 4000
Print "Now you must proceed to a place called Bwen there you will be instructed"
Print "On what you should and can do next"
Print "Press any Key to Continue"
SUSPEND FOR KEY

rem Main Menu
MainMenu:
cls
If exp>=exptill
goto levelup
endif
If magicexp>=Magicexptill
goto magiclevelup
endif
If techexp>=techexptill
goto techniquelevelup
endif
If powerexp>=powerexptill
goto powerlevelup
endif
Print "What do you wish to do?"
Print "(1)Training Beach (2)Battle Arena (3)Explore (4)Shops"
Print "(5)Stats (6)Inventory (7)Settings (8)Quit(Log out)"
Input "Action> ",actionmain

rem the player chooses a command from the menu.
If actionmain=1
goto Trainbeach
endif

If actionmain=2
goto battlearena
endif

If actionmain=3
goto Explore
endif

if actionmain=4
goto shops
endif

if actionmain=5
goto stats
endif

if actionmain=6
goto inventory
endif

if actionmain=7
goto settings
endif

if actionmain=8
goto Login
endif

rem Training Beach
Trainbeach:
cls
Print "Who do you wish to fight?"
Print "(1)Rat (lvl 2)"
Print "(2)Goblin (lvl 5)"
Print "(3)Bandit (lvl 8)"
Print "(4)Darkmage (lvl 10)"
Print "(5)Warrior (lvl 11)"
Print "(6)Horsemen (lvl 16)"
Print "(7)Knight (lvl 21)"
Print "(8)Dark knight (lvl 29)"
Print "(9)Heroine (lvl 32)"
Print "(10)Warlord (lvl 37)"
Print "(11)Darklord (lvl 43)"
Print "(12)Dark horsemen (lvl 56)"
Print "(13)Dark Warlord (lvl 64)"
Print "(14)Chaos Lord (lvl 75)"
Print "(15)Dark Angel (lvl 100)"
Input "Fight> ",fight

If fight=1
goto fightrat
endif

rem fight rat

fightrat:
cls
Print "Rat HP ",rathp," Your HP ",Health
Print "Choose your action"
Print "(1)Attack (2)Technique (3)Magic (4)Special (5)Item (6)Run"
Input "Action> ",action

If action=1
goto attackrat
endif

If action=2
goto technique
endif

rem The player normally Attacks the rat
attackrat:
Print "You attack the rat"
Print "You inflict ",strength," damage on the rat"
Dec rathp,strength
Strength=RND(maxstrength)
Sleep 4000
Ratatt:
If rathp<=0
goto ratvictory
endif
If Health<=0
goto dead
endif
Print "The rat Bites you"
Print "Rat Inflicts ",ratstr," Damage on you "
Dec Health,ratstr
ratstr=RND(ratmaxstr)
Sleep 4000
If rathp<=0
goto ratvictory
endif
If Health<=0
goto dead
endif
goto fightrat

rem use technique
Technique:
Print "What technique do you wish to use?"
Print "(1)Double Punch"
If techniquelvl>=2 then Print "(2)Double Kick"
If Techniquelvl>=3 then Print "(3)Jump Kick"
If Techniquelvl>=6 then Print "(6)Dark Punch"
If Techniquelvl>=7 then Print "(7)Dark Kick"
If Techniquelvl>=9 then Print "(9)Double Slash"
If Techniquelvl>=12 then Print "(12)Quadra Slash"
If Techniquelvl>=13 then Print "(13)Quadra Cut"
If Techniquelvl>=15 then Print "(15)Chaos Blade"
If Techniquelvl>=18 then print "(18)Spinning Slash"
If Techniquelvl>=22 then print "(22)Element Blade"
If Techniquelvl>=23 then print "(23)Dark cut"
If Techniquelvl>=27 then print "(27)Psi Blade"
If Techniquelvl>=31 then print "(31)Death Blade"
Input "Technique ",technique

If technique=1
goto doublepunchrat
endif

If technique=2
goto doublekickrat
endif

if technique=3
goto jumpkickrat
endif

if technique=6
goto darkpunchrat
endif

if technique=7
goto darkkickrat
endif

if technique=9
goto doubleslashrat
endif

rem double punch
doublepunchrat:
Print "You use double punch on the rat"
Print "You inflict ",doublepunch," damage on the rat"
Dec rathp,doublepunch
Print "The technique inflicts 2 damage on you"
Dec health,2
Doublepunch=RND(8)
Inc Techexp,15
Goto ratatt

rem double kick
doublekickrat:
Print "You use double kick on the rat"
Print "You inflict ",doublekick," damage on the rat"
Dec rathp,doublekick
Print "The technique inflicts 4 damage on you"
Dec health,4
Doublekick=RND(11)
Inc Techexp,19
Goto ratatt

rem jump kick rat
jumpkickrat:
Print "You use Jump Kick on the rat"
Print "You inflict ",jumpkick," damage on the rat"
Dec rathp,jumpkick
Print "The technique inflicts 3 damage on you"
Dec health,3
jumpkick=RND(15)
Inc Techexp,17
Goto ratatt

rem dark punch
darkpunchrat:
Print "You use dark punch on the rat"
Print "You inflict ",darkpunch," damage on the rat"
Dec rathp,darkpunch
Print "The technique inflicts 5 damage on you"
Dec health,5
darkpunch=RND(17)
Inc Techexp,24
Goto ratatt

rem dark kick
darkkickrat:
Print "You use dark kick on the rat"
Print "You inflict ",darkkick," damage on the rat"
Dec rathp,darkkick
Print "The technique inflicts 7 damage on you"
Dec health,7
Darkkick=RND(22)
Inc Techexp,29
Goto ratatt

rem double slash
doubleslashrat:
Print "You use double slash on the rat"
Print "You inflict ",doubleslash," damage on the rat"
Dec rathp,doubleslash
Print "The technique inflicts 8 damage on you"
Dec health,8
Doubleslash=RND(27)
Inc Techexp,37
Goto ratatt

rem rat defeated
ratvictory:
Print "Rat has been slain"
Print "You have gained 13 Exp"
Print "You have gained 3 Rubies"
Rathp=10
Inc Rubies,3
Inc Exp,13
Sleep 4000
Goto Mainmenu

rem Dead
dead:
Print "You have been slain"
Print "All of your Rubies were lost"
Print "Your armor was lost"
Print "Your weapons were lost"
Print "You have lost some Exp"
Rathp=10
Goblinhp=17
Bandithp=23
Darkmagehp=31
Warriorhp=38
Horsemanhp=46
Knighthp=54
Darkknighthp=54
Heroinehp=74
Warlordhp=87
Darklordhp=102
Darkhorsemenhp=148
DarkWarlordhp=156
ChaosLordhp=218
Darkangelhp=284
Dec exp,RND(50)
Dec Rubies,(50)
Armor$="None"
Weapons$="None"
Health=Maxhealth
Sleep 4000
Goto Mainmenu

rem level up
Levelup:
cls
Print "You have just advanced a Combat Level"
Inc level,1
Inc maxstrength,1
Inc maxhealth,3
Inc exptill,exptill
Health=Maxhealth
Print "Your Level is now ",level
Print "Your Strength is now ",maxstrength
Print "Your health is now ",health
Sleep 5000
goto Mainmenu

rem magic level up
Magiclevelup:
cls
Print "You have just advanced a Magic Level"
Inc Magiclvl,1
Inc maxmagicp,3
Inc Magicexptill,magicexptill
Magicp=maxmagicp
Print "Your Magic Level is now ",magiclvl
Print "Your Magic Power is now ",maxmagicp
Sleep 4000
goto mainmenu

rem technique level up
TechniqueLevelup:
cls
Print "You have just advanced a Technique Level"
Inc Techniquelvl,1
Inc Maxhealth,2
Health=Maxhealth
Inc techexptill,techexptill
Print "Your Technique level is now ",Techniquelvl
Print "Your Health is now ",maxhealth
Sleep 4000
Goto mainmenu

rem Power level up
PowerLevelup:
cls
Print "You have just advanced a Power Level"
Inc Powerlvl,1
Inc powerexptill,powerexptill
Inc maxstrength,2
Print "Your Power level is now ",powerlvl
Print "Your Strength is now ",maxstrength
Sleep 4000
Goto mainmenu

rem Battle Arena
Battlearena:

rem explore
Explore:

rem shops
shops:

rem stats
Stats:
cls
Print "Press any key to check your stats"
Suspend for key
Print "Level ",Level
Print "Combat Exp ",exp
Print "Combat Exp needed ",exptill
Print "Health ",health,"/",Maxhealth
Print "Strength ",Maxstrength
Print "Magic Level ",magiclvl
Print "Magic Power ",magicp
Print "Magic Exp ",magicexp
Print "Magic Exp Needed ",magicexptill
Print "Power Level ",powerlvl
Print "Power Exp ",powerexp
Print "Power Exp Needed ",powerexptill
Print "Technique Level ",techniquelvl
Print "Technique Exp ",techexp
Print "Technique Exp Needed ",techexptill
Print "Items ",Items
Print "Weapons ",Weapons
Print "Armor ",Armor
Print "Rubies ",rubies
Print "Press any key to return to main menu"
SUSPEND FOR KEY
goto Mainmenu

rem inventory
Inventory:

rem settings
settings:
dj BlackDragon
20
Years of Service
User Offline
Joined: 23rd Sep 2003
Location: who knows
Posted: 23rd Jun 2004 06:12
for a password you could start off with this and go from there

remstart
Quest Text edition
Author:Ian Calvert(akaj Blackdragon)
6/22/04
remend

CLS
password$="Draconian"
input "Password: ",userpassword$
IF userpassword$=password$
PRINT "Access Granted"
wait 2000
CLS
GOTO SUBROUTINE
ELSE
PRINT "Access Denied"
ENDIF
Tyler
20
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 23rd Jun 2004 06:17 Edited at: 23rd Jun 2004 06:18
heres a huge space saver.... use

That will replace fifty million IF THEN statements..
also.. make a separate file called fights.dba and put all of your fighting functins in there..

put an #INCLUDE "fights.dba" at the front of your main source to include that file..

I have tried something like this before, and i have plenty of tips for this kind of game.. I'd like to help you allot more.. E-mail me if you want it..

http://www.geocities.com/tylerc1324
D a r k
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: In ur fridge, eatin ur foodz.
Posted: 23rd Jun 2004 09:12
Thanks for your help I understand how that username/password thing would work but I want a way for the player to pick a username and password and for it to be stored along with that players stats does anyone know how to do this?
Guhill The friendly one
20
Years of Service
User Offline
Joined: 12th Jun 2004
Location: The fourth demension
Posted: 23rd Jun 2004 21:46
I know a guy who can help you. His email address is feltpants@hotmail.com If you want to download his text based RPG just go to http://203.79.119.250/harry/download.htm

I know now, without a doubt, that Kingdom Hearts... IS LIGHT (Sora)

Login to post a reply

Server time is: 2024-09-22 14:37:00
Your offset time is: 2024-09-22 14:37:00