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 / Coding Error in Monster Hunt (Noob question)

Author
Message
HypaSnipa
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 9th Jun 2008 19:10


That code is the Monster hunt is a finished product of the Monster hunt tutorial as followed from beginning to end.

I\'m VERY new to coding and I figured it would be cool to add either a second/third monster or a crosshair, or something of that nature.

But when I add a VERY simple crosshair code (Bolded in my code snippet) it begins to create errors everywhere else in the code, such as the radar bitmap not existing or loops telling me tha tthe objects don\'t exist.

What am I doing wrong??
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 10th Jun 2008 01:18
you were nearly there, if you look below you will see that you have numberd the object as 31, however the object number for lock object is a 1, unless its a posting error it should be 31.

` Make Gun
Load image \"crosshair.gif\",31
Position object 31,0,0,15
lock object on 1


Dark Physics makes any hot drink go cold.
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 10th Jun 2008 08:03
Change this.

HypaSnipa
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 10th Jun 2008 17:17
Thank you both for the help. I did try the lock object 1 at first but tried other things and I guess that was what the code was when I got fed up and decided to post here.

I also changed the randomize matrix to include update matrix 1

That didn't fix the problem. The randomize matrix still allowed my code to run fine, great! However, if I try to add that crosshair, I will get an error at Line 50 telling me that the object doesn't exist, but if I don't add any extra "create" codes, then the game runs fine.

` Setup sync
Sync On
Sync Rate 30
Draw to front
Backdrop on
Set camera range 1,3000
Autocam off
Hide mouse

Fog on
Fog distance 3000
Fog color RGB(128,128,128)
Color Backdrop RGB(128,128,128)

` make matrix
Make matrix 1,10000,10000,20,20

` texture matrix
Load image "grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1

` Make Gun
Load image "crosshair.gif",31
Position object 31,0,0,15
lock object on 1

Make object cylinder 1,2
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,500
position object 1,0,-7,15
Lock object on 1

` make HUD
Make object Plain 200,1,1
position object 200,-2.7,1.9,4
Lock object on 200
ghost object on 200

Make object Plain 201,1,1
position object 201,2.7,1.9,4
Lock object on 201
ghost object on 201
Load image "score.bmp",201
Texture object 201,201

` Load and create hud bitmaps.
Load Bitmap "Radar.bmp",2
Create Bitmap 1,50,50


The bolded line above is where I get the first error, and after removing it, I will get an error on the loop line of my main loop also telling me that the object does not exist.
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 11th Jun 2008 06:16
Try this

HypaSnipa
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 11th Jun 2008 18:41
Thanks, that did work. So basically you made a plan where the crosshair needed to be and then textured it with the goblin bitmap?

Hmm, I still don't understand why my method didn't work. But thanks again
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 12th Jun 2008 02:24 Edited at: 12th Jun 2008 02:25
Your method didn't work because an image is not an object. An image can be used as a texture which can then be applied to an object, but the image itself is not an object. So, when you load an image with image number 31 and then tell it to position object 31 someplace, it can't because you never made an object with number 31. You only loaded an image with number 31. Making an object would involve one of the MAKE OBJECT commands (Make Object box, Make Object cube, etc.) or LOAD OBJECT. (There are others but they may be a bit more complex...)

Bottom Line: Objects and images are separate

Hope this helped

Login to post a reply

Server time is: 2024-09-27 16:24:47
Your offset time is: 2024-09-27 16:24:47