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.

Dark GDK / Enemys don't come to me

Author
Message
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 16th Nov 2008 21:05
Hi,
I can't find a method to make enemies going to me and attack me.
Here the code I'm using right now (read comments):


Do you have any ideas?
Regards
MES

http://www.Computer-Masters.de
Venge
18
Years of Service
User Offline
Joined: 13th Sep 2006
Location: Iowa
Posted: 16th Nov 2008 22:01
You need to actually move the model using dbMoveObject after you call dbPointObject. What you have now loops the model's animation and points it at the camera, but it doesn't actually move anywhere.

I have CDO. It's like OCD, but the letters are in alphabetical order, like they should be.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 17th Nov 2008 01:11
'dbSetObjectSpeed' doesn't do what you think it does. I'm almost certain it's used to adjust the frame rate of the animation of the object. Nothing to do with actually adjusting it's position.


My site, for various stuff that I make.
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 17th Nov 2008 21:01
Hi,
I know what dbSetObjectSpeed does. It controls the speed of the animation. My walking animation is from key 0 to 5.

@Venge I tried it like this now:

But I get a horrible result:
The enemy (a spider) is in the air and when I turn around and walk it flies in a circle around me.
Then it goes away from me (because dbMoveObject ( 1000, 1 ); is set) and it disappers and appears again.

I don't have any idea how to make this work. Is there another possibility to make an object moving to the current camera position? Or did I make a very stupid mistake in my code?

Thanks for your help so far
Regards
MES

http://www.Computer-Masters.de
Venge
18
Years of Service
User Offline
Joined: 13th Sep 2006
Location: Iowa
Posted: 17th Nov 2008 21:47
I'm not sure what you mean by "it disappears and appears again"...?

Try commenting out the two lines dealing with the animation (dbLoopObject and dbSetObjectSpeed) and see if that affects its movement. If so, it's a problem with your animation. If that doesn't work, make sure the object was oriented correctly when you point it at the camera (meaning the spider's head faces the camera in this case).

I have CDO. It's like OCD, but the letters are in alphabetical order, like they should be.
MES
16
Years of Service
User Offline
Joined: 9th Feb 2008
Location: AFK
Posted: 18th Nov 2008 20:24
Ok Here you have a longer description:

Now I tell you what happens, and what I ment with "dissapears and appears again":

I compile it, then I walk to the spider.
When I'm close enough the spider is in the air:
[img]undefined[/img]
When I'm walking while the spider is next to me it is flying around me in a circle.
It also has no collision to other Objects (It flies through stones and the terrain).
The thing with dissappearing and appearing has to do, I think, with the framrate:

It appears and dissappears in this framerate for some seconds, then its away completely, until I start walking. Then it flies around me again.

I think I didn't understand what dbPointObject does, but with this definition my code should work (except collision):
Quote: "dbPointObject
This command will point the specified 3D object towards a point in 3D space. The command sets the current direction of the object to face towards this point in space."


Which code do you use for your enemies?

Thanks for your help so far
Regards
MES

http://www.Computer-Masters.de
Venge
18
Years of Service
User Offline
Joined: 13th Sep 2006
Location: Iowa
Posted: 18th Nov 2008 22:36
Hm. I just noticed in the original code that dist is defined as a global variable and as a local variable in the getDistance function. Try renaming the local variable to tempdist or something and see what happens. Try to avoid using global variables as much as possible; Stick to local variables either in functions or classes.

I have CDO. It's like OCD, but the letters are in alphabetical order, like they should be.
The Real Abaddon
16
Years of Service
User Offline
Joined: 26th Jun 2008
Location:
Posted: 21st Nov 2008 12:42 Edited at: 21st Nov 2008 12:42
well did you create any collision betwen all the objectsand the spider ?

The second problem is that the terrain is not flat so if you want the enemy to stay glued on the terrain you will have to make him to rotate.

Login to post a reply

Server time is: 2024-11-25 07:56:37
Your offset time is: 2024-11-25 07:56:37