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.

DarkBASIC Discussion / Arrays and RPG Variables Question

Author
Message
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 24th Sep 2007 21:30
Hi all, some of you may have seen my thread on making a menu system for one of my games, well this is the battle system that I am currently working on. I have done small tests on the stats I have in and plays out well, however I will be including more than one enemy and one character battling at a time. Since DBC does not have user defined types I was thinking maybe I could put these into an array but I was unsure of how to do such a thing so off to the helpfiles I went but found out how to call, uncall, load and save an array, not really what I'm looking for. I just wanted to know if were possible as it sounds efficient to store my characters variables in an array I can call at any time. This is what I had in mind.



Then here is the rest of my code, just curious if this was a possibility.



If anyone can help me out with this question it would be greatly appreciated.

Zombie

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 24th Sep 2007 22:29 Edited at: 24th Sep 2007 22:30


so if you had 10 characters it would be



the array includes the value 0 so I did 0-9 instead of 1-10, but you can always ignore 0 if you find that easier.



I made this tutorial a while back showing the basics of arrays with more explanation but I'm not sure how useful it will be.

http://db1games.topcities.com/tuts/arrays.htm

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 24th Sep 2007 23:04
Demons Breath- Thank you very much, it is good to know that I at least had the right idea about it. Your code is nice and so thank you for posting it and your tutorial, I'll read through it and see if there is anything else there that may aid me. Once more, thank you again for your help, it is most appreciated.

Zombie

Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 25th Sep 2007 12:16
Just felt like updating so here's what I put in, I put the count down further becasue I couldn't think of ten reg characters right now, but soon I'll have more than enough.

Thank you again.



demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 25th Sep 2007 23:05
'sall good

and i read through the tutorial - it's not much use... so don't worry about that :p

http://jamesmason01.googlepages.com/index.htm
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 25th Sep 2007 23:12
@Demon

I like those variables makes everything easier to understand (and remember)

In programming, nothing exists
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 25th Sep 2007 23:22
I'm just amazing like that [sarcasm]


I was just trying to think of an easy way to explain it. But then I thought "hey that's actually not a bad idea - I might use that myself in future"

http://jamesmason01.googlepages.com/index.htm
Not_Maindric
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 26th Sep 2007 00:27
That was something that I was thinking of doing for RPG's, I am not that good with arrays, but I was thinking of something for less typing, making it faster to type, instead of using:



I would personally do:



As is the B meaning Battle, or a simple letter like that, making it easier and faster to type, becouse it may also be used for monsters, different arrays though, maybe. But, that is me.

Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 26th Sep 2007 14:21
Okay here is a really funny question haha..say I wanna call on one of the characters, how would I go about calling out say char1 to go against ene1 to put their stats against one another. In my other system i had it going pretty easy but now I'm a tad confused, okay a lot confused. Code follows , thanks again demons breath.



Many thanks,

Zomb

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 26th Sep 2007 15:46
Hmm... depends how your actual fights are. Turn-based?


That's just how you could check the first character to attack. I don't know how you are planning to implement the code.

But then I would use the agility check to see if you hit them



You'll have to decide how the variables will be used exactly, and how you'll include defense - I was just going to add that to the enemy HP, but that would mean that if the attack was bad then their health would go up.

Also, I changed the Ene(x,x) & Char(x,x) arrays to floats by putting the # sign in - you'd have to include that when you were creating the arrays as well - but it would give you more flexibility with health.

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 26th Sep 2007 16:40
woooo there's some good 'ol math haha.

Okay in all seriousness, the battles were being figured to be turn-based since I haven't a clue about timers to make it ATB. Let me pull up my old code again so you can see how easy it was to call a battle.



So see my variables BattleInit would decide the initiave of who would attack first and then I'd start the fight for just testing purposes by calling Batttle2 for the character attacking. But in the end, this is terribly inefficient and only works for one fight so that wouldn't work too well.

Your code is very readable and I'm sure I can place the variables correctly. I never really knew the position of floats in an rpg game setting but I knew from reading other posts that they do play an important role in figuring out stats. I suppose what intially confused me was from the usage of the array and not being able to figure out how to call it.

I appreciate you being so kind and sharing your information and putting up with my constant questions. But..I suppose we all had to start somewhere right?




Quote: "but that would mean that if the attack was bad then their health would go up.

"


You just gave me a great idea for a boss idea later in the game.

Many thanks again, of course I don't mind just discussing rpg game elements, they are quite intriguing.

Zomb

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 26th Sep 2007 17:53
I think instead of having an attack variable, it would be cool if it depended on what weapon you had equipped, or at least what weapon type. Just an idea though.

And the only advantage of floats is that you can have more complicated numbers, otherwise (I think) it would just round everything to integers.


your original battle looks a little tricky... their stats were better than yours...



and good luck with the whole project... you need any more help I'll be more than willing to answer questions 'cos I spent way too long just asking for help on these forums and I much prefer giving advice so I can feel high and mighty

seriously though good luck - I could never start on a project this size - no attention span. I would make probably half of the battle engine in a very basic way and then get bored. I'm trying to keep my focus on a little boat game at the moment for the last DBC forum challenge which I'm trying to improve but I keep wanting to start working on the new challenge instead. I have about zero focus and slightly less willpower

http://jamesmason01.googlepages.com/index.htm
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Sep 2007 18:42
is this going to be a Final Fantasy type RPG?

When doing battles etc remember to include a random element or it will end up being like top trumps
If you want to activate random battles as the player moves, link the "random battle generator" in with the keys, not how much the player is moving. It's much easier
Also try using key inputs like variables, you'll find you can do a lot of things more easily and treat them like normal maths

I think the rnd(10)*.1 would generate a battle 1 in 10 times?
Can I get confirmation on that?
oh no it would be 1 in 11, that's annoying. Probably (rnd(9)+1)*.1 would be better then

@Demon
Quote: "I have about zero focus and slightly less willpower"

so you are convincing yourself not to do it?

In programming, nothing exists
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 26th Sep 2007 19:46
Quote: "I think instead of having an attack variable, it would be cool if it depended on what weapon you had equipped, or at least what weapon type. Just an idea though."


I think that would be pretty neat to see in action, and then depending on the other equips you have on and the character that has the weapon, certain effects could occur.

Quote: "your original battle looks a little tricky... their stats were better than yours..."


Well I'm waiting on my friend to finish up the races and people that will appear in the game but as far as their stats being a bit better, some fights are just going to be tougher than others, make ya really utilize what you have.

Quote: "seriously though good luck - I could never start on a project this size - no attention span."


Join the club hahaha, have adhd..needless to say it is very hard for me to concentrate when you couple that with an already spastic attitude. However, when it comes to games and a few other people that I know, I can snap to attention and get stuff done, plus when I'm coding I put on my playlist which makes it sooo much easier.


Quote: "is this going to be a Final Fantasy type RPG?"


As of now movement will be implemented through a menu system and a picture of where you are it will update or loop depending on where you are and which direction you choose. This originally started out as a text adv but has quickly gone graphical..at this rate I've told my good friend and other team member we may end making this a 2d game. As far as FF elements go, you will see influence from it, long ass story *written by my team member and good friend*, epic adventures, a large cast of characters, magic spells, excellent side quests, fierce battles *this much I promise* and a set of skills to mix and match between parties, finally forging new items and armor. So yea, it's gonna be a bit like FF .

Quote: "When doing battles etc remember to include a random element or it will end up being like top trumps "


But of course obese, however I don't want it to be like every freaking five steps a battle, that would just annoy the sh*t out of me.

Expect some very unique boss fights, I want you two to be some of my testers if its okay, but thats at least six months off.

Zomb

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Sep 2007 20:04
I'll test it
I would like to see a strategy element to it, not just clicking attack every time.
Maybe some enemies would have weak spots you could exploit or you could set a trap for them or something

In programming, nothing exists
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 26th Sep 2007 20:11 Edited at: 26th Sep 2007 20:46
That does sound pretty neat, we'll see what happens eh? haha

I would like the different party members to not have just a 'slash'

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 27th Sep 2007 10:29
yeah i'll test it... sounds cool mate


that whole team member idea sounds like it's a good'n too. Maybe I should make some friends

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 27th Sep 2007 13:46 Edited at: 27th Sep 2007 14:08
To Obese and Demon's Breath- Thanks guys, I'm working with demons breaths battle code right now and I can say that its going to be very fun writing this battle engine, its a big undertaking for me .

All I have to say is the character that gets assigned Char# 2 stats are gonna be able to hit a lot before the enemy can touch them.



Haven't missed yet, char 2's agility is top notch and therfore makes him/her a valuable asset, gee it would be so mean of me to not start that character in the original party hahha.


Just ran a small battle test, this new system is going to be nice, thank you guys very very much. Here's the little code I wrote for the fight, battles are going to be right around that ff element as far as dmg goes.



Now this defense is being assumed that a type of armor or covering is already being worn, without it def would drop to 0 and they would have to take all 12 dmg which at this level would kill them.

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 27th Sep 2007 18:35
what's up with your indenting by the way man? I've noticed it before... it's a bit weird...

but yeah the defense thing looks like it'll work... i didn't think of that... i didn't have a clue how to factor it in...

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 27th Sep 2007 18:47
Hahahaha just the way I indent, my code is still readable right?

Yay look I figured something out hahaha, its all going to come along nicely.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Sep 2007 18:57
Quote: "my code is still readable right?"


Only just though! It still looks cack...

Normal indentation:



TDK_Man

Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 27th Sep 2007 19:00
Quote: "Only just though! It still looks cack...

"


Well its something I can work on then and I will.

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 27th Sep 2007 19:40
Quote: "Well written code is indented into levels. When you use a command that consumes more than one line, you must indent the code within the opening and closing statements so that it is easy to see where one command ends and the next begins."

That's from my structure tutorial

In programming, nothing exists
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 8th Oct 2007 10:38
Hello everyone, I've stumbled across an interesting problem here, I found a great piece of code for roll over text in a menu system of conversation, and it all fits nicely except..the screen is now flashing. I have sync set up and its in the loop so maybe I'm missing something, do I need to modify anything else in this code, I can't imagine what I would have to do but I'll mess around with it as I post this..any help would be appreciated.



Zombie

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 8th Oct 2007 19:16
why have you posted this here but created a new topic for it as well?

you should know better than that by now

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 8th Oct 2007 19:50 Edited at: 8th Oct 2007 19:59
Yea I do, I had thought that I should just make a new topic about it, but I kinda regret that. We all do dumb things when we want help sometimes right?

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 8th Oct 2007 23:10
well it works fine for me anyway. I had to comment out the picture line obviously, but apart from that I just put the code in as it is here.

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 8th Oct 2007 23:23
Demon's Breath

Alrighty thanks much, so maybe it has something to do with my image, I'll check that tonight when I can get back on the comp that isnt a mac . Thanks for the help mate.

Zombie

Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 10th Oct 2007 13:08 Edited at: 10th Oct 2007 13:39
Zombie did it! Woot, I figured it out, yay!!!!!!


Zombie

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 10th Oct 2007 14:59
... what was wrong?

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 10th Oct 2007 18:44
Part of the text wouldn't click and it was driving me nuts because it should have been working and it was my variables I had set up, but now we're doing good .

Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 12th Oct 2007 20:01
Update!

Because I'm so proud of myself for doing what you can all probably do in your sleep, I'm still going to share it with you. I have the start of a converation engine, though it will be quite lenghty in the end I think it will work out. One problem I have is that sometimes the text is reacting to another command written in, but its only with the images and I don't really count on having that for the conversations yet..so other than that it has been a huge success, I plan to do voiceovers to help capture the mood.



Zombie

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 12th Oct 2007 20:50
nowt wrong with being proud with what you've done mate


but it looks like it might take quite a lot of space in your programme eventually... Is there not a more efficient way of doing it? possibly have string arrays which store the entire conversations with each character or something... I don't know the best way to do it but you don't want your entire programme to be clogged up with just strings.

http://jamesmason01.googlepages.com/index.htm
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 13th Oct 2007 19:46
I was looking at the code and said 'damn that is really innefficent', but hadn't thought of arrays, thanks bud .

Well I'll be taking a break as the weekend comes up here as I have a party to attend, may just do a little bit touch up work on my menu, have a good one guys .

Zombie

Login to post a reply

Server time is: 2025-05-31 21:17:16
Your offset time is: 2025-05-31 21:17:16