<!--quoteo(post=184302:date=Feb 25 2007, 06:11 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE(Pieter Boelen @ Feb 25 2007, 06:11 AM) [snapback]184302[/snapback]</div><div class='quotemain'><!--quotec-->
Thanks for that, HawkerT. I'm going to be playing with your code and see what it does. <img src="style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid="

" border="0" alt="icon_mrgreen1.gif" />
Could you please tell me what I should add with the BuildSettings.h toggle when using your code?
<!--QuoteEnd--></div><!--QuoteEEnd-->
Hey Pieter, I hope you are doing good out there in that big pond cruising towards a more sunny and warm heaven on this earth.
I have enhaced the code integrity and performance when not wanting blockdamage.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> isBlocked = isBlocked && CheckAttribute(enemy,"equip.blade") && GetCharacterEquipByGroup(enemy,BLADE_ITEM_TYPE) != "bladeX4";
// PB: Disable blocking for enemies with either no sword or their fists equiped
if(isBlocked)
{
//ÂåðîÿòÃîñòü ïðîáèâêè
float p = LAi_BladeFindPiercingProbability(attack, enemy, hitDmg);
p = p + pBreak;
//Åñëè øà Ãñîâ ïðîáèòü Ãåò, òî ÃÃ¥Ãà Ãîñèì ïðîâðåæäåÃèÿ
if(p < 0.0) return;
//Åñëè øà Ãñîâ ïðîáèòü Ãåò, òî ÃÃ¥Ãà Ãîñèì ïðîâðåæäåÃèÿ
if(rand(10000) > p*10000)
{// HawkerT Feb07 Blockdamage
if(BLOCKDAMAGE > 0)
{
int curBlockDamage = attack.skill.Fencing;
int actBlockDamage = BLOCKDAMAGE;
if(curBlockDamage > BLOCKDAMAGE)
{
actBlockDamage = 2*rand(curBlockDamage);
}
if(GetCharacterEquipByGroup(attack, BLADE_ITEM_TYPE) != "bladeX4")
{
if(!LAi_IsImmortal(enemy))
{
LAi_ApplyCharacterDamage(enemy, actBlockDamage);
LAi_CheckKillCharacter(enemy);
return;
}
}else{
if(!LAi_IsImmortal(attack))
{
LAi_ApplyCharacterDamage(attack, actBlockDamage);
LAi_CheckKillCharacter(attack);
return;
}
}
return;
}
}// HawkerT Feb07 Blockdamage end
}<!--c2--></div><!--ec2-->
Well as you can see my solution is based on a characters fencing skill (1-10) which is applied during each block. My basic idea being that if a character (NPC) is skilled at fencing then blocking him/her will be more costly and less likely to be a walk in the park (you have to be more focussed and move faster, his/her blow will be harder and suck more juice from your muscles etc.).
I also want this solution to become harder as your own skill rises. But that is exactly the nice thing about using enemy fencing skill as this will follow your own skill somewhat. As I understand the game mechanics then enemy skill is automatically adjusted to higher levels when your own level rises.
Now if you use my solution 'out of the box' so to speak, then the toggle will be the minimum hit damage applied, i.e. if you set this to 2 (I have) then at least 2 points of damage will be applied when blocking even if your enemy has fencing skill 1. It also still functions as a toggle in that if you set it to 0 then no blockdamage will be applied.
I have also enhanced your initial fists check. If both opponents are using fists then no blockdamage is applied. If the attacker is using fists and the enemy is using a blade then if the enemy blocks the blockdamage is applied to the attacker. The logic being that trying to knock your opponent who then blocks you with a sharp blade ... well that is bound to hurt YOU!
Other then that the isImmortal checks are still in there.
Let me know when you refine it even further as I like this aspect of the game to become a bit better.
All the best
Frans