• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

need help modding spear range

JumboJester

New member
Hi,

i personally feel like the reach of the spears aren't long enough so i tried modding the range on them, but to no success.
This is what i've come up with so far and referencing other mods i think it should work. Yet it does not. Any tips to improve this?

Version 1 of items.xml

<configs>

<append xpath="/items">
<item name="meleeWpnSpearT0StoneSpear">

<property class="Action0">
<property name="Range" value="4.1"/>
</property>

<property class="Action1">
<property name="Range" value="4.1"/>
</property>

</item>
</append>

</configs>




Version 2 of items.xml

<configs>

<set xpath="/items/item[@name='meleeWpnSpearT0StoneSpear']/property[@class='Action0']/property[@name='Range']/@value">4.1</set>
<set xpath="/items/item[@name='meleeWpnSpearT0StoneSpear']/property[@class='Action1']/property[@name='Range']/@value">4.1</set>

</configs>




any help is greatly appreciated

 
Your second set of <set> entries are spot on. All good there.

One thing to consider is that these values are not perfectly calibrated to the suggested distance due to hand placement, or other factors.

Consider this value instead.

<set xpath="/items/item[@name='meleeWpnSpearT0StoneSpear']/property[@class='Action0']/property[@name='Range']/@value">4.4</set>
<set xpath="/items/item[@name='meleeWpnSpearT0StoneSpear']/property[@class='Action1']/property[@name='Range']/@value">4.4</set>




It suggests 4.4 but the reality is 4.0 and possibly a little over to 4.1. This is something I needed to tinker with when making a Pole Arm weapon update which is a spear with an axe attached to the end with a range of about 5.5 blocks for the Server Side Weapons. It's trade off for that range is limited indoor use since it has a bat type swing.

This is the kind of set up used for testing range to re calibrate the value based on the actual result. That will certainly even things up with the bear's 'suggested' melee range of 3.6 which seems to be over 4.0 in game. ^^

2HX9acw.jpeg


 
Your second set of <set> entries are spot on. All good there.

One thing to consider is that these values are not perfectly calibrated to the suggested distance due to hand placement, or other factors.

Consider this value instead.

<set xpath="/items/item[@name='meleeWpnSpearT0StoneSpear']/property[@class='Action0']/property[@name='Range']/@value">4.4</set>
<set xpath="/items/item[@name='meleeWpnSpearT0StoneSpear']/property[@class='Action1']/property[@name='Range']/@value">4.4</set>




It suggests 4.4 but the reality is 4.0 and possibly a little over to 4.1. This is something I needed to tinker with when making a Pole Arm weapon update which is a spear with an axe attached to the end with a range of about 5.5 blocks for the Server Side Weapons. It's trade off for that range is limited indoor use since it has a bat type swing.

This is the kind of set up used for testing range to re calibrate the value based on the actual result. That will certainly even things up with the bear's 'suggested' melee range of 3.6 which seems to be over 4.0 in game. ^^

thanks a lot for the reply arramus,

Range def. is a variable that behaves strangely
the default value for the wooden spear action0 is 2.6
while iron and steel have 3.6, yet all of them have the same attack-range of about 2.5blocks

i tried increasing the value of up to 10 for Range but it still didn't work for me.
So i assume i did something wrong somewhere else like in the modinfo.
could you perhaps look at my mod, or send me what you created?
 

Link to my mod: https://github.com/Yaez/7days-Longer-Spear-Reach/blob/main/Longer Spear Reach.zip

 
Here are a few edits to allow it to load, and remove additional warnings or potential issues:

Spacing in the ModInfo.xml name value is not permitted for V1.0 and shows in the console/log as a warning.

Update <Name value="Longer Spear Reach" /> to <Name value="Longer_Spear_Reach" />

Identical case to game folder for good compliance. This is also a necessity for some Linux builds.

config to Config.

Fail to load as they extend from meleeWpnSpearT0StoneSpear and do not exist in their own right. These require appending, and since they don't exist adding the full Action0 allows for further custom edits where appropriate.

Remove

<set xpath="/items/item[@name='meleeWpnSpearT1IronSpear']/property[@class='Action0']/property[@name='Range']/@value">8</set>

<set xpath="/items/item[@name='meleeWpnSpearT3SteelSpear']/property[@class='Action0']/property[@name='Range']/@value">10</set>

Add

Code:
    <append xpath="/items/item[@name='meleeWpnSpearT1IronSpear']">
    <property class="Action0">
        <property name="Class" value="DynamicMelee"/>
        <property name="Range" value="8"/>
        <property name="Hitmask_override" value="Melee"/>
        <property name="Sphere" value=".05"/> <!-- limit to 0.15, else the sphere cast can overlap the target already -->
        <property name="Sound_start" value="spear_fire"/>
        <property name="ToolCategory.harvestingTools" value="1" param1="1"/>
        <property name="UseGrazingHits" value="true"/>
        <property name="GrazeStart" value=".25"/>
        <property name="GrazeEnd" value=".32"/>
        <property name="SwingDegrees" value="10"/>
        <property name="SwingAngle" value="20"/>
        <property class="HitSounds">
            <property name="Override0" value="organic" param1="metalstaborganic"/>
        </property>
        <property class="GrazeSounds">
            <property name="Override0" value="organic" param1="metalgrazeorganic"/>
        </property>
    </property>
    </append>
Code:
    <append xpath="/items/item[@name='meleeWpnSpearT3SteelSpear']">
    <property class="Action0">
        <property name="Class" value="DynamicMelee"/>
        <property name="Range" value="10"/>
        <property name="Hitmask_override" value="Melee"/>
        <property name="Sphere" value=".05"/> <!-- limit to 0.15, else the sphere cast can overlap the target already -->
        <property name="Sound_start" value="spear_fire"/>
        <property name="ToolCategory.harvestingTools" value="1" param1="1"/>
        <property name="UseGrazingHits" value="true"/>
        <property name="GrazeStart" value=".25"/>
        <property name="GrazeEnd" value=".32"/>
        <property name="SwingDegrees" value="10"/>
        <property name="SwingAngle" value="20"/>
        <property class="HitSounds">
            <property name="Override0" value="organic" param1="metalstaborganic"/>
        </property>
        <property class="GrazeSounds">
            <property name="Override0" value="organic" param1="metalgrazeorganic"/>
        </property>
    </property>
    </append>
 
Back
Top