I added limb targeting and improved the combat AI
Posted: 19 Mar 2018, 04:11
I've been working on a large overhaul for OpenMW and have made quite a bit of progress on the combat in the last week, which I know a lot of people might be interested in. Here's a video of the combat stuff I've been doing in action. The plane of shallow water is just my test cell, which I thought would look cool as a setting for an epic duel.
The good:
- I've made a script that goes on enemies which works with a script on the player to find out which limb you are targeting, and reduces damage to that limb based on its own armor.
- The hit sound that plays is based on which type of armor you hit, the pitch of it decreases as damage increases. As you can hear in the video though, it doesn't sound very good so let me know if anyone has a better idea.
- Attacking the legs will cripple them first damaging speed, then forcing enemies to crouch. If they take enough damage they cannot move.
- Attacking the torso damages fatigue regen
- Attacking the arms damages agility
- Attacking the head will first damage intelligence, then blind enemies, and eventually knock them unconscious for a couple minutes
- The amount of damage imparted onto limbs is based on your accuracy. Your attacks always hit, but the more accuracy you have the better you hit weak spots.
- Sneak attacks add your sneak bonus as accuracy.
- Everything costs a lot more stamina (fatigue), but it also regenerates much faster.
- The AI will attack extremely aggressively when it has enough stamina and is close, but will back up when out.
- Once it backs up it will slowly circle around you until one of you makes the first move
- It will perform jump attacks if its acrobatics is high (these are useful because momentum is factored into damage)
- Actors start bleeding below 75% health but very slowly regenerate health above it (replacing the health gain on rest)
The bad:
- The enemy script must be put onto that specific NPC in the editor. There is a way around this involving using startscript in a combat voice line, but this isn't as consistent as I'd like it to be. I could theoretically use tes3cmd to add this script to the 95% of NPCs that have no script (and even modify the ones that do to merge the scripts), but this seems like a bad idea.
- Because of a bug in how OpenMW handles the playgroup function, the AI must be toggled off at times during combat so I can make them move around and not attack the player when they're out of stamina. Otherwise they will interrupt these animations and keep trying to fight. I attempted to use stopcombat and aiwander 0 0 0 as an alternative to this, but then they put away their weapons and I have not figured out how to stop this from happening.
The ugly
- Since OpenMW has not yet been dehardcoded, I have done all sorts of terrible hacky workarounds to make this work, such as using "GetSoundPlaying" as a shitty event system or the aforementioned AI toggling and starting the scripts on voice lines. There is one bug in the AI that I can't figure out, and the limb targeting isn't always as accurate as I'd like it to be, but other than that what works, works.
Also I swear I have nothing to do with that guy who made a kickstarter. People keep confusing me with him when I go around asking for permissions. I don't have all of them yet so I can't release it (even if it was done), but I am only missing a handful out of over a hundred fifty modders so I'm not too worried about dropping whatever mods I need to when I'm ready to release it.
What do ya'll think? Any suggestions or ideas?
The good:
- I've made a script that goes on enemies which works with a script on the player to find out which limb you are targeting, and reduces damage to that limb based on its own armor.
- The hit sound that plays is based on which type of armor you hit, the pitch of it decreases as damage increases. As you can hear in the video though, it doesn't sound very good so let me know if anyone has a better idea.
- Attacking the legs will cripple them first damaging speed, then forcing enemies to crouch. If they take enough damage they cannot move.
- Attacking the torso damages fatigue regen
- Attacking the arms damages agility
- Attacking the head will first damage intelligence, then blind enemies, and eventually knock them unconscious for a couple minutes
- The amount of damage imparted onto limbs is based on your accuracy. Your attacks always hit, but the more accuracy you have the better you hit weak spots.
- Sneak attacks add your sneak bonus as accuracy.
- Everything costs a lot more stamina (fatigue), but it also regenerates much faster.
- The AI will attack extremely aggressively when it has enough stamina and is close, but will back up when out.
- Once it backs up it will slowly circle around you until one of you makes the first move
- It will perform jump attacks if its acrobatics is high (these are useful because momentum is factored into damage)
- Actors start bleeding below 75% health but very slowly regenerate health above it (replacing the health gain on rest)
The bad:
- The enemy script must be put onto that specific NPC in the editor. There is a way around this involving using startscript in a combat voice line, but this isn't as consistent as I'd like it to be. I could theoretically use tes3cmd to add this script to the 95% of NPCs that have no script (and even modify the ones that do to merge the scripts), but this seems like a bad idea.
- Because of a bug in how OpenMW handles the playgroup function, the AI must be toggled off at times during combat so I can make them move around and not attack the player when they're out of stamina. Otherwise they will interrupt these animations and keep trying to fight. I attempted to use stopcombat and aiwander 0 0 0 as an alternative to this, but then they put away their weapons and I have not figured out how to stop this from happening.
The ugly
- Since OpenMW has not yet been dehardcoded, I have done all sorts of terrible hacky workarounds to make this work, such as using "GetSoundPlaying" as a shitty event system or the aforementioned AI toggling and starting the scripts on voice lines. There is one bug in the AI that I can't figure out, and the limb targeting isn't always as accurate as I'd like it to be, but other than that what works, works.
Also I swear I have nothing to do with that guy who made a kickstarter. People keep confusing me with him when I go around asking for permissions. I don't have all of them yet so I can't release it (even if it was done), but I am only missing a handful out of over a hundred fifty modders so I'm not too worried about dropping whatever mods I need to when I'm ready to release it.
What do ya'll think? Any suggestions or ideas?