Eliminating/reducing wealth scaling for raids

Started by levgre, May 19, 2016, 12:28:13 AM

Previous topic - Next topic


I want to mod the game so raids solely scale with time, rather than wealth.  I'm guessing this has to be done in the C#

So far the two files I've discovered that may be key are IncidentMakerUtility and IncidentMaker_MainRandom. 

PointsPer1000Wealth and PointsPerColonist I would like to adjust, Although I haven't coded C# I think perhaps IncidentMaker_MainRandom may be where those variables are used.

namespace RimWorld
    public static class IncidentMakerUtility
        private const float WealthBase = 2000f;

        private const float PointsPer1000Wealth = 11.5f;

        private const float PointsPerColonist = 40f;

        private const float MinMaxSquadCost = 50f;

        private const float BuildingWealthFactor = 0.5f;

        private const float HalveLimitLo = 1000f;

        private const float HalveLimitHi = 2000f;

public class IncidentMaker_MainRandom : IncidentMaker

        public override IncidentParms ParmsNow(IncidentCategory incCat)
            IncidentParms incidentParm = IncidentMakerUtility.DefaultParmsNow(base.Def, incCat);
            IncidentParms incidentParm1 = incidentParm;
            incidentParm1.points = incidentParm1.points * Rand.Range(0.5f, 1.5f);
            return incidentParm;

So I guess I'm looking for help to see if I'm on the right track, and at least an overview of the steps that will be needed. I already have a decompiler and IDE set up to make dll mods, not sure what files I'll need to make/change.  It seems maybe I could just adjust some numbers in IncidentMakerUtility?  Although it seems them being private const may require some workaround.


you dont need to change any files.

check randy random xml defs and post inside this thread what you found.


Have looked at the storyteller XML before, not seeing right now how to control raid scaling.  I see some variables are set in XML that seem to determine whether small or large threats occur, can other variables be set similarly?  Like even wealthbase or pointsper1000wealth?

    <label>Randy Random</label>
      <description>Randy doesn't follow rules. He'll generate random events, and he doesn't care if they make a story of triumph or utter hopelessness. It's all drama to him.</description>
      <quotation>The world is random, dude. Stories should be too! Hey, you got a light?</quotation>


You actually want to make your own variation of the IncidentMakerUtility class and point to that.

Of course you would be sort of reinventing the wheel, because in Less Incident Trolling I have raid scaling which is based on a small fraction of wealth (like I think 2% of building wealth) and mostly scales according to the number of colonists.


someone helped me set it up in chat, but perhaps you or someone else could help with this question.  Could I potentially make raids scale 'only' with time (threatScale?).  Having a tough time navigating the Assembly-Csharp and seeing what happens where.  Not sure if IncidentMakerUtility finalizes the raid, or if another class(es) does.

Gonna do a test run, make the scaling .01 and set threat scale to a huge amount and see what happens


No, all IncidentMakerUtility does is determine the number of points available to a raid, but it does multiply that by threatScale.

I guess that you could make raids scale with time, but it might be easier to look at the way it already scales at the beginning of the game. For example, your first raid always has fixed points. After that, subsequent raids apply a multiplier to the raid points - it actually reduces the raid points to begin with, then you get normal raid points after about six raids or so.

So you could tweak that and have raids scale up according to how many raids there have already been. Of course, with a linear multiplication, raids will get quite big because there's no limit to how large they can get.


ckeck DefaultParmsNow method for actual rules.

if you want custom scale, you need to hook at lower level, IncidentWorker_RaidEnemy get calculated value, not each factor as separate variable