Inside3D!
     

Monster ai.Need help:-(

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
lukas2288



Joined: 14 Jun 2009
Posts: 42

PostPosted: Sun Jul 12, 2009 11:15 am    Post subject: Monster ai.Need help:-( Reply with quote

Hi guys i mading a new model and i want to ask how can i insert dodgine function or sideing function for monsters and new ai(rox example player shoots rocket and endemy dodge)?
Back to top
View user's profile Send private message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Sun Jul 12, 2009 11:33 am    Post subject: Reply with quote

There are two ways to do that; the cheap, easy way or the "proper", difficult one.

The easy method is to add something like this to ai_run in ai.qc:

Code:

if (self.enemy.classname == "whatever your monster's classname is")
     if (self.enemy.attack_finished > time)
          ai_run_slide();


The "proper" way is to do a search for projectiles within a radius, predict their future positon based on direction and velocity and determine if it will come close to the predicted position of the monster, then move in a direction perpendicular to the velocity of the projectile.

Much harder.
_________________
Apathy Now!
Back to top
View user's profile Send private message
lukas2288



Joined: 14 Jun 2009
Posts: 42

PostPosted: Sat Jul 18, 2009 1:34 pm    Post subject: Reply with quote

Dodge can be make like this(on demon for example):

void() demon1_jump4 =[ $jump1_3, demon1_jump5 ]
{
ai_face();

self.touch = Demon_JumpTouch;
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_right * 600 + '0 250 70';
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
};

The demon will dodge like players in UT2k3 an UT2k4.
Back to top
View user's profile Send private message
lukas2288



Joined: 14 Jun 2009
Posts: 42

PostPosted: Mon Jul 20, 2009 11:23 am    Post subject: Reply with quote

lukas2288 wrote:
Dodge can be make like this(on demon for example):

void() demon1_jump4 =[ $jump1_3, demon1_jump5 ]
{
ai_face();

self.touch = Demon_JumpTouch;
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_right * 600 + '0 250 70';
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
};

The demon will dodge like players in UT2k3 an UT2k4.


I have one preoblem with this code.So i want to ask if somebody can help me.The dodge function works but when the monster is in the edge he fall.Is there some way how to trick this?
Back to top
View user's profile Send private message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Mon Jul 20, 2009 5:32 pm    Post subject: Reply with quote

Jumping prediction is pretty hard, which is why just about every quake bot ever happily jumps into lava with no thought for its safety.

However, if you don't use velocity, but use the code I posted (which uses the discrete walkmove for movement), it won't fall off ledges, it'll just change strafing direction when it reaches a ledge.
_________________
Apathy Now!
Back to top
View user's profile Send private message
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Tue Jul 21, 2009 3:18 am    Post subject: Reply with quote

MauveBib wrote:
There are two ways to do that; the cheap, easy way or the "proper", difficult one.

The easy method is to add something like this to ai_run in ai.qc:

Code:

if (self.enemy.classname == "whatever your monster's classname is")
     if (self.enemy.attack_finished > time)
          ai_run_slide();


The "proper" way is to do a search for projectiles within a radius, predict their future positon based on direction and velocity and determine if it will come close to the predicted position of the monster, then move in a direction perpendicular to the velocity of the projectile.

Much harder.


Can this be modified to make Grunties ("monster_army") avoid Grenades?
Back to top
View user's profile Send private message
lukas2288



Joined: 14 Jun 2009
Posts: 42

PostPosted: Fri Jul 24, 2009 9:05 pm    Post subject: Reply with quote

So i have done the dodge function without fall of.So i have last question about monsters.How can i make grunt shoot homing missile just like in quoth?And how can i set monster earthquake when the boss make "strong attack"?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group