Scripted effect
set_up_loan_story_effect
set_up_loan_story_effect = { AMOUNT = … INSTRUMENT = … LENDER = … ORIGINAL_DEBTOR = … ORIGINAL_LENDER = … YEARS_SINCE = … }game/common/scripted_effects/00_scripted_effects.txt, line 61 (102 lines). Parameters: $AMOUNT$, $INSTRUMENT$, $LENDER$, $ORIGINAL_DEBTOR$, $ORIGINAL_LENDER$, $YEARS_SINCE$.
set_up_loan_story_effect is a scripted effect in Crusader Kings III, written at line 61 of its file. A call passes 6 parameters: AMOUNT, INSTRUMENT, LENDER, ORIGINAL_DEBTOR, ORIGINAL_LENDER and YEARS_SINCE. The game's script calls it in 2 places, among them set_up_new_loan_effect (scripted effect) and transfer_loan_effect (scripted effect). Patch 1.21.0, from game/common/scripted_effects/00_scripted_effects.txt.
The comment above it in the file
Effect to create a loan story, which allows rulers to have multiple loans ROOT - who owes LENDER - who was owed AMOUNT - for how much INSTRUMENT - type of loan (flag) YEARS_SINCE - and for how long (0 unless transferring loans) ORIGINAL_DEBTOR - by whom originally (new story owner unless transferring loans) ORIGINAL_LENDER - who was owed originally (same as LENDER unless transferring loans)
What it does
create_story = { type = story_cycle_loan save_scope_as = new_loan }If
$INSTRUMENT$ = flag:free
Then
loan_free_interest_effect = { DEBTOR = scope:debtor_temp LENDER = scope:lender_temp AMOUNT = $AMOUNT$ }
Else if
$INSTRUMENT$ = flag:disguised
Then
loan_disguised_interest_effect = { DEBTOR = scope:debtor_temp LENDER = scope:lender_temp AMOUNT = $AMOUNT$ }
Else if
$INSTRUMENT$ = flag:open
Then
loan_open_interest_effect = { DEBTOR = scope:debtor_temp LENDER = scope:lender_temp AMOUNT = $AMOUNT$ }
Otherwise
If
Then
loan_free_interest_effect = { DEBTOR = scope:debtor_temp LENDER = scope:lender_temp AMOUNT = $AMOUNT$ }
Else if
scope:lender_temp:gdp_usury_condemns_loan_trigger = { BORROWER = scope:debtor_temp }NOT = { gdp_usury_untroubled_by_sin_trigger = yes }
Then
loan_disguised_interest_effect = { DEBTOR = scope:debtor_temp LENDER = scope:lender_temp AMOUNT = $AMOUNT$ }
Otherwise
loan_open_interest_effect = { DEBTOR = scope:debtor_temp LENDER = scope:lender_temp AMOUNT = $AMOUNT$ }
• the game's own tooltip text · ◦ our reading of the script line · code the script where neither exists
“They” is whatever it runs on (the scope it is called in). The scripted triggers and effects it calls link to their own pages; $PARAMETERS$ stay as written: each call fills them in.
The script as written (102 lines of game script)
set_up_loan_story_effect = {
save_temporary_scope_as = debtor_temp
$LENDER$ ?= { save_temporary_scope_as = lender_temp }
$ORIGINAL_DEBTOR$ ?= { save_temporary_scope_as = original_debtor_temp }
$ORIGINAL_LENDER$ ?= { save_temporary_scope_as = original_lender_temp }
create_story = {
type = story_cycle_loan
save_scope_as = new_loan
}
scope:new_loan ?= {
# LENDER
set_variable = { name = lender value = scope:lender_temp }
# AMOUNT
set_variable = { name = amount_owed value = $AMOUNT$ }
set_variable = { name = original_owed value = $AMOUNT$ }
# YEARS_SINCE
set_variable = { name = years_since value = $YEARS_SINCE$ }
# REMINDERS
set_variable = { name = reminders value = 0 }
# HISTORY
set_variable = { name = original_debtor value = scope:original_debtor_temp }
set_variable = { name = original_lender value = scope:original_lender_temp }
# DEMAND_COOLDOWN
set_variable = { name = demand_cooldown years = 2 }
}
scope:new_loan ?= {
# Update lender's tracker
var:lender ?= {
add_to_variable_list = {
name = owes_me_money
target = scope:new_loan.story_owner
}
}
}
# INSTRUMENT
if = { # use defined option if set
limit = { $INSTRUMENT$ = flag:free }
loan_free_interest_effect = {
DEBTOR = scope:debtor_temp
LENDER = scope:lender_temp
AMOUNT = $AMOUNT$
}
}
else_if = { # use defined option if set
limit = { $INSTRUMENT$ = flag:disguised }
loan_disguised_interest_effect = {
DEBTOR = scope:debtor_temp
LENDER = scope:lender_temp
AMOUNT = $AMOUNT$
}
}
else_if = { # use defined option if set
limit = { $INSTRUMENT$ = flag:open }
loan_open_interest_effect = {
DEBTOR = scope:debtor_temp
LENDER = scope:lender_temp
AMOUNT = $AMOUNT$
}
}
else = { # determine if none is set
if = {
limit = {
scope:lender_temp.rite = { rite_has_parameter = usury_charitable_lending }
}
loan_free_interest_effect = {
DEBTOR = scope:debtor_temp
LENDER = scope:lender_temp
AMOUNT = $AMOUNT$
}
}
else_if = {
limit = {
scope:lender_temp = {
gdp_usury_condemns_loan_trigger = { BORROWER = scope:debtor_temp }
NOT = { gdp_usury_untroubled_by_sin_trigger = yes }
}
}
loan_disguised_interest_effect = {
DEBTOR = scope:debtor_temp
LENDER = scope:lender_temp
AMOUNT = $AMOUNT$
}
}
else = {
loan_open_interest_effect = {
DEBTOR = scope:debtor_temp
LENDER = scope:lender_temp
AMOUNT = $AMOUNT$
}
}
}
# Set up relation
hidden_effect = {
set_relation_creditor = {
target = $LENDER$
reason = creditor_loan_taken
}
}
if = {
limit = { exists = var:original_owed } # error suppressor
}
}As written in game/common/scripted_effects/00_scripted_effects.txt.
Where it is used
Every place in common/, events/ and history/ that calls set_up_loan_story_effect.
Scripted effects (2)
Source: game/common/scripted_effects/00_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.21.0.