Forum

Monster ai.Need help:-(

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Monster ai.Need help:-(

Postby lukas2288 » Sun Jul 12, 2009 11:15 am

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)?
________
LEGAL MARIJUANA DISPENSARY
Last edited by lukas2288 on Tue Mar 08, 2011 12:49 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby MauveBib » Sun Jul 12, 2009 11:33 am

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: Select all
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!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Postby lukas2288 » Sat Jul 18, 2009 1:34 pm

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.
________
American Idol Forums
Last edited by lukas2288 on Tue Mar 08, 2011 12:50 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby lukas2288 » Mon Jul 20, 2009 11:23 am

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?
________
Montana marijuana dispensary
Last edited by lukas2288 on Tue Mar 08, 2011 12:50 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby MauveBib » Mon Jul 20, 2009 5:32 pm

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!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Postby OneManClan » Tue Jul 21, 2009 3:18 am

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: Select all
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?
OneManClan
 
Posts: 243
Joined: Sat Feb 28, 2009 2:38 pm

Postby lukas2288 » Fri Jul 24, 2009 9:05 pm

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"?
________
RA302
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest