Attack Syshook is called, but doesn't work like it should
Posted: Thu May 04, 2006 4:28 pm
syshook.cfg:
hooks/combat.src:
Everything works as far as the hook is called, print statements go fine, calculations are made, etc... However, the documentation says that if you hook Attack, you'll have to call the hitscript yourself but it is calling it all by itself. Magicly. POL runs my hook like it should but totally ignores it and the core is still handling combat....... Why?
On OSI the chance to hit is based on the attacker's combat skill vs the defender's' combat skill, or eval int and anatomy, and if the attack hits, parry is checked if the defender is using a melee weapon or shield (with some bushido weirdness thrown in there, but I'm not sure I'm going to use that). I'd handle this stuff in a hit script but the core still likes to make the hit sound even though the attack would have missed and is dealing no damage.
Another question: If I try to do this:
It prints the object type but not the name, even though the docs say that Weapon is a distant child UObject, which has a name property. I know I could get the name from config files, but is the documentation wrong?
Code: Select all
SystemHookScript hooks/combat.ecl
{
Attack Attack
}Code: Select all
program Combat()
print("SystemHook enabled: Attack");
return 1;
endprogram
exported function Attack(attacker, defender)
print("This works just fine: " + attacker.name);
return;
endfunctionOn OSI the chance to hit is based on the attacker's combat skill vs the defender's' combat skill, or eval int and anatomy, and if the attack hits, parry is checked if the defender is using a melee weapon or shield (with some bushido weirdness thrown in there, but I'm not sure I'm going to use that). I'd handle this stuff in a hit script but the core still likes to make the hit sound even though the attack would have missed and is dealing no damage.
Another question: If I try to do this:
Code: Select all
print ("Weapon info - objtype: " + (attacker.weapon).objtype + " name: " + (attacker.weapon).name);