check_damage[ ()
Posted: Tue Jun 24, 2008 8:29 pm
As I was looking at Juutis's I found that he/you have made a great descision about the blood throwing system (if I can call it that way).The command I'm talking about checks if the pawn has been damaged,it detects for example whe the player shoots at the pawn.And when that is detected,starts a blood explosion:
If that's right (what I said) can someone explain me how is it working and how can I put this command for example in the Perfectai.s script

Code: Select all
check_damage[ ()
{
if(GetAttribute(HEALTHATTRIBUTE) < lasthp)
{
lastdamage = lasthp - GetAttribute(HEALTHATTRIBUTE);
if(LeftCopy(GetLastBoneHit(),4) = "head")
{
ModifyAttribute(HEALTHATTRIBUTE,-2*lastdamage);
AddExplosion("headshot",GetLastBoneHit(),0,0,0);
splatter();
headshot = true;
}
else
{
if(random(0,100) < 25)
{
splatter();
}
headshot = false;
}
if(LeftCopy(GetLastBoneHit(),3) = "arm")
{
ModifyAttribute(HEALTHATTRIBUTE,lastdamage/2);
}
if(LeftCopy(GetLastBoneHit(),4) = "feet")
{
ModifyAttribute(HEALTHATTRIBUTE,lastdamage/2);
}
AddExplosion("bullethit",GetLastBoneHit(),0,0,0);
lasthp = GetAttribute(HEALTHATTRIBUTE);
if(GetAttribute(HEALTHATTRIBUTE) < 0)
{
self.think = "die";
return 0;
}
return true;
}
if(GetAttribute(HEALTHATTRIBUTE) < 0)
{
self.think = "die";
return 0;
}
return false;
} ]

