Creature attack animations

Does anyone know how the engine decides when to use the “reach” melee animation?

For example, a biting creature that strikes low is supposed to play “cclosel” when the opponent is immediately ahead, but “creach” when slightly further away.

Some custom creatures seem to play creach all the time, so that they ghost through their opponent to strike a point behind them.

EDIT - I say “seem” because I can’t easily verify that cclose1 actually looks different in game from creach (though the animations in the model are clearly not identical).

I thought it might have something to do with appearance.2da settings -CREPERSPACE and perhaps PREFATCKDIST - but tweaking them doesn’t seem to help.

In the cases I’ve investigated, the animations are inherited from an official supermodel, with SETANIMATIONSCALE set to reflect the size of the custom creature (if that’s relevant).

Can anyone cast light on this?

My mistake - my test creature had a sword in inventory, which I didn’t think would matter for a type S model, but removing it fixed the worst problems.

Now I can fine-tune the attack behaviour with CREPERSPACE and PREFATCKDIST so that 90% of attacks look fine, while the remainder look only slightly out of whack (which I suspect is as good as it gets with larger creatures in NWN).

A lot of the older custom creatures took shortcuts with the anims - especially the attack anims, often copying keys from one to another.

Usually not a big deal, but if you look at some of the Bioware creatures in a 3D modeling program you’ll see that when using the reach anim, the entire model slides forward.

Some of the issues may also be caused by erroneous numbers entered into the parameters in appearance.2da.

And yes, S and L type creatures having melee weapons is known to cause issues depending on the model.

You can find a writeup of the maths involved on the handy NWN Wiki: Combat Ranges - Neverwinter Nights 1: EE - nwn.wiki

It has some examples for you to follow but it’s not perfect I probably need to rewrite it for animations.

The choice of “close”, “medium” and “long” range attacks appear to be based on something not on that page I need to add; a modifier of 0.25 either way.

Example:

PREFATCKDIST is 2.0

If range to target - HITDIST (eg 3.0 range - 1.5 hitdist is 1.5) is:

  • < 1.75 - close reach animations
  • <= 2.25 - medium reach animations
  • > 2.25 - long reach animation

Issue: The preferred attack distances are used to calculate where people move to be “next to each other” therefore you might, due to the settings of it and HITDIST, constantly be “close” or “long”.

For weapons it’s more complicated (weapon scale, attack distance based on weapon ID etc.)

Thanks for that. I missed some of the later points in the wiki.

For what it’s worth, evidently CREPERSPACE is not only used in combat, but for creature-creature collisions in general, as detailed here. The non-combat information there has been verified many times - live modules depend on it.

I linked that article back to the wiki for the combat rules.