Jump to content

Help with mod needed, I am stuck and baffled.


Recommended Posts

Ok, I created a mod and released it.  It was pretty quick and simple so I didn't test everything.  That is on me.  But there is an issue and I can't figure out how to solve it and it SHOULD be simple.

 

    <!-- Items fixed by Steel Repair Kit -->
    <set xpath="/items/item[@name='gunToolNailgun']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
<!--    <append xpath="/items/item[@name='meleeToolFireaxeSteel']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</append> -->
<!--    <set xpath="/items/item[@name='meleeToolFireaxeSteel']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set> -->
    <set xpath="/items/item[@name='meleeToolPickaxeSteel']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
    <set xpath="/items/item[@name='meleeToolShovelSteel']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
    <set xpath="/items/item[@name='meleeToolKnifeMachete']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
    <set xpath="/items/item[@name='meleeClubBaseballBat']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
    <set xpath="/items/item[@name='meleeToolSledgehammerSteel']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
    <set xpath="/items/item[@name='meleeThrownSpearSteel']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
    <set xpath="/items/item[@name='meleeKnucklesSteel']/property[@name='RepairTools']/@value">resourceIceburgSteelRepairKit</set>
 

Three of the items don't use the correct repair kit to repair the item.  Just uses the "default" repair kit from the game.  Those 3 items are Steel Fire Axe, Steel Spear, and Steel Knuckles.  They all have a common theme in that they are all created by using "extends" to create them from the Iron form of them from the game.

 

All other repair kits work for all other different types of weapons, tools, and armor.  So it is something with these items themselves and I think related to the "extends" somehow but unsure.  The only thing I have not tried doing is basically deleting the items entirely and recreating them from scratch, which I really don't want to have to do.  You can see 2 of my tries on the Steel Fire Axe in the code above.  The set is how I did every other item I am working with and works great except on these three.  I tried an append, and that didn't work either.

 

I have now tested every item and these are the only 3 that don't work.

 

Does anyone have any idea why these 3 would be acting this way?  I am completely stumped at this point after digging at it for a few hours.

Link to comment
Share on other sites

Seems like you're on the right path to me. But I'm no expert!

 

Might be worth setting the parent, "meleeToolPickaxeIron" to use your new repair kit, while leaving the 'meleeToolPickaxeSteel' at default.

If that setup results in both the iron & steel picks using your new repair kit then there's evidence that the "extends" is overwriting the steel line.

 

Other thought is possibly running an "appends" to force add the line for new repair kits; into the steel config. I'd guess that'd have equal chances of erroring-out, using the orig repair kits, using the new kits, or spawning a Creeper into your world... :biggrin-new:

 

Also, I _think_ the yt tut for making modlets (in Sperii's main thread) covered a way to add in a line in a specific location. So maybe could insert your repair kit line prior to the existing one?

 

Sry I can't offer syntax help, or more than a quick troubleshooting thought. Good luck!

Link to comment
Share on other sites

Thanks for the thoughts.  I tried a few more ways, including yours, and think I have found out what is happening.

 

When you extend an object in the game:

1. any Properties (variables) that are set during the extend get set and can be changed.

2. any Properties (variables) that are NOT set during the extend DO NOT get set and created for the new object.  Instead a POINTER to that Property (variable) is set and thus becomes hard coded to that object and can no longer be changed.

 

This is getting deep down into the actual game code and is only correctable by the Fun Pimps if this is actually occurring.  

 

There are 2 solutions for my specific issue then.

 

1. provide a Modified Vanilla Items.xml file that has to be manually copied into the game folder that only has the "<property name="RepairTools" value="resourceRepairKit"/>" added into the 3 items I need it to.  Then my mod would work as it is written.  This would be the MOST compatible with other mods that may work with these 3 items in the game.

2. Within my mod, Delete the 3 items from the game and re-create them from scratch including the Property I need to set.  This would also work for my mod, but would have a higher probability of screwing up another mod by someone else that is working with any of these 3 items.

 

Should I provide 2 downloads and explain the difference to people so that get the correct download to fix this issue for either situation?

 

Should I create a bug report on this????  I do feel it is a bug in the game for modding.

 

Anyone else have any thoughts on this or another fix I am not thinking of?

Link to comment
Share on other sites

When you look closely at both items, you will notice that while meleeToolFireaxeSteel does extend from meleeToolFireaxeIron, it overrides various properties with its own versions, such as Material, CustomIcon, EconomicValue, etc. It does not add its ovn RepairTools property as that would also override the original and that's exactly what you need to do if you want to inject your own RepairTools property into that item.

 

You could start testing with something like this:
 

<remove xpath="/items/item[@name='meleeToolFireaxeSteel']/property[@name='RepairTools']"/>
<insertBefore xpath="/items/item[@name='meleeToolFireaxeSteel']/effect_group[@name='meleeToolFireaxeSteel']">
	<property name="RepairTools" value="resourceIceburgSteelRepairKit"/>
</insertBefore>

Please note that it "could" work without the "remove" statement, but I'm not 100% sure about that, because while the "remove" part may seem redundant since we cannot see the property in the item inside the xml file, due to the extend, this property is actually inherited from meleeToolFireaxeIron once the game loads the item, so this "remove" part is like our way of telling the game to make room for our new property. Well, that's the theory. What the game will actually do with this is a whole different story, I haven't tested it.

Link to comment
Share on other sites

1 hour ago, mlburgoon said:

Awesome help.  Thanks.  Modding like this with XML is different than the programming I am used to.  And way different from the last actual game I wrote years ago.  Learning is happening though.

You're welcome. You may not be aware, but I do understand how you feel about this pretty well and yes, it is very different, sometimes even not quite logical, but then again we are dealing with pure xml and many things have to be nested in nasty ways that sometimes don't make much sense. If you want to work with something more sophisticated, something more like what you were used to, then you should check out DMT modding. That's where the real "business" starts as it gives you an access to the game engine and you can extend it with your own functions and features through C# scripts. That's out of my current scope though, C# is not really my thing, even though I do understand some of it, but yeah, that's not enough for modding this game with DMT.

 

Anyway, did that xml snippet in my last post solve your problem? I would like to know if it works or not, because I was dealing with a similar issue and knowing if this works would also save me some time. Thanks in advance.

Link to comment
Share on other sites

Yes.  It solved it for the fireaxe.  had to modify it for the other 2 because it is not "effect group" it needed to be inserted before.  I ended up changing all three to an insert after and did it after the property "Material".  that way it was a "standard" way of doing it within my xml for all three.  Thinking differently and using other commands really helped a bunch.  I will be using those commands on a couple other little mods I am working on.  I may check out DMT.  The last full game I wrote was over 20 years ago, and even though I still do some programming with my job, games are a different beast.

I am going to be playing this mod (and many others) on a 24hr twitch stream this weekend (hopefully).  All 3 of my mods will be included, of course!

 

Now if I can just figure out where the "repair kit" is defined for vehicles.  Not finding that anywhere.

Link to comment
Share on other sites

2 hours ago, mlburgoon said:

Now if I can just figure out where the "repair kit" is defined for vehicles.  Not finding that anywhere.

 

Considering that vehicles are repaired in a different way than other items, it could be hardcoded somewhere with no access to it, so you may not be able to change it without using DMT, then again using DMT just to change a property of an item seems rather ridiculous. In theory you could make your own vehicle repair tool that would use your custom repair kit or you could take a look at items.xml, specifically at placeable vehicles such as vehicleBicyclePlaceable and see if giving them RepairTools property would do the trick to achieve at least repairing through inventory (it's a long shot which may not work). Alternatively, you could try to do your custom vehicle repair mod. Vehicles are entities with their placeable versions in items where they have DegradationMax properties, so you could try to apply buffs on them that would fix them, again a long shot which I haven't tested myself, just throwing ideas.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...