Banking Framework

[This page is outdated! See instead the wiki page: https://wiki.project-tamriel.com/wiki/Banking_Framework]

Introduction

Tamriel Data contains scripts, activators, and dialogue for a banking framework.
Its features are:

  1. Storing/retrieving money to and from a bank account,
  2. Taking out loans from a bank,
  3. Accounts shared across all branches of a single bank,
  4. Multiple banks with multiple branches each.

While inherently more useful with a gold weight mod, banking serves as another world-building tool as well.

For modders, there are roughly two use cases: either you need to add a new branch of an existing bank or you need to add a new bank to the banking framework in Tamriel Data.

Adding a new bank branch

Bank dialogue and scripts are filtered according to two different values:

  1. The NPC has the banker class (T_Glb_Banker),
  2. the NPC is in a cell with a bank activator.

For example, to create a new bank branch with banking services for the Briricca Private bank, a banker class NPC needs to be in a cell with the T_ScBank_RingBriricca ("Ring of Banking (Briricca)") clothing item.


Example: Old Ebonheart, Briricca Bank

Adding a new bank

Banks consist of a collection of scripts and globals in Tamriel_Data. Dialogue and the script calls are implemented in dialogue replies,
Except for an addition to Greeting 7, everything that needs to be added to or edited is held in Tamriel_Data.esm.

Globals

The most important global is T_Glob_Bank_All_CurrentBank, which controls what bank is currently addressed by the banking scripts.

As it is defined in Tamriel_Data and more than one master file need to use it, it is critically important that no duplicate bank numbers or shorthands are used.

List of Values, Shorthands, and Banks
0   None
1 Bri Briricca private bank (Tamriel province mods)
2 Pet Reserved Dummy - Petrocca private bank (Morrowind Rebirth)
3 Hla Hlaalu council bank (Tamriel Rebuilt)

Three more globals hold the amount for savings and loans and the date the loan is due. They need to be duplicated with the new bank’s shorthand. For the Briricca private bank, these are:

  • T_Glob_Bank_Bri_AcctAmount (Long)
  • T_Glob_Bank_Bri_LoanAmount (Short)
  • T_Glob_Bank_Bri_LoanDate (Short)
  • T_Glob_Bank_Bri_LoanFail (Short)

New Scripts

Three scripts are bank-specific and need to be duplicated with the new bank’s shorthand and edited to use the new bank’s globals:

T_ScBank_Bri_CurrentBank
 
T_ScBank_Bri_LoanCheck
 
T_ScBank_Bri_LoanFail
 

Edited Scripts

Five scripts are bank-agnostic, but need to be edited to handle the new bank’s shorthand and globals. In order to properly showcase the necessary edits, the Petrocca private bank will be added:

T_ScBank_All_Balances
 
T_ScBank_All_Deposit
 
T_ScBank_All_LoanObtain
 
T_ScBank_All_LoanPayment
 
T_ScBank_All_Withdraw
 

 

New script-holder Clothing

For our given example, T_ScBank_Bri_CurrentBank is held in a clothing item, T_ScBank_RingBriricca. As with other "clothing" items, simply placing it in an interior is sufficient to trigger the script that is assigned to it.

This simply needs to be duplicated with the new bank’s shorthand, name, and script. A T_ScBank_Pet_CurrentBank would be held in a clothing item, T_ScBank_RingPetrucca.


The Brircca banking ring exists only for the script.

 

Dialogue

Most dialogue entries are bank-agnostic, but several call on bank-specific globals.

All interactive bank dialogue is handled within Tamriel Data and limited to replies for the following topics:

  • deposit funds
  • take out a loan
  • repay a loan
  • withdraw funds

“Deposit funds” has a dual purpose: it acts both as a means to move money off the character and into the account, but it also covers the creation of an account in the first place.
Just as there is no separate topic to create an account, there is no topic to close one: as soon as an account balance reaches 0, it is automatically closed.

To add a new bank, all replies for these topics need to be checked and duplicated as necessary. Bank-agnostic replies usually have an indication in their result box:


This does not need to be duplicated.


This, as shown by the Global filter, does.


Additionally, if you add a new bank, add a new reply to the following topic in your plugin:

  • Greeting 7


Example implementation in Old Ebonheart.

 

With this done, a new bank has set up shop in Tamriel. Mercantilism ho!