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.

Author
Message
Silence
12
Years of Service
User Offline
Joined: 14th Oct 2012
Location:
Posted: 19th Nov 2012 06:36 Edited at: 19th Nov 2012 07:39
Since I'm still new to DBPro there is a question I would appreciate if someone could help me out with.

So I have this



It just keeps telling me the object doesnt exists but I dont understand why.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Nov 2012 19:43
Isn't it obvious? You're using an object ID that doesn't exist!

The first IF statement checks collision for objects 1 through 100. If there is a collision, it creates object 101. But what if you haven't hit anything yet? That last IF statement checking collision with objects 1 through 101 is still being called, yet 101 doesn't exist.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Ramon156
13
Years of Service
User Offline
Joined: 13th Jul 2011
Location: Netherlands
Posted: 19th Nov 2012 21:34 Edited at: 19th Nov 2012 21:36
What Phaelax said ^

Here is some code, that uses types arrays and a global variable to control your object IDs (The numbers) and eventually will make programming allot easier.

Keep in mind that you can't remember all of the object names in your entire program.
Try to use variables to not get confused by all the numbers.

If all is too confusing, just use the "Number_Of_Objects" variable as a global integer. And every time you create an object, increase the global Number Of Objects variable by typing :

Inc Number_Of_Objects

And then set your object number variable to be this number.

My_Object = Number_Of_Objects

Also an addition :

If you're putting your code in a loop it will probably try to create the box a couple of 100 times a second. But the object number would be already in use, giving you errors.


Silence
12
Years of Service
User Offline
Joined: 14th Oct 2012
Location:
Posted: 19th Nov 2012 21:53
Okay so here is the problem. Everything works fine without the collision box. I changed the ID several times and made sure they didnt exist. But when I turn on the collision it says the object already exists.
Mr909
12
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 20th Nov 2012 01:42
Once more, you're creating the object twice. Give Ramon's code a try.
Silence
12
Years of Service
User Offline
Joined: 14th Oct 2012
Location:
Posted: 26th Nov 2012 16:12 Edited at: 26th Nov 2012 21:38
OLT

Please forgive everything I said. I fixed it. I'm just so dense I cant see the answer right in front of me.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 27th Nov 2012 21:19
Quote: "I'm just so dense I cant see the answer right in front of me."


We all overlook things from time to time. Don't be too hard on yourself. It's the obvious things we most often miss.

RP Functions Library v1.0

My signature has not been erased by a mod.
Silence
12
Years of Service
User Offline
Joined: 14th Oct 2012
Location:
Posted: 28th Nov 2012 02:38
Thanks nonZero. ;w;

Login to post a reply

Server time is: 2024-11-21 18:19:32
Your offset time is: 2024-11-21 18:19:32