Trying to make a patch for the first time

Started by Sp0nge, July 06, 2017, 12:27:13 PM

Previous topic - Next topic

Sp0nge

So im trying to patch Weapon Tech A17 into Combat Extended on my own. Apparently it didnt go that well. I tried to patch one gun first, and load it up, but that gave me errors: Exception reading WeaponTech_Guns.xml as XML: System.Xml.XmlException: 'li' is expected  Line 49, position 8.

And this is the stuff i wrote up: https://pastebin.com/DFX7LVcw

What did I mess up here?

This is the help i had on making this: https://github.com/NoImageAvailable/CombatExtended/wiki/Creating-an-xpath-patch

skullywag

You have a random closing li after the research prereq i think.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Sp0nge

Ive been trying looking at my li`s, however as far as my knowledge goes, i cant see any issues. I pastebinned what ive written in the OP thread

T-Bone

From what i can see by just trying to ppretty print your xml, your researchPrerequisite starting tag is actually a closing tag, making the xml invalid. Removing the / should help.

skullywag

Good spot. Yeah its this:

</researchPrerequisite>CE_AdvancedFirearms</researchPrerequisite>
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Sp0nge

I did infact remove that /, it resultet in my game loading up using 100x the time compared than normal, with errors (ill have to reload my game again to get that error), and whenever i tried to spawn in said gun into the game, it threw me errors again, and i was unable to interact with it, it was just on the ground.

I added to the OP the source of where i started with this. Modding in Rimworld dont seem that hard, I just guess my mindset needs abit of an adjust before i can really dive into this stuff (hard for an old man to learn new stuff ;) )

T-Bone

Modding rimworld is actually remarkably easy, especially with the new patching feature. It does seem to get harder when using custom patching methods of a mod, like you're trying though... ;D

I'm not using combat extended myself, so i have no idea what it's supposed to do other than "make things compatible". What errors exactly are you getting after fixing the xml?

Sp0nge

So when i modified the xml some (apparently thingsdef wasnt as straight forward as i thought), i changed the materials to make the gun from Wood to WoodLog, that atleast solved the issue with startuperrors, the gun is, apparently, loaded in as it should with its new stats.

XML im using for the testpatching: https://pastebin.com/ssqYYYBN

However the loadingtime is hugely increased and im getting this error: https://pastebin.com/5RNq7HWq

Im guessing ill have to dive into Allowtools aswell, and see whats going on there ...


skullywag

Yeah try without that mod a sec see if its any faster, ive asked NIA and he says it should work fine and not be that slow.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Sp0nge

Im pretty shure the error is on my end, and not towards any of the other mods. I never coded a thing in my life before, i have however felt myselfe been capable of reading C++ coding (did some minor Minecraft errorsourcing back in the days).

I think its all about wrapping my head around this mindset, then i should be capable of doing this. However my biggest issue is that despite if i read howtoes and similar, I never learn, of sorts ...

That said, the modlist im using do run completely fine, untill i try to inject my own stuff!

skullywag

Is that when starting the game or on loading a map, if its latter try from scratch.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Sp0nge

A new weekend, a new set of fresh and cold beers, ready to take on this thing yet again!

I think ive gotten my head around this now. The testweapon gets its correct stats, allowtools aint giving me errors, now only the sidearm mod is doing me no good, weapon lost in inventory :p.

But im getting there, im getting there! Tnx for the help guys, ill make shure to post again at my next crossroad :P

Sp0nge

So learning by doing: I somehow swapped modloading order some, and that was my issue, it had nothing to do with any of the mods i was trying to affect, and now its basicly working as intended :).

Im doing this thing with a heavilly modded Rimworld, so i guess ill have to apply alot more pathcing than I originally intended, but it should be worth it when its all done :)

Sp0nge

#13
So ... starting to get the hang of this now! Using Github and all that fancy stuff :)

However im kinda stuck again now. Right now I am trying to xpatch an animal into CE using this: https://tinyurl.com/y8bomctl (linked to my github). But those few stats ive put in wont be transfered to ingame. No errors when it loads, but guessing that I`m targeting something wrong here. Tried to read those tutorials, but as with when I first started this, I need some guidance so my head will wrap around all of this.

The errors i had in the beginning is now totally out of the way, I`m almost ashamed that I made the post just for that in the first place :P

Edit: If this helps, this is the animal im trying to patch: https://github.com/thirite/AnimalCollabProject/blob/master/Defs/ThingDefs_Races/Races_Animal_Angora.xml

kaptain_kavern

Try with <xpath>*/ThingDef["ACPAngoraRabbit"]/statBases/MoveSpeed</xpath> instead of <xpath>*/ThingDef[@Name="ACPAngoraRabbit"]/statBases/MoveSpeed</xpath>

Sorry I'm on my phone ;)