Creating my own patches for small errors

Started by Ace_Loves, August 06, 2016, 08:20:01 AM

Previous topic - Next topic

Ace_Loves

Hello, I'm facing a small issue with missing object reference ID's. sometimes I will load a modded save to find only a single object reference ID is missing. for example my current issue is the verse.ThingsDef Megascarab_leather is missing. A fresh colony doesn't have the error. the missing ID only became a concern after loading the save after a play session without changing the modlist.

I figure that something like redefining the object ID should be a simple patch I can put together myself. Any guide on how I can go about something like this?

CallMeDio

Im far from being a master on this but I will try to help you
Do you get the error if you create a fresh save without mods and keep reloading it over and over without mods?
If no, what mods are activated when you play reload and get the error?
QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

kaptain_kavern

It usually came from difference between loaded mods during the save and their actual state.

Either a mod has been updated since or you add/remove mods since.

What you can try : load a new game, in dev mode spawn the item and save. open the save and look at his ID and compare with the old save

1000101

The ID number is unique to each thing, the game just increments an internal counter for IDs which it combines with the defname to produce a unique ThingID.  Spawning new ones and comparing them to old ones will not yield any useful results.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

kaptain_kavern

Yes I had not understood the question well. Now I realise after your explication

RawCode

Megascarab_leather is not ID, its just defname.

OFC def's have internal IDs and stored inside array by index, still, no "normal" method ever use internal ID for anything and moving Megascarab_leather around won't cause any issues.

If "static" set of mods cause issues related to defs

1) one of mods generate defs at runtime in faulty manner
2) one of mods have invalid defs that cannot be saved correctly
3) one of mods have "virtual" defs that got into savegame due to error of developer
4) set of mods is not actually static, something is changed

Ace_Loves

Hmm.. from what I have understood I believe the source of the error would be a faulty creation of the ThingID like you described. I had not changed my modlist before attempting to launch my save. I have played around with disabling the mods incrementally but it seems the only configuration that clears that missing Def is only with another mod that creates new Def's.

This was what had me thinking that if I could recreate that Def list and fill in the missing information I could patch this issue. Though I'm not familiar with the specific language used in the game's source I'm not a stranger to programming so I thought I could fiddle my way through to patching it. That being said though I don't know where to start with rimworld. Thanks for the help so far guys!