Ludeon Forums

RimWorld => Mods => Help => Topic started by: Oddness on November 17, 2021, 08:49:13 AM

Title: [Solved] My Mod Changes Not Showing
Post by: Oddness on November 17, 2021, 08:49:13 AM
Hi. I'm kind of a beginner to modding Rimworld, and definitely a novice with C#, so I'm sure that the problem is something simple. Here's my problem:

I'm trying to edit a file in Jerecell's "Rimworld of Madness - Vampires" mod. Here's the original Source code (Provided)

public class CompVampire : CompAbilityUser
        {
        (...)
        public int Level
        {
            get => level;
            set
            {
                if (value > level && value != 0)
                {
                    abilityPoints++;
                    if (XP < ((value * 600) * ((IsGhoul) ? 2 : 1)))
                    {
                        XP = ((value * 600) * ((IsGhoul) ? 2 : 1));
                    }
                }
                else if (value == 0)
                    XP = 0;
                level = value;
            }
        }


        I've tried several approaches, but my goal is to either edit the amount of XP gained under certain situations or to edit the amount of XP required under those circumstances. I've accomplished both of these (The logic is sound and things are compiling), but no matter what I do, I can't get my changes to take priority over Jerecell's mod (Overwrite his behavior), even if mine is loaded after his. What am I doing wrong? Any help would be appreciated.

Solution:
I'm putting a solution here in case someone else is having a similar problem. I wasn't updating the Defs correctly. I just referenced my class in Defs, and problem solved.
Title: Re: My Mod Changes Not Showing
Post by: Oddness on November 17, 2021, 12:33:14 PM
Update:
Kind of looking like a scoping issue (Maybe), since I wasn't referring to values in the base class that I'm modifying, but my own. (That's fixed)
It was "XP" or "Level", as shown in the original mod, but now I'm referencing the base class to change those values (i.e. base.XP and base.Level)

Also, it appears that the base class is using this method, which I'm only just now becoming familiar with:

PostExposeData()

to "scribe" the values which I'm trying to modify. So, I suppose my goal is to scribe my own values, rather than the mod author's in certain situations. I've been at this for a few days, so if anyone knows anything, you definitely know more than me, and any help that can save me some research time would be much appreciated.