View previous topic :: View next topic |
Author |
Message |
lukas2288
Joined: 14 Jun 2009 Posts: 42
|
Posted: Sun Jul 12, 2009 11:15 am Post subject: Monster ai.Need help:-( |
|
|
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 |
|
 |
MauveBib

Joined: 04 Nov 2004 Posts: 602
|
Posted: Sun Jul 12, 2009 11:33 am Post subject: |
|
|
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 |
|
 |
lukas2288
Joined: 14 Jun 2009 Posts: 42
|
Posted: Sat Jul 18, 2009 1:34 pm Post subject: |
|
|
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 |
|
 |
lukas2288
Joined: 14 Jun 2009 Posts: 42
|
Posted: Mon Jul 20, 2009 11:23 am Post subject: |
|
|
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 |
|
 |
MauveBib

Joined: 04 Nov 2004 Posts: 602
|
Posted: Mon Jul 20, 2009 5:32 pm Post subject: |
|
|
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 |
|
 |
OneManClan
Joined: 28 Feb 2009 Posts: 62
|
Posted: Tue Jul 21, 2009 3:18 am Post subject: |
|
|
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 |
|
 |
lukas2288
Joined: 14 Jun 2009 Posts: 42
|
Posted: Fri Jul 24, 2009 9:05 pm Post subject: |
|
|
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 |
|
 |
|