Regional Decisions...

Moderator: Pocus

Post Reply
Private First Class - Opel Blitz
Private First Class - Opel Blitz
Posts: 1
Joined: Mon Apr 17, 2017 12:35 am

Regional Decisions...

Post by Belizan » Sun Aug 02, 2020 10:44 am

I was wondering how hard it was to mod regional decisions?

I found the localization test for regional decisions in `Text51.txt`. Some code seems to be in `RegionDecisions.bsf`. Not sure what bsf script is.. looks like some sort of c++ template driven mess :)... So I decided to trace a single decision, like... `recruit local units`

Its name (and a few other strings) are in the txt file with the id


The bsf file has basically an init section where it hard code sets some details for a region decision...

// 9 - Recruit local units
// Using this regional decision, you'll be able to get two provincial units even if there is no formed province here.
gRGDTpls[9].image = "MODIFIERS\MOD_Icon_CitizenArmy.tga";
gRGDTpls[9].cartouche = "EVENTS\LocalEvent_06_BattleBarbarian.tga";
gRGDTpls[9].delay = 0;
gRGDTpls[9].triggerAtStartOfTurn = TRUE;

gRGDTpls[9].conditionsID[0] = RGD_COND_MustBeOwned
gRGDTpls[9].conditionsVisible[0] = FALSE;
gRGDTpls[9].conditionsID[1] = RGD_COND_Leader
gRGDTpls[9].conditionsParams[1][0] = 1

gRGDTpls[9].resourcesCost.amount[gResourceMoney] = 100;

gRGDTpls[9].preselect_OwnedGroup = TRUE;
gRGDTpls[9].preselect_AtWar = TRUE;
gRGDTpls[9].preselect_MinMoneyLevel = SYS_LEVEL5_HIGH;
gRGDTpls[9].weight_UnitCount = TRUE;

This seems to set icons and certain standardized conditions which there are templates for in the same .bsf, but there's also scriptID `$RGD_RECRUIT_PROVINCIAL`...

Now none of these functions are commented, but... These are referenced in `Decisions_RegionalDecisionsRenew` which I'm guessing is where you draw RGDs. Or more correctly, build up the "pick bag" with options in it to draw from... There seems to be a max number of each RGD type by faction, so you can't store extra, so adding one will throw off, potentially the "balance" of which might be available and allow your "hand" of RGDs to potentially become bloated with decisions you don't care about, but...

Then it looks like in `Events.bsf`, through some mechanism I haven't found, using the conditions above, the RGD is generically "played" which then causes an event to get queued, which is triggered similar to normal events in `Decisions_Regional_TriggerAll`? So this walks an array of RGDs that have been activated... and we get to a call to `Decision_Regional_Recruit_Provincial` to run RGD #9, which then handles the specific logic for RGD9 using a bunch of predefined helpers :/... Do you own the region, rgd playable, the criteria for which I'd have to track down, etc. then it creates the group, units, assesses cost and sets up a notification or some sort.

So... in order to add an RGD, one needs to got to `MapGlobals.bsf` and add one to the `RGD_NUM` I assume, then add the name, and message strings in `Text51.txt`, add the conditions in `gRGDTpls` under a new index, presumably non-sparse, so like... 20 (presumably allocated already based on RGD_NUM). Add it to the pickbag for the correct government types, etc. in `Decisions_RegionalDecisionsRenew`, add it to the trigger all function, add the function to handle the event firing with whatever logic you want (which is a whole other issue)... And then... you're done (assuming you don't need to invent a new type of RGD_COND)? I guess it pre-expands the strings into `gRGDTpls` so no mapping is required (`sprintf(gString, "IDS_RGD_NAME%d", i);`). Is there anything else that's needed? (not counting new `.tga`s and what not if one is trying to be all precious about it 8). Anyone added one of these before?

Post Reply

Return to “MOD”