Jump to content

Making an NPC block


Imrinfected

Recommended Posts

A while ago I made a spell deflect mod(http://tesnexus.com/downloads/file.php?id=31037), and one of my original intentions was to make it work with NPCs as well as the player, so everyone could utilize it. Well, that kind of fell through after I found out that I didn't have it working for npcs.

 

I've fixed that now, I believe, but the mod still suffers the problem of npcs *not* utilizing it. They never deflect spells, which obviously is problematic, as the support is there, but never used.

 

So basically, I want to make npcs block when a spell is coming at them, depending on their skills and levels and such, which is all pretty basic except for the making them block part. I'm not sure how to make an npc do anything combat related. I know how to make them play the animation, but that doesn't exactly help.

Link to comment
Share on other sites

You could mess with the combat style block chance with the setcombatstyle_______ functions, but I don't know if that would be best. You could also track projectiles and see if their heading is going towards an NPC, and if so, cause it to make that NPC play the blockidle.

 

For example, here's one method I think would work:

1. Add a token to target NPCs.

2. Get NPC ref with getcontainer

3. Get projectile refs with getfirstref/getnextref 34

4. Find heading from projectile to NPC and vice versa with projectile.getheadingangle npc and npc.getheadingangle proj

5: Check all other parameters you want (skill, level, etc.)

5. If everything's good, make NPC block

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...