Monster ai.Need help:-(
Moderator: InsideQC Admins
7 posts
• Page 1 of 1
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)?
________
LEGAL MARIJUANA DISPENSARY
________
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
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:
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.
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!
-

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

MauveBib - Posts: 634
- Joined: Thu Nov 04, 2004 1:22 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
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest