One handed spears

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
Post Reply
aaronp
Posts: 3
Joined: 14 Nov 2015, 17:06

One handed spears

Post by aaronp »

So I wanted to make a Nord character with a spear, and I was a bit frustrated that all of the spears in Morrowind are two handed. Small spears as seen in Morrowind were typically used one handed, and with a shield.

I was inspired by the one handed spears and javelin mod, but I wasn't quite happy with the hoops that mod had to go through. It actually makes the spears one handed swords, and switches your spear and sword skill when you have them equipped. If spear is one of your main skills, you wouldn't get points added toward your level while you were actually levelling up your 1h longsword skill.

I know the openmw devs have said they plan on allowing custom weapon types, probably post 1.0. In the meantime, I wrote a patch for the current git master which adds the one-handed spear type to openmw, and a mod which changes all of the spears to one handed. Halberds I left alone. I believe they were used two handed. They should probably be longer and do more damage, and the spears should be held further back from the shaft in the animations, but that's a problem for another time. Javelins should be a separate mod, IMO.

Also I confirmed that the patch/mod works and that using the weapons do improve the spear skill, but they don't show the weapon type "Spear, One Handed" when you mouse over them. I couldn't figure out how to fix that bit.

Mod is here: https://drive.google.com/open?id=0B3fzb ... 0xuaHNUTG8
patch is below. Patch is, of course, GPLv3. :P

Code: Select all

From 255662d523818a4a13a37e3d0528c5440343ec19 Mon Sep 17 00:00:00 2001
From: Aaron Paden <[email protected]>
Date: Tue, 14 Mar 2017 16:43:00 -0500
Subject: [PATCH] Add 1H spear.

---
 apps/opencs/model/world/columns.cpp   | 2 +-
 apps/openmw/mwclass/weapon.cpp        | 8 +++++---
 apps/openmw/mwmechanics/character.cpp | 1 +
 components/esm/loadweap.hpp           | 3 ++-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/apps/opencs/model/world/columns.cpp b/apps/opencs/model/world/columns.cpp
index aeee0d208..8312e01ee 100644
--- a/apps/opencs/model/world/columns.cpp
+++ b/apps/opencs/model/world/columns.cpp
@@ -429,7 +429,7 @@ namespace
     {
         "Short Blade 1H", "Long Blade 1H", "Long Blade 2H", "Blunt 1H", "Blunt 2H Close",
         "Blunt 2H Wide", "Spear 2H", "Axe 1H", "Axe 2H", "Bow", "Crossbow", "Thrown", "Arrow",
-        "Bolt", 0
+        "Bolt", "Spear 1H", 0
     };
 
     static const char *sModificationEnums[] =
diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp
index 470c7040d..5bc4bfcd9 100644
--- a/apps/openmw/mwclass/weapon.cpp
+++ b/apps/openmw/mwclass/weapon.cpp
@@ -108,7 +108,7 @@ namespace MWClass
     {
         const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
 
-        const int size = 12;
+        const int size = 13;
 
         static const int sMapping[size][2] =
         {
@@ -123,7 +123,8 @@ namespace MWClass
             { ESM::Weapon::AxeTwoHand, ESM::Skill::Axe },
             { ESM::Weapon::MarksmanBow, ESM::Skill::Marksman },
             { ESM::Weapon::MarksmanCrossbow, ESM::Skill::Marksman },
-            { ESM::Weapon::MarksmanThrown, ESM::Skill::Marksman }
+            { ESM::Weapon::MarksmanThrown, ESM::Skill::Marksman },
+            { ESM::Weapon::SpearOneHand, ESM::Skill::Spear }
         };
 
         for (int i=0; i<size; ++i)
@@ -178,7 +179,7 @@ namespace MWClass
             return std::string("Item Weapon Shortblade Up");
         }
         // Spear
-        if (type == 6)
+        if (type == 6 || type == 14)
         {
             return std::string("Item Weapon Spear Up");
         }
@@ -273,6 +274,7 @@ namespace MWClass
             mapping[ESM::Weapon::BluntOneHand] = std::make_pair("sSkillBluntweapon", "sOneHanded");
             mapping[ESM::Weapon::BluntTwoClose] = std::make_pair("sSkillBluntweapon", "sTwoHanded");
             mapping[ESM::Weapon::BluntTwoWide] = std::make_pair("sSkillBluntweapon", "sTwoHanded");
+            mapping[ESM::Weapon::SpearOneHand] = std::make_pair("sSkillSpear", "sOneHanded");
             mapping[ESM::Weapon::SpearTwoWide] = std::make_pair("sSkillSpear", "sTwoHanded");
             mapping[ESM::Weapon::AxeOneHand] = std::make_pair("sSkillAxe", "sOneHanded");
             mapping[ESM::Weapon::AxeTwoHand] = std::make_pair("sSkillAxe", "sTwoHanded");
diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp
index 4b54098a1..8c99f67f6 100644
--- a/apps/openmw/mwmechanics/character.cpp
+++ b/apps/openmw/mwmechanics/character.cpp
@@ -582,6 +582,7 @@ MWWorld::ContainerStoreIterator getActiveWeapon(CreatureStats &stats, MWWorld::I
                     case ESM::Weapon::AxeOneHand:
                     case ESM::Weapon::Arrow:
                     case ESM::Weapon::Bolt:
+                    case ESM::Weapon::SpearOneHand:
                         *weaptype = WeapType_OneHand;
                         break;
                     case ESM::Weapon::LongBladeTwoHand:
diff --git a/components/esm/loadweap.hpp b/components/esm/loadweap.hpp
index eddcaee4f..f5603b91d 100644
--- a/components/esm/loadweap.hpp
+++ b/components/esm/loadweap.hpp
@@ -34,7 +34,8 @@ struct Weapon
         MarksmanCrossbow = 10,
         MarksmanThrown = 11,
         Arrow = 12,
-        Bolt = 13
+        Bolt = 13,
+        SpearOneHand = 14
     };
 
     enum AttackType
-- 
2.12.0
User avatar
psi29a
Posts: 5361
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: One handed spears

Post by psi29a »

Make a pull-request in github so that we can have a proper technical discussion there. ;)
aaronp
Posts: 3
Joined: 14 Nov 2015, 17:06

Re: One handed spears

Post by aaronp »

I thought about doing that, but it's not really something I'd ask to be mainlined, because it's obviously the wrong approach. It's more of a stop-gap measure until the hardcoded bits are removed post 1.0, and I happened to want to create this type of character. :P
vidfail
Posts: 1
Joined: 19 Mar 2022, 02:45

Re: One handed spears

Post by vidfail »

It looks like your Google drive link is dead. Could you repost your mod somewhere please? I would love to play a one-handed spear character! I haven't found any alternative mods that work well with OpenMW.

Thanks! :)
Post Reply