• Mods are now organized as resources. Use the Mods link above to browse for or submit a mod, tool, or prefab.

    The TFP Official Modding Forum Policy establishes the rules and guidelines for mod creators and mod users.

Extending item is not working

I'm working on another version of the MP5 and am trying to extend the one already in-game so I need only specify the new mesh file when it is complete. However, it isn't copying attributes when extending and preventing the new one from loading. Not sure what I am doing wrong.
XML:
<DHTA_MP5SD>
    <append xpath="/items">
        <item name="DHTA_MP5SD" extends="gunHandgunT3SMG5">
            <effect_group name="DHTA_MP5SD" extends="gunHandgunT3SMG5">
                <passive_effect name="MaxRange" operation="base_set" value="50" tags="perkGunslinger,9mmGun"/>
                <passive_effect name="DamageFalloffRange" operation="base_set" value="28" tags="perkGunslinger,9mmGun"/>
                <passive_effect name="EntityDamage" operation="base_add" value="15" tags="perkGunslinger"/>
            </effect_group>
        </item>
    </append>
</DHTA_MP5SD>
It wants me to specify the mesh file. It should inherit that. If I specify it, it asks for a material. Why isn't it inheriting the base data?
 
There are things that don't "extend". Tags, drop events, and I believe effect_groups are among those. But I'm not an expert, and perhaps there is a way. I end up repeating those items when I extend something.
 
If there is I'd like to know too. There's a comment in the xml about the tags property, and the creativemode property, but that's the only documentation I've found that I recall. I asked here a year ago and never got any answers. Maybe someone else can add to this.
 
This probably won't work but you can try it.

<item name="DHTA_MP5SD" extends="gunHandgunT3SMG5">
<property name="Tags" value="perkGunslinger,9mmGun"/>

and remove the other 3 duplicate references
 
This probably won't work but you can try it.

<item name="DHTA_MP5SD" extends="gunHandgunT3SMG5">
<property name="Tags" value="perkGunslinger,9mmGun"/>

and remove the other 3 duplicate references
That wouldn't do anything. I'm trying to adjust range, falloff, damage, and leave the rest alone.\

So my next question is, what good is "extends=" if it doesn't copy things over to the new class?
 
Using extend can save time and reduce coding errors. An example, the zombies are all based on a few basic types. Steve is based on a template zombie. Then Feral Steve is based on Steve, Radiated on Feral, etc. That initial template zombie is maybe 150 lines of xml. Much of that is inherited by the extends. So, Radiated Steve is about 20 lines. A lot less copy/paste, chance of typos, and if there is some change to the base zombies you wouldn't have to go through and change all the others.
 
Correct, how it is supposed to work. My experience in C++. C#, .NET, PHP, and more is that when you extend a class you get everything not private. Since there is no private/protected/public here, that doesn't apply. My expectation is that if I extend a weapon like the MP5, change damage base to 2000, and run the mod, I literally get an MP5 that does 2k damage since it's the only line I changed. In reality though, I don't inherit the mesh, skin, and who knows what-else. Not know what gets inherited means I can make a buggy mess.

In other words, it does not work like anything else, so if I am to use it, I need something to tell me its limits. For now, I just copied the entire SMG5 item into the mod and it works, but I have no icon yet. No biggy there, I only have items.xml in the mod with the clone of the SMG5.
 
Correct, how it is supposed to work. My experience in C++. C#, .NET, PHP, and more is that when you extend a class you get everything not private. Since there is no private/protected/public here, that doesn't apply. My expectation is that if I extend a weapon like the MP5, change damage base to 2000, and run the mod, I literally get an MP5 that does 2k damage since it's the only line I changed. In reality though, I don't inherit the mesh, skin, and who knows what-else. Not know what gets inherited means I can make a buggy mess.

In other words, it does not work like anything else, so if I am to use it, I need something to tell me its limits. For now, I just copied the entire SMG5 item into the mod and it works, but I have no icon yet. No biggy there, I only have items.xml in the mod with the clone of the SMG5.
For easier testing, find the vanilla SMG icon, copy it and change the name of the file to DHTA_MP5SD.png.
 
Back
Top