Page 1 of 3

Redoing the Banking System

Posted: Sat Feb 13, 2021 8:54 pm
by Vaitle
Hello!

I am new to modding with an elementary understanding of programming and though I have tried to investigate on my own without assistance it would seem I need a nudge in the right direction.

I want to develop a mod that changes the way the banking system in the game, however as per usual my ambitions for everything I want to eventually do is a little bit to high for my capabilities. For now I want to overhaul the way loans are done and so far I have found the part of the game code that deals with banking and the transactions. My trouble now is finding out how to actually modify it. Based on my elementary understanding of programming the functions I would wanna deal with are static which means I cannot override them, I can only call them. I was thinking maybe modifying loan amounts after calling the original functions but I have been trying to find an alternative method of doing so. I tried remaking some of the functions in a separate script but the game uses the original file.

I have also tried looking at other mods (specifically Roleplay and Realism, and some overhaul mods) but from what I am looking at I cannot see any similarities that I could apply to modifying the banking system so I have decided I would ask.

I would appreciate any nudge in the right direction to help out, I hate to ask for help so early but I am kind of stuck in all honesty.

Re: Redoing the Banking System

Posted: Sun Feb 14, 2021 8:36 pm
by Vaitle
Well with a little more digging I seem to be approaching this at the wrong angle!

Instead of trying to directly override the bank/loan formulas, I can just override the GUI and inject my own code that way.

However, now I am having the problem of registering the custom UI to show up properly, I have it registered in my Init method of the mod, but it seems that it is not cooperating with running the Setup() function and doesn't seem to want to show up unless I forcibly call it, even if I do forcibly call it my buttons and such are sadly not showing up or perhaps I am doing this way wrong, either way I have solved one problem at least and it would seem I am going to be solving another now.

Re: Redoing the Banking System

Posted: Sun Feb 14, 2021 9:51 pm
by Hazelnut
Yes you can override the UI window via mods but not the BankingManager that does all the work behind the scenes. So if what you need to change for your redo is in the UI you're all good.

Re: Redoing the Banking System

Posted: Mon Feb 15, 2021 1:55 am
by Vaitle
Is it possible to have my custom UI just lead to my own custom code instead? Part of what I wanted to do was redo the loan formula to something I thought would be more appropriate. I was hoping I could just bypass the source code using the customized UI. I am thinking in theory I should be able to override the regular UI with my own (but identical looking) and just handle the events to go my own functions instead of the normal ones, if I cannot do that however then that will make what I want to do a lot harder I am afraid.

So far I am still having trouble with the UI coming up though so I have a long way to go to worrying about that :D.

Re: Redoing the Banking System

Posted: Mon Feb 15, 2021 11:22 am
by Hazelnut
Not really, the bank manager is quite old code and is hooked into all sorts of places. I took a look and the loan parameters are currently hardcoded in there. I'll have a think about pulling them into a formula that can be overridden. It's something that's been on my todo list for a while for R&R mod to lower the amount you can borrow from a bank having just washed up onshore... I'd think banks would be more cautious. :)

What kind of changes were you thinking of doing? The UI could do with an overhaul, the DF bank UI is pretty awful.

Re: Redoing the Banking System

Posted: Mon Feb 15, 2021 3:43 pm
by Vaitle
Oh man I have LOTS of things I want to do with the banking system, like I said I am REALLY new with programming and I would count this as my first real project so a lot of things are just outside my capabilities currently. Things I was thinking of doing off the top of my head:
  • 1. Redoing the loan formula so instead of using level it would mainly use mercantile (and maybe a bit of personality/luck?) to determine how much you get while capping it waaaay below what it is currently. Only problem with this is I do not want to screw over characters that don't take any mercantile so I am still thinking about how I would want to do that, it is why I was considering using personality in the formula.

    2. Making different types of loans (General, House, and Airship if you have that mod in there....), all with differing interest rates and minimum amounts that would have to be borrowed. I don't want the player to just borrow 30k and go crazy

    3. Differing interest rates on the loans per region, nothing to crazy maybe a 1-3% difference just for some extra flavor

    4. Actual consequences for defaulting on loans :D
    4a. Add a quest from a noble/banker for getting some expensive scroll/item to "forgive" your debt if you have defaulted on a loan, ideally I would probably make the quest quite drawn out because if I made it to easy the player would never actually have any incentive to pay back their loan with gold and would rather just do a dungeon crawl. Maybe limit it to a one time forgiveness perhaps?

    5. Separate all the regional banks into their own guilds away from the merchants that are unique per region (think like the Knights orders), as for services this guild could offer and the skills they would use is another question entirely....there is really not much "Merchant" skills in this game and your mod already covers the language skills ;) (and why would banks use language skills anyway?). There is also only so many services I could think of that have to do with....well gold.

    6. Opening an account requires a minimum gold investment, I just don't think the banks would just let some random adventurer open an account for free without some kind of funds (maybe add in a free waiver if you're part of a knightly order in the region?). However most people start the game with around 200-500 gold I think so perhaps this isn't needed

    7. Interest rates on held gold, nothing really that much as that could easily be cheesed, more for flavor than anything

    8. Options for collateral on house/airship loans? Only problem with this is if people are not aware of what it is I wouldn't want them losing items they got
That's just what I could come up with, the reason I want to make this is precisely because I never found any mods that really touch the banking system, or if they do they haven't really did what I would want done to it. I want to strike that balance between being realism while not being to tedious because if I just made the baking system like real life you'd spend most of the game doing monthly payments on huge loans and you'd never really have a reason to even touch the banks. I also think they are a good chance I could attempt to write guild quests and make them into a separate guild the player could join, also could extend this to a merchants guild of some kind to....I have always liked games that give the choice of being a merchant instead of a knight, but like I said that one is a big question mark because I do not know what services or skills they could provide/use.

Anyway though that's just a small list I thought of right now, since a lot of this is very ambitious and probably outside my capabilities I only want to focus on #1 right now to be able to do something instead of staring at my blank editor wondering how to do things.

As for a GUI re-design....honestly that wasn't really in my plans as I think any GUI I come up with would be 1000x worse than the original :D. I was moreso looking to copy the current design and just have the buttons on there lead to my own code, but I suppose if I cannot do that....The one thing I could think of is to take away the textbox and make it a pop-up box instead for entering in how much gold you would want to deposit/withdraw/borrow. Also moving the text labels into their own separate option (think like a "Account Status" button of some sort?). That is not even considering however that I cannot make textures/sprites of any sort.

Anyway that wall of text is a little of what is swimming through my head, I do not even know if I can really do all of what I want to do, but I decided since there is no mod that tackles the banking system I would attempt it myself ^^. If I cannot redo any of the formulas however....would the quests be an option perhaps?

Re: Redoing the Banking System

Posted: Mon Feb 15, 2021 5:32 pm
by l3lessed
I would love to see all your changes. I would also love to see some type of standing system for different regions affect banking. The better the standing/credit in the community/region the better terms your banker will provide because they know you're good for the money + interest.

Be cool to have banks in regions lock you out if you cause to much problems, even seize assets if you're deemed a traitor/criminal by the high courts.

Re: Redoing the Banking System

Posted: Mon Feb 15, 2021 7:14 pm
by Vaitle
l3lessed wrote: Mon Feb 15, 2021 5:32 pm I would love to see all your changes. I would also love to see some type of standing system for different regions affect banking. The better the standing/credit in the community/region the better terms your banker will provide because they know you're good for the money + interest.

Be cool to have banks in regions lock you out if you cause to much problems, even seize assets if you're deemed a traitor/criminal by the high courts.
Now seizing assets is something I can get behind depending on legal reputation, I was thinking about doing a "credit score" type thing per reigon, my only problem with that however is that there is not many "gold sinks" in this game that would warrant taking out a lot of loans and such, perhaps I could lock players out of bigger loans depending on level and mercantile? Maybe add more reasons to get big loans in this game :D.

Re: Redoing the Banking System

Posted: Tue Feb 16, 2021 3:37 am
by daggerdude
I love these ideas!

Re: Redoing the Banking System

Posted: Fri Feb 19, 2021 2:49 am
by Tkia
Vaitle wrote: Mon Feb 15, 2021 3:43 pm
4. Actual consequences for defaulting on loans :D
4a. Add a quest from a noble/banker for getting some expensive scroll/item to "forgive" your debt if you have defaulted on a loan, ideally I would probably make the quest quite drawn out because if I made it to easy the player would never actually have any incentive to pay back their loan with gold and would rather just do a dungeon crawl. Maybe limit it to a one time forgiveness perhaps?
There is a consequence currently. I was poking around in the save file of an imported classic game when I found a defaulted loan flag. After tracking down that region 45 was Pothago I wandered over there and found he was hated and arrest on sight. I even tried sneaking into the bank and paying it off but that didn't clear the persona non grata flag and I couldn't work out any way to repair the faction so a quest option would be great.

I also discovered why one of my low level imports was living in a large ship. That would be due to his large loan! And the only way I found that was to go into the nearest bank and check. Luckily that one was in the province he was currrently in and I got it paid back in time. So if you're doing a banking mod please include some kind of status interface to tell us what loans are where with due dates and amounts so we can keep better track of our finances. :?