Scripted effect
transfer_loan_effect
transfer_loan_effect = { NEW_DEBTOR = … NEW_LENDER = … OLD_LOAN = … }game/common/scripted_effects/00_scripted_effects.txt, line 620 (76 lines). Parameters: $NEW_DEBTOR$, $NEW_LENDER$, $OLD_LOAN$.
transfer_loan_effect is a scripted effect in Crusader Kings III, written at line 620 of its file. A call passes 3 parameters: NEW_DEBTOR, NEW_LENDER and OLD_LOAN. The game's script calls it in 3 places, among them story_cycle_loan (story cycle), Beyond … (event ep3_laamps.0030) and on_death (on action). Patch 1.21.0, from game/common/scripted_effects/00_scripted_effects.txt.
What it does
Every line of it is script with no tooltip text: the script is below.
The script as written (76 lines of game script)
transfer_loan_effect = {
$OLD_LOAN$ = { save_temporary_scope_as = old_loan_temp }
$NEW_LENDER$ = { save_temporary_scope_as = new_lender_temp }
$NEW_DEBTOR$ = {
save_temporary_scope_as = new_debtor_temp
scope:old_loan_temp = {
story_owner = { save_temporary_scope_as = old_debtor_temp }
var:lender ?= { save_temporary_scope_as = old_lender_temp }
}
if = {
limit = { scope:old_loan_temp.var:instrument = flag:disguised }
add_character_flag = gdp_transfer_disguised_usury
}
if = { # Consolidate existing loans of the same instrument into one simple big loan - same lender
limit = {
any_owned_story = {
story_type = story_cycle_loan
var:lender ?= scope:new_lender_temp
var:instrument ?= scope:old_loan_temp.var:instrument
}
}
random_owned_story = {
limit = {
story_type = story_cycle_loan
var:lender ?= scope:new_lender_temp
var:instrument ?= scope:old_loan_temp.var:instrument
}
change_variable = {
name = amount_owed
add = scope:old_loan_temp.var:amount_owed
}
}
scope:old_loan_temp ?= { end_story = yes } # old story is deleted
}
else_if = { # Transfer without creating a new story (same debtor)
limit = { this = scope:old_loan_temp.story_owner }
scope:old_loan_temp = {
set_variable = {
name = lender
value = scope:new_lender_temp
}
set_variable = {
name = reminders
value = 0
}
}
scope:new_lender_temp = {
add_to_variable_list = {
name = owes_me_money
target = scope:new_debtor_temp
}
}
}
else = { # Transfer by creating a new story (same lender)
set_variable = {
name = inheriting_loan
value = scope:old_loan_temp.var:original_debtor
days = 1
}
set_up_loan_story_effect = {
LENDER = scope:new_lender_temp
AMOUNT = scope:old_loan_temp.var:amount_owed
INSTRUMENT = scope:old_loan_temp.var:instrument
YEARS_SINCE = scope:old_loan_temp.var:years_since
ORIGINAL_DEBTOR = scope:old_loan_temp.var:original_debtor
ORIGINAL_LENDER = scope:old_loan_temp.var:original_lender
}
scope:old_loan_temp ?= { end_story = yes } # old story is deleted
}
if = {
limit = { has_character_flag = gdp_transfer_disguised_usury }
remove_character_flag = gdp_transfer_disguised_usury
gdp_move_disguised_usury_secret_effect = yes
}
}
}As written in game/common/scripted_effects/00_scripted_effects.txt.
Where it is used
Every place in common/, events/ and history/ that calls transfer_loan_effect.
Story cycles (1)
- story_cycle_loan
Events (1)
- Beyond …
ep3_laamps.0030
On actions (the game's own hooks) (1)
- on_death
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.