Fallout 4

Since version 1.1, RobCo Teleshopping supports the injection of "Currency Providers". A Currency Provider will be displayed in the settings under "Currency", but it can also be used to implement different payment methods alltogether.


Preparation
For the basic setup, see the other article. You need to setup a quest and a version global the same way.

Adding a simple Item Currency
"Item Currency" here means: there is an item which serves the role of a currency, like Pre-War Money. These do not need scripting.

Let's say you want to use Gold Bars (c_Gold_scrap) as a currency.

To start, create two Messages, one for the short and one for the long currency name. For Dollar, these are "$" and "Dollar", The short name is going to be put  before the price in most lists, like "$10". The long name will be added after the price in some other views, like "10 Dollars". Here, you could use "Au" for the short name and "Gold" for the long. Put them into the Message's Title field.

Then, duplicate the activator "praTS_CurrencyProvider_PreWarMoney" or "praTS_CurrencyProvider_Bottlecaps" (it doesn't matter).
Call it something like "myMod_CurrencyProvider_Gold".

Set the activator's name to what you want to appear in the Currency menu, like "Gold Bars".
Configure the script "praTS:CurrencyProviderItem" as follows:

  • "CurrencyItem": point this to your item, here, "c_Gold_Scrap".
  • "CurrencyNameLong": point this to the message holding the long name.
  • "CurrencyNameShort": point this to the message holding the short name.

Adding something more complex
If you want to do something more complex, like implementing payment using something which is not an item, or something which cannot be in the player's inventory, you can do this by extending the script "praTS:CurrencyProvider", and attaching it to a new Activator.

Override and implement the script's functions like this:
  • "float function getCostFactor()": this function must return how much one unit of your currency costs in caps. If it's intended to just represent caps, but stored somewhere else, return 1. If it is an item, you can return "itemBaseForm.getGoldValue()".
  • "int function getPlayerFunds(Actor playerRef)": return how many units of your currency are owned by the player.
  • "bool function canPlayerPay(Actor playerRef, int total)": return true or false, depending on whenever the player is able to pay right now. The second argument "total" is the total sum in your currency, which the player would require to pay. In the simplest case, just compare it to whatever getPlayerFunds returns. This will be called before the payment messagebox is shown when activating the cash register, and determines whenever the "Place Order" button is enabled.
  • "function performPayment(Actor playerRef, int total)": Remove "total" units of currency from the player. This will be called if the player clicked "Place Order" in the payment messagebox.
  • "function performRefund(praTS:TeleshoppingBeacon beacon, Actor playerRef, int total)": Refund "total" units of currency. If the currency in question is an item, you should add this many instances of the item to "beacon.MailboxRef". The idea is: player has deposited the items into the cash register, and now the beacon dumped them into the mailbox for the player to pick up.
    This will be called if the player cancels the delivery from the terminal, or something goes wrong with the beacon or the eyebot.


You are still required to fill out the activator's name and the two properties "CurrencyNameLong" and "CurrencyNameShort" as described above, in order to make the mod display it properly.
Registering the Currency.
To actually make RobCo Teleshopping aware of the new currency, simply add the Currency Activator to the "myNewCurrencies" property on your injector quest.

Article information

Added on

Written by

pra

0 comments