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 / RPG tutorial

Author
Message
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 10th May 2005 12:07
Here is a worded (for those of you that don't have a character and level maker) RPG tutorial, it will not be for complete beginers, but it will still be pretty simple (in other words, do the pong tutorial first).

Also this tutorial is for DBPro

I will start simple, but as you move along, I will teach you more ways of doing different things.

1.the start...

this is a practice part, to learn about how to do battles.

ok, use the print command to do whatever you want, but here is the story line I first used.
do
cls
set text size 20
print
print " you are an adventurer lost in a forest"
print
print "'where am I?'"
print
print " you hear rustling leaves"
print
print "'what was that?'"
print
print " you get a bit nervous"
print
print " it stops"
wait key
loop


note that everything needs to be under 1 main loop(except for the battle), otherwise everything repeats it'self over and over again, taking up your whole screen and not letting the game do anything else.

2. your variables

at the top of the entire code(before the "do" command), state your variable and what they equal.

I had trouble with what a variable was, and I looked at many places before I figured it out while doing the pong tutorial.

basically, a variable is a made up number, like your life, followed by this symbol #.

say your life is 100: life#=100
the enemy hits you for 10 damage:life#=90
but maybe your life was lost already for a random value, and you want it to go down by ten now. You do not know how much life you have.
you will want it so that every time it hits, no matter what your life is, it will take you down 10.


life#=life#-10


that is how you do this.

please post if i'm not making sense.
Ace Of Spades
19
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 10th May 2005 12:09
No offense...but you may want to start off more organized...for instance, call a function with the text in it that prints it to screen. Will save alot of headaches, if you get deep into rpg making.

Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 10th May 2005 12:13
i wasn't gonna get into functions yet, but ok.

are you saying that all the text should be in a function like...
?
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 10th May 2005 12:47
continuing(we will get into functions later, remember the part we're on is a practice battle, my real game is much more complex).

your variables should include a level, beging whatever you want it to be,because i have something to teach you later based on it.

also, make xp.

4.level up



look up "restore" in the help files

you set the level to a local variable, mine is "i"

"i" is the number in the "data" that we are on, we must set up another variable as the value of the data. for me this is "v".
"for i=1 to 23" if your wondering what that is, you have the first "i" to the last "i", simple.

now you want it to read the value (remember i had this as "v")
read v

the data represents the amount of xp you need until you level up

you want xp to be greater than the value, as it will not always equal the exact "v".

then obviously, you level up.

mess around with what you can do when you level up, i have it set that your health goes to it's max limit, and it's max limit goes up by 2.(note that you have the max health before your health goes all the way up, because Darkbasic does everything sequecially).
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 10th May 2005 12:55
the battle...

do the same thing for enemy hp, enemy name and enemy damage.


i'll post more later.
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 10th May 2005 13:11
I think that he meant to have a function that can print any text to the proper screen location. In this way you would have a function and pass the text$ as a parameter. The functions job would then properly output the text. I'll put up a code sample tommorow.

=====

I would put all descriptions of areas in data statements or a file, this way if the person moves back to the location the description can be repeated. You would restore the data pointer to the label and then read in the text$.
eg.

forest1:
data "You are in an adeventurer loast in a forest."
data "You hear rustling leaves."
data "You get a bit nervous."

====

These type of games (like Sierra Adventures) work well with a token based parsing system. Where you extract say a "verb token" and an "object token" and ignore the rest of the text input, for a simple two word combination.

So, if the user types.
Take the magical wand

The command parser extracts the input buffer to:
Take wand


If the user types:
Wand magical awesome take blahh

This too would be be extracted to:
Take wand

Some commands can be one word like N for North

player types:
N

player could also type:
Go North


I don't want to step on your thread, but if you would like I can convert an example from some old sources on text adventure games I have.

Lastly, I would store all the different possible commands the user could type in data staements

verbtokens:
data "N",1,"S",2,"E",3,"W",4,"Go",5,"Take",6,"Get",7
data "Drop",8,"Inventory",9
etc...

objtokens:
data "wand","potion","sword"

~zen


Evarcha
19
Years of Service
User Offline
Joined: 7th Jan 2005
Location: Preston, England
Posted: 10th May 2005 18:08
Thanks time splitter23987 and zenassem (although I can't really understand all the token speak, yet anyway)
I have been wanting to make a text adventure, pretty much as basic as they come, I can build the usual text adventure but cannot introduce combat or possessions, because I still cannot get my head around variables and arrays. To say i am struggling is an understatement! I will be watching this thread very closely, hoping to pick any useful tips.

Thanks again
Evarcha
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 11th May 2005 09:14
the token speak means that in an input statement

this basically makes it so that the player can define a string, and type it in...

it can be very annoying to have to type something specific if you have a code like


so what he is saying is that there should just be some key words, so you can print anything, as long as it has those key words, the if/then statement will be played...

tell me if i'm wrong zenassem.

-timesplitter
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 11th May 2005 09:32
the battle part of the battle.

now we will get into functions.

make a function for the player damage,

and enemy damage

now how do we apply this to the battle?

we now have a continueing battle, here is how to stop it when an enemy dies or you die



put this just before the end of the loop.
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 11th May 2005 15:16 Edited at: 11th May 2005 15:21
now your not going to want to put all this down every time that you have a battle, instead, put it all in a function called battle.

"for i=" commands as a variable that you put before you put in the battle()

here is my battle function, study it for a moment...

fun stuff
there, stick to a story of your own and keep continuing, here is how to add many other things.

1.for multiple enemies, with your variable statements(just under your local variables)



2.magic



here is an example of a magic, i call lightpower, study it, and come up with your own idea's based upon it.


if you have any idea's, but don't know how to make them, or have any strange bugs and don't know what to do with them, post it here, i and many others will be willing to help you

Login to post a reply

Server time is: 2024-09-23 19:24:14
Your offset time is: 2024-09-23 19:24:14