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 / Having trouble deleting monsters...

Author
Message
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 21st Jun 2004 05:59
Okay, I am hoping to make a *small* RPG game. Here is the code:


It's quite lengthy, but most of it doesn't apply in this case.

Here is the combat function:


The only thing needed in there is:


The movement code is:



Basically, I have a grid system. When a monster is destroyed, the game takes the monsters coordinated on the grid and puts a black square over the monster to delete it. Then it updates the grid so that it knows that there is no monster there. The only problem is that according to the grid, there still is a monster there!

Although I know I will get no replies because of the length of my code, any help would still be much appreciated.

Thank you.

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 21st Jun 2004 07:22
I'm not sure what you're doing here in the code because it appears to reference the grid array indirectly, but I'd make the suggestion that the monster position is not matching with that location as given the deletemonster routine. There are many places where you seem to "approximate" the monster position both inside the monster array and in the grid array, and I'm guessing the two values aren't "lining up" to match.

(And what is pp() for? Very confusing...)

My suggestion; add in a few print statements to see what values are being passed, and what's contained in the arrays at those locations.

S.

Any truly great code should be indisguishable from magic.
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 21st Jun 2004 07:38
@Ocean Runner,

I don't have the time to go thorugh the code tonight but I will have a look tomorrow. People will help even if there's a lot of code. At least we know the person is trying to accomplish something.

Just from a quick glance at the beginning, I have a suggestion:
The method you are using (cross-linking the arrays eg. Monstername$()->Monsters(): is really making things harder to manage for you)

note:If your using DBC, using Darkedit as an editor will allow you to have user-defined types.

I understand the thought process in doing this.
-You want to use arrays (good):
-Arrays can only have things of the same type (True):
-So since my monster name is a $, and my values are ints, I need to link two arrays (Not necessarily):

Reason:
You should create your own user defined type.
Then create an array of those types.
The user defined-type can have different built-in types strings,ints; it can also have another user defined type as a type.

If you are unsure about user defined types I'll porvide you a better explanation and code example tomorrow.

~Zen


Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 22nd Jun 2004 06:25 Edited at: 22nd Jun 2004 07:03
@SandraD

Sorry. I tend to abvreviate things. pp() is player position.
This is the code for defining the grid:


@zenassem
Yes, I use DBC with DarkEdit. (How could people who made such a great programming language design such a bad interface?)

I have never heard of user defined types, but other than that understand what you are saying.

EDIT:
Updated the code:


What I Changed:
*It won't say that you have collided with the monster until you actually have.
*Changed the deletion code so that it doesn't modify the positions to get monster coordinates.

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 24th Jun 2004 02:53
Please some help?
-Thanks, ocean runner

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Jun 2004 04:25
have you tried using the dbp debugger, or the Variable Watcher in our plugin, to follow your vars and see why the problem is occurring?

you can get our plugin by clicking the logo below
Requires the .Net Framework 1.1


* DBP_NETLIB_v1.4 - w/VARIABLE WATCHER & CONSOLE! * Click Logo
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 24th Jun 2004 05:13
@cattleRustler::How could he do that if he use a DBP debugger if he's using DBC??

Got anime?
I do.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Jun 2004 05:34
thats a good question!




* DBP_NETLIB_v1.4 - w/VARIABLE WATCHER & CONSOLE! * Click Logo
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 24th Jun 2004 07:38
Modified the code a little:


Changed it so that if a little time passes than the character moves again.

Thanks CattleRustler, for your time.

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 26th Jun 2004 23:35
Please? Someone?

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 5th Jul 2004 13:53
Anyone?

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 6th Jul 2004 03:51 Edited at: 6th Jul 2004 03:54
Hi again Ocean Runner...

I've taken a little more time to look over your code and have made a few mental notes. First up, in your two-step code, you have the following;



My question here is -- ARE YOUR REALLY SURE about the +50 in line 4 there? Reason I ask is, your one-step code does the following;



Which at least follows the logic to the rest of the code. Change the plus to minus.

And now, ABOUT DELETING MONSTERS. I Think I found your problem...

It a matter of what I like to term "phasing," or in other words, you're not updating your variables in the correct order. What I mean is, your main loop looks likes this;



Now here is the problem -- FROM WHERE are you calling monstercombat()? I'll tell you -- you call if from MOVEMENT().

BUT -- the position array of PP() HAS NOT BEEN UPDATED for the movement at that point, so it's lagging behind the player's position. Thus when you call the deletemonster routine from inside monstercombat using these values, they are incorrect. You should probably update that data inside the movement() routine itself, would save ya headaches...

good luck,
S.

Any truly great code should be indisguishable from magic.
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 7th Jul 2004 06:58
Yes! Thank you everyone, especially SandraD for all the help you've given me. I have been able to fix this problem.

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 8th Jul 2004 02:59
Outstanding! Glad to be of help!
S.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2024-11-27 00:42:13
Your offset time is: 2024-11-27 00:42:13