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 / Storing Character Information in DBC

Author
Message
Ragnarok89
22
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 24th Feb 2005 04:50
Yeah I'm finally getting past all the EASY noobie stuff....might have been easier if I would have done Pacman or something. Went straight into 3D lol. But getting to the point, I am trying to figure out the best way to Edit and save character information. I havn't done any work with arrays or anything so I was wondering...is an array the best way to save character information such as...

Experience, health, Weapons, Armor, Etc...

or is there another way I can't think of. Someone please help

P.S. If arrays are the best way to go....can someone maybe write a tutorial about how to do it...I don't want the work done for me, just a nudge in the right direction.

Thanks in Advance,
Ragnarok
Monsieur Mort
21
Years of Service
User Offline
Joined: 12th Feb 2005
Location:
Posted: 24th Feb 2005 05:48
I'd say arrays were the best way of doing it, though I don't have much experience of all this. What you'd do is dim an array called characterStats, or charStat for short - say:

dim charStat#(10)

Where 10 is the number of different things you want to store information about, say 1 for experience, 1 for health etc..., and then you simply change the values of each using the normal commands, eg

if enemyHit() then charStat#(2)=charStat#(2)-10

to reduce the guys health.

You just have to be careful you remember which bit of the array stands for what. A big remark as you dim the array should deal with that, eg

remstart
charStat#(1) is the experience
charStat#(2) is the health
.
.
.
remend

The other problem is that sometimes you don't want to use numbers. For example with armour you might prefer to use the name of the armour - say Plate Metal +2 With Fiery Horns of Wrath. In that case you'd have to dim several arrays, one for each type of data you want to store.

remstart
charStat#(1) is the experience
charStat#(2) is the health
.
.
.
remend
dim charStat#(9)

rem charStat$(1) is the armour
dim charStat$(1)

Why do you sink I ave zees outRAGEOUS accente?!
Ragnarok89
22
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 24th Feb 2005 05:57
Ahhh ok...I wasn't sure about the DIM command. Oh well thanks for the help....after i finish designing the entire map around the Encampment I will start on that ...So much work to do....so little time.
Baggers
22
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 24th Feb 2005 06:36 Edited at: 24th Feb 2005 06:37
I myself have used Arrays for years but now use types along side them
take this for example



This also, as i said be used in arrays...say for enemies



Thats what im using more nowerdays just as i dont have to remember which part of my big array stored the health and which was armor etc...

Hope that spurs some ideas !
Good Luck
Monsieur Mort
21
Years of Service
User Offline
Joined: 12th Feb 2005
Location:
Posted: 24th Feb 2005 07:16
Baggers technique is much better when you're going to have more than one character of the same type, as happens in the case of enemies, or if you want to have groups in your RPG consisting of several characters. However there's no point defining a type if you're only going to have one instance of it, so if you only want to store information about the player character I'd recommend using an array for that.

Why do you sink I ave zees outRAGEOUS accente?!
Ragnarok89
22
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 24th Feb 2005 10:03
Lol I didn't understand his that well anyway....atleast I dont think I do. I may be taking it in wrong but o well. Just gotta figure out how to use arrays completely and I'll be set.

Thanks for the help.
Baggers
22
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 24th Feb 2005 21:53
Dont worry i doubt my explanation was that good !
Monsieur Mort
21
Years of Service
User Offline
Joined: 12th Feb 2005
Location:
Posted: 24th Feb 2005 22:44
Another neat trick I forgot to mention with arrays:

Instead of trying to remember what numbers mean what, and instead of leaving a big old rem above your dim line and having to refer to it whenever you forget, you can make variables with easy to remember names, and give them the values of the numbers you're trying to remember.

For example, say armour was the fifth item in your charStat$() array:

armour=5
dim charStat$(10)
charStat$(armour)="Chain Mail of the Black Lord +19"

You just have to make sure you don't try to use variables with those names for other purposes later.

Why do you sink I ave zees outRAGEOUS accente?!
Baggers
22
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 25th Feb 2005 00:15
Yeah, that is a good way of doing it.
Ragnarok89
22
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 25th Feb 2005 02:23
Alright I'll try that soon. Seems I'm having some trouble making the starting town for my game lol.

Login to post a reply

Server time is: 2026-07-26 15:29:47
Your offset time is: 2026-07-26 15:29:47