Some Basic AI Questions
Posted: Fri May 15, 2009 3:53 pm
Until now, I have been workin on non-AI scripts, but I've come to a point where I really need to make cool enemy scripts for my game. I'm using the perfectai.s script as a base.
First question is about pawn's health:
How does a pawn know when is damaged and when it's health attribute has reached zero? Juutis, I've copied a small part from one of your scripts, the:
I modified it to suite my needs and put it in the script, then I removed the commands that check if the pawn's in pain and I placed this everywhere where I want the pawn to check what type of injury should it recieve, but now when I shoot the pawn, it doesn't get hurt and doesn't bleed, which tells me, that this order isn't executed... Here's the script:
I think I need a little explanation about the whole thing with the health.
EDIT: In the low level commands, everywhere where there was the if statement:
I modified it to:
lasthp is a variable, which in the begining of the script gets the value of the HEALTHATTRIBUTE variable...
The second thing is that I want to use almost the same scripts for everything, so I won't get confused with all the scripts in the folder, so I'll need a little more help on that:
viewtopic.php?f=8&t=3741
This is the topic, where I needed a hjelp on how to make perfectai search for the nearest pawn from another group and then attack it. Everything's fine there, but when the hostile pawns detect the player in their range, they forget about the other pawns that they are fighting with, and start attacking the player (only) . It's like the player is more important to the enemy pawns than the other pawns (normal..
), but is it possible to make the pawns detect the player... I dunno, as another pawn, so they all don't don't forget the other pawns?
And the last one is:
When the pawn is chasing the player and the player goes through a doocase, sometimes collides with the wall (it can't aim properly at the doorcase
) and than starts it's avoidance order, which is just looking rediculus (you know it, whith the backing up than strafing left, then going forward on adn on and on
) would it be possible to make the pawn...somehow be aware of the walls and be aware of the doorcases and others like them, I need the pawn to know where it can go and where it cannot. I know there are commands for calculating the distances of the walls and stuff, but I don't know if they could be useful for this.
Theese are three things that I absolytely don't have Idea how they could be done. Some help on "what should the pawn do" will be really appreciated
First question is about pawn's health:
How does a pawn know when is damaged and when it's health attribute has reached zero? Juutis, I've copied a small part from one of your scripts, the:
Code: Select all
check_damage[ ()
{
if(GetAttribute(HEALTHATTRIBUTE) < lasthp)
{
lastdamage = lasthp - GetAttribute(HEALTHATTRIBUTE);
if(LeftCopy(GetLastBoneHit(),10) = "BIP01 HEAD")
{
ModifyAttribute(HEALTHATTRIBUTE,-2*lastdamage);
AddExplosion("pain",GetLastBoneHit(),0,0,0);
splatter();
headshot = true;
}
AddExplosion("pain",GetLastBoneHit(),0,0,0);
lasthp = GetAttribute(HEALTHATTRIBUTE);
if(GetAttribute(HEALTHATTRIBUTE) < 0)
{
self.think = "death_biz";
return 0;
}
} ]
I think I need a little explanation about the whole thing with the health.
EDIT: In the low level commands, everywhere where there was the if statement:
Code: Select all
if (self.health <= 0)
{
self.think "death_biz"'
return0;
}
Code: Select all
if (self.health < lasthp)
{
self_think "check_damage";
return 0;
}
The second thing is that I want to use almost the same scripts for everything, so I won't get confused with all the scripts in the folder, so I'll need a little more help on that:
viewtopic.php?f=8&t=3741
This is the topic, where I needed a hjelp on how to make perfectai search for the nearest pawn from another group and then attack it. Everything's fine there, but when the hostile pawns detect the player in their range, they forget about the other pawns that they are fighting with, and start attacking the player (only) . It's like the player is more important to the enemy pawns than the other pawns (normal..

And the last one is:
When the pawn is chasing the player and the player goes through a doocase, sometimes collides with the wall (it can't aim properly at the doorcase


Theese are three things that I absolytely don't have Idea how they could be done. Some help on "what should the pawn do" will be really appreciated