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 / strange rpg problem

Author
Message
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 6th May 2005 16:42
Lightpower = 0 when you get to the light_power() function. The reason is here.


Take it step by step:
1) Assume "1" was entered.
2) If side$="1" : This is true, so move on to the next step.
3) goto pure : move the program control to the label "pure"
4) The next step after "pure:" is "Do".

As you see lightpower=50 and darkpower=0 never get executed because of the goto before them. Move the goto to after those 2 lines and it should work fine.

Try this technique to debug your code. There are other problems.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 7th May 2005 16:47
it was working, and now it's not...

sorry to give you the whole thing, i know it's a lot of lines, but there is also problems with the battle and many other things, like at the part where i want you to press up, you can press any key to continue...

what am I doing wrong?
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th May 2005 03:36
The problem is every place there is something like this:

Same problem as two posts up. Same solution. Just need to apply it every where you use Inkey$(), Leftkey(), Upkey(), etc.

Do not use that change for Input statements. If you have a Wait Key after an Input statement, it's redundent and should simply be deleted.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 10th May 2005 11:39 Edited at: 10th May 2005 11:48


games going along pretty well.

i have learned a whole lot from this, thanks RiiDii,Ruccuss(for the small amount you helped in).

now, should I write a tutorial on this?

two last(hopefully, if i want to write a tutorial) problems.

1.lightpower only goes up to the first attack, then stops.

2.in the battle, it constantly repeats "enemy hp=0"
2a. why 0?
2b.why does it continually repeat going down the screen over and over and over...???

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 11th May 2005 15:28
1) Take a look at your "turn" variable. Each player action (player_hit(), dodge(), and light_powers() ) requires it to be = 1. But then each player action sets turn to 2. You don't call an enemy action, which should also set turn back to 1.

2) Take a look at that value that you are printing each loop: ehp. Then take a look at the values that you use to track the enemy hitpoints: ehp(i). To DBPro, these are as different as night and day.

As far as the tutorial goes, I think you still have a ways to go. But I also think that writing a tutorial will help you think through a program step by step - which will help teach you more about writing code than any person could. So - I say go for it.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 11th May 2005 15:31 Edited at: 11th May 2005 15:37
oh, i've already written it under "RPG Tutorial"

you must not have noticed, but i have the enemy action under the dodge() function

where do i have ehp(without i), where it would mess this up?
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 12th May 2005 03:54
Quote: "print "enemy hp=",ehp"


About 16 lines up from the bottom.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 12th May 2005 09:11 Edited at: 12th May 2005 09:26
ok,

1.is there a way to save progress in a game?

2. I have a problem with lightpower, when it was working, it doesn't go past the first attack? why ?
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 12th May 2005 12:00
1) Yes there is. I suggest you hold off on this for now as any suggestions will seem very irrelevent to the game as it stands right now (basically, you have an introduction so far. Don't get me wrong, it's a good start and you are definately making headway.) For any suggestions on saving the game to be meaningful, the game needs to really be at least capable of several encounters past the introduction. I'll be more than happy to help with that when you get to that point. If you want a head start though, read through some of the file commands. Try some simple code, not part of the game, like saving a few variables to a file, and then reading them from that file. This would be the minimum skills to start even thinking about saving a game.

2) Sorry about missing the Dodge() function being the enemy attack. I'm not sure what you are seeing, but here's a first-guess (let me know and we can dig deeper):
Your loop is as follows:

Player_Hit()
Dodge() `Enemy attack
Light_Powers()


This means the order of events is Player, Enemy, Light_Power, Player, Enemy, Light_Power.
Either a Player_Hit must follow light power or a Dodge, depending on how you handle the Turn variable now. From the last post, it looks like the player must attack (Player_Hit()) before the Dodge() function occurs.

Also, I noticed these lines in that same loop:

if ehp(i)>1
xp=xp+ehp(i)
exit
endif


If we assume that an enemy starts off with more than 1 hitpoint, and enemy is not killed in the first round of the loop (i.e. Hitpoints is less than 2), then the commands in this If group will be executed, meaning the code will exit the loop, which goes on to end the function (leading to your "only once" issue). I suspect your ">" should be a "<" .

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 12th May 2005 12:21
after that lightpower part in the turorial (the part i have all the problems with),

you press shiftkey, it prints the first attack.
press anything else, it shows a blank screen.
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 13th May 2005 00:08 Edited at: 13th May 2005 00:08
What happens when it gets to this line

if magic<25 then exitfunction

in your light_powers() function? What value is in that variable?

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 14th May 2005 01:39
ok, i finally got my lightpowers to work perfectly
I also fixed quite a bit of other problems too


now i have a few problems with the battle.

1.enemy never attacks me
2.way after i've done 20 damage, he still is not dead, and the game doesn't move on.
3.I can only attack, and not use lightpowers.
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 21st May 2005 04:32
here is my current code


above problems remain unfixed

the z$ thing doesn't work, but don't worry about that, I know how to fix it, I just haven't gotten to it yet.
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 23rd May 2005 09:58 Edited at: 23rd May 2005 10:04
Here's why I showed you how to do functions - the real power behind functions. You can take them out and test them individually. Something like this:



Another thing you absolutely need when doing an rpg adventure game is your pre-work. I don't know if you have done this or not, but if you haven't - then you really need to do this before going any further. Design your combat system. What do the stats mean? How will they affect combat? What formulas will you be using to calculate a hit, a miss, magic, dodging, etc.? Be as complete as you can be. The descriptions can be a little abbreviated, but the more you explain, the more you will rememebr what you were trying to do later on, and the more others can tell what you are trying to accomplish.

Be as complete as possible. And post it. Include it as rem statements in your code. It will help others to help you, and it will help you directly as well.

Edit: Also, once you have narrowed down your problem to a specific function, that's all you need to post. I've been willing to read through your entire code because I understand where you are coming from (and I actually enjoy debugging code). But as you go along and ask for help, most people won't do all that extra work for you.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 27th May 2005 13:51
ok, problem is in the timer.I finally got it to print, and it went up. I need it to go down, and it'll at least fix my "enemy never hits me problem", and hopefully some other problems also.

my question: How can I make it so that the timer goes down, if there is even a way at all?

p.s. got rid of the print timer thing, proved to be quite annoying

-Timesplitter-
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 5th Jun 2005 14:45
Im guessing there isn't. I'm just going to take out all the timer stuff, not good for a text rpg.


i've been looking over that tutorial you showed me earlier. I'm now adding to it. Here's what I have so far.


well...

there are two problems
1. can't shoot
2. where is my cylinder

I can probably figure these out on my own, I basically put this to show how far your code can go(or a basic idea of such).

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
WarGoat
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location: Montreal
Posted: 6th Jun 2005 00:19
maybe your cylinder isn't big enough

Windows XP,pentium IIII, 1,9 MGZ, 256 mb memory, 128 mb video card ATI Radeon 9200 se s80 'sett squadron back on the assault'
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 6th Jun 2005 10:17
no, I don't think that's the problem. I tried every number from 1 to 25(excluding decimal points).

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
WarGoat
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location: Montreal
Posted: 6th Jun 2005 10:41
Maybe you could try to put your lock on object 1000 outside of you do loop or delete the position object part.

Windows XP,pentium IIII, 1,9 MGZ, 256 mb memory, 128 mb video card ATI Radeon 9200 se s80 'sett squadron back on the assault'
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 6th Jun 2005 14:20
nope, tried both of them in every posible combination (both off, 1 on 1 off...)
But that's ok, ill figurre it out eventually.

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
WarGoat
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location: Montreal
Posted: 6th Jun 2005 23:05
okee dokee

Windows XP,pentium IIII, 1,9 MGZ, 256 mb memory, 128 mb video card ATI Radeon 9200 se s80 'sett squadron back on the assault'
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 7th Jun 2005 08:28
Here you go. Mostly needed to make your gun stats global variables. Also made few adjustments so the cylinder would show.



"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 7th Jun 2005 13:48
it works
uh, no question, but heres my code now.

I'm using a formula that makes you make sounds without media, eventually, I hope to understand a word of it...

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 9th Jun 2005 14:19
It get's confused when I put gun=guna.
"cannot cast string fs@change_gun@guna..."
What the heck does that one mean.


I posted the whole thing becuase I added a bunch.

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 9th Jun 2005 15:20
That's one of DBPro's unfriendly error messages. Basically, you have guna, which is an integer variable and gun which is a string variable, and they don't like each other very much. You have to either declare guna as a string or simply make it guna$. Then the two variables will get along fine.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 11th Jun 2005 14:24
O.K. I got rid of the bug, but it didn't work when I dimed it

instead, it only worked when I globaled it.
Do you know why this is.

Also: here is my function change_gun()

it says that object already exists at make object cube difgun,.5

The problem is not the fact that functions repeat themselves otherwise, this wouldn't work

(also I already tried it)

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 12th Jun 2005 06:56
Quote: "it says that object already exists at make object cube difgun,.5"


It is because this line (below) is looping twice - and each time, difgun is the same value. Since it's the same value, it's trying to make the same object, which is your error.

Quote: "for gune=1 to 2"


"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
the fake Mr T
19
Years of Service
User Offline
Joined: 6th Jun 2005
Location:
Posted: 14th Jun 2005 19:46
use
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 16th Jun 2005 13:55 Edited at: 16th Jun 2005 14:25

I finally got my battle function to work (the one in the text rpg)
I actually died, im going to have to make my level higher.

Im not sure what you mean by "it is the same value"

Oh, and thanks the fake mr T, I haven't tried it yet, but i will in a second(after I finish writing this)

my rpg code(kinda wrote a tutorial for myself)



edit:
oh, wait, I can die but the enemy can't. Don't copy this ode until I fix it.

edit2:I just figured out that the problem is that im not actually hurting him. It also doesn't do anything after I'm hit him the first time.

I posted what I have, but it doesn't work yet

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 18th Jun 2005 06:09
Randomness of Attack
rnd(5) that would pick a number at random from 0 to 5.
I'm sorry if this don't help.

DarkBasic Classic Owner
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 20th Jun 2005 12:46
Yeah, but I knew that I was hurting him, it printed that I did an amount of damage to him.

And he does damage to me now, but it doesn't work. After I attack, it stops.

posted all of the functions and data


-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 24th Jun 2005 08:47 Edited at: 24th Jun 2005 16:57
This one is better but I'm completely lost with it.
Mainly becuase I can't figure out how to use mltiple enemies.

I'm doing it a different way (no restore _Stuff())

edit: I wasn't very specific with that question
How do I get it so that When I kill an enemy it switches, and when I kill both of them the game ends...

edit2: Also, every time I hit, It restores its health to it's original amount. I suspect that this may be thje problem with my other code too.

edit3: After a whole bunch of debugging, I arrived at a point where I can kill one enemy and then it says that target destroyed, next target, battle ended and does nothing thereafter.

edit4: here's my new code


-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 27th Jun 2005 16:48 Edited at: 29th Jun 2005 03:01
I Think I may have figured it out.


I think it may just be a problem with my computer, but its not showing me anything. It starts the program, then exits it.

if it is just my computer than enjoy the code

if its a problem with the game, someone please tell me what the problem is.

(also, if this isn't working for you, please post)


edit: Nevermind, there are a ton of bugs in this post, i fixed most, but now i still have one big bug, you can expect to see my code in the code snippetts soon though.

edit1:code updated. The Bug's problem is in the e_hit() function.

specifics:for some reason, I think it is disobeying the "If Brandonhp<1" and continues anyway. I Chacked to makesure it wasn't a spelling mistake and there wasn't.



-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 29th Jun 2005 14:08 Edited at: 30th Jun 2005 07:16
(laughs at myself) You've told me this too many time before RiiDii.

I die becuase brandonhp<1 because lvl and cont=0 becuase the stats that make my level are below the global brandonlvl.

I also have a big problem(not a bug), will get back to it.

______________________________________________________________________

anyway I just don't get how to do the multiple enemies thing, switching the target mainly. Any help would be apreciated. leftkey just starts the battle over and.................................


here's the functions that have anything to do with the battle()



again, any help would be greatly apreciated.

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 30th Jun 2005 17:32
Hey TimeSplitter,
here's a sort of tutorial I put together a while ago based on your original game. Take a look through it. There is a function called Switch_Enemies that might give you some ideas. I've added a lot of comments to help you along your way. You clearly understand enough now that this tutorial is no longer a spoiler. It is by no means complete, although it is playable. I'd suggest reading through it to get an understanding of what's going on. Then modify it and add on to it to validate your understanding (for example, add in healing, or running away).

Notice that the main loop is small and clear. Then all the actual actions and events are broken down into functions. Also note that everything is well documented with remarks (not only for tutorial purposes). Remarks will help you remember what you were trying to do with a segment of code, and will help anyone trying to help you as well.

Feel free to use the functions or anything else in there for your games.



Please continue to post your progress. I know I'm not always responding, but I do read this post from time-to-time to make sure you are well on your way.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 17th Jul 2005 11:43 Edited at: 17th Jul 2005 11:55
Sorry it's been so long since I've posted,I haven't been working on the text rpg.

anyway, I've started an actuall rpg.


I just started it today so it's not exactly good yet.

Also, problems that I may(will) experience will probably be posted in the darkbasic professional forum.

(If anyone reading this thinks that I'm not ready to start this,stop me before i get too far into it).


______________________________________________________________________


My matrix is acting very strangly(is that even my matrix flying by?)

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 18th Jul 2005 05:45
Nice work TS

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 19th Jul 2005 09:13
Quote: "If anyone reading this thinks that I'm not ready to start this,stop me before i get too far into it"


TS, I want to encourage you to go forward - but I do think you are getting a little ahead of yourself. Try something like a 3D Pac-Man game first. The rules and scoring are simple. The 3D graphics are easy. And most importantly; the AI routines for the enemies (the ghosts) are simple. It may not seem a like a role-playing game, but trust me, if you can't get a Pac Man to eat dots, you will have a lot more trouble getting a knight to swing a sword and hit an opponant. If you have troubles getting the ghosts to chase a Pac Man, then your RPG enemies will be 10x more difficult to code. And if you find a simple maze difficult to code for collision, a forest or a cave would be insane.


Good luck.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II

Login to post a reply

Server time is: 2024-11-27 22:26:11
Your offset time is: 2024-11-27 22:26:11