Scripted effect
laamp_rewards_disburse_ordinary_currency_effect
laamp_rewards_disburse_ordinary_currency_effect = { CONTACT = … CONTACT_HOOK = … EXTRA_REWARD = … GOLD = … OPINION = … OPINION_TYPE = … PIETY = … PRESTIGE = … PROVISIONS = … }game/common/scripted_effects/00_laamp_effects.txt, line 410 (190 lines). Parameters: $CONTACT$, $CONTACT_HOOK$, $EXTRA_REWARD$, $GOLD$, $OPINION$, $OPINION_TYPE$, $PIETY$, $PRESTIGE$, $PROVISIONS$.
laamp_rewards_disburse_ordinary_currency_effect is a scripted effect in Crusader Kings III, written at line 410 of its file. A call passes 9 parameters: CONTACT, CONTACT_HOOK, EXTRA_REWARD, GOLD, OPINION, OPINION_TYPE, PIETY, PRESTIGE and PROVISIONS. The game's script calls it in 57 places, among them laamp_base_0001 (contract), laamp_base_0011 (contract) and laamp_base_0021 (contract). Patch 1.20.1.2, from game/common/scripted_effects/00_laamp_effects.txt.
The comment above it in the file
General logic for giving out the appropriate amount of currencies to a laamp upon contract completion.
What it does
scope:employer:If
scope:gold != 0
Then
If
- Government allows: barter
- Barter Goods more than 0
gold < scope:gold
Then
scope:taker:add_gold = { value = scope:barter multiply = define:NBarter|BARTER_GOODS_TO_LOOT_MULT }
remove_barter_goods = scope:barter
If
scope:gold > 0
Then
If
- scope:taker: Is played by a person
Then
If
scope:task_contract:is_criminal = yes
Then
pay_short_term_gold = { target = scope:taker gold = scope:gold }
Otherwise
pay_treasury_or_gold = { target = scope:taker value = scope:gold }
Else if
short_term_treasury_or_gold >= $GOLD$
Then
If
scope:task_contract:is_criminal = yes
Then
pay_short_term_gold = { target = scope:taker gold = scope:gold }
Otherwise
pay_treasury_or_gold = { target = scope:taker value = scope:gold }
Otherwise
- scope:taker: They gets …
scope:taker:If
$PRESTIGE$ != 0
Then
add_prestige = { … }
If
$PIETY$ != 0
Then
add_piety = { … }
If
$PROVISIONS$ != 0
Then
- Their domicile:
change_provisions = { … }
If
$OPINION$ != 0
Then
reverse_add_opinion = { modifier = $OPINION_TYPE$ target = scope:employer opinion = $OPINION$ }
If
scope:add_contact_toggle != flag:no
Then
add_contact = scope:employerIf
scope:add_contact_hook_toggle = flag:yes
Then
add_hook_if_possible_default_length_effect = { TARGET = scope:employer TYPE = contact_list_weak_hook }
• 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 (120 lines of game script)
laamp_rewards_disburse_ordinary_currency_effect = {
# Grab some scope for ease of access.
save_scope_as = task_contract
task_contract_employer = { save_scope_as = employer }
task_contract_taker = { save_scope_as = taker }
# Gold.
scope:employer = {
# Yes, this is necessary. We get boot errors if we compare a direct script value vs. zero: maths works out, it's just Jomini Magic doin' its thing.
save_scope_value_as = {
name = gold
value = {
value = $GOLD$
if = {
limit = { $EXTRA_REWARD$ = flag:yes }
multiply = task_contract_extra_reward_multiplier_value
}
round = yes
}
}
if = {
limit = { scope:gold != 0 }
# for wanua we take barter goods first if they donn't have enough gold
if = {
limit = {
government_allows = barter
barter_goods > 0
gold < scope:gold
}
save_scope_value_as = {
name = barter
value = {
value = scope:gold
divide = define:NBarter|BARTER_GOODS_TO_LOOT_MULT
max = barter_goods
}
}
# pay it at once
scope:taker = {
add_gold = {
value = scope:barter
multiply = define:NBarter|BARTER_GOODS_TO_LOOT_MULT
}
}
remove_barter_goods = scope:barter
save_scope_value_as = {
name = gold
value = {
value = scope:gold
subtract = {
value = scope:barter
multiply = define:NBarter|BARTER_GOODS_TO_LOOT_MULT
}
}
}
}
if = {
limit = { scope:gold > 0 }
# We pay players directly.
if = {
limit = {
scope:taker = { is_ai = no }
}
if = {
limit = {
scope:task_contract = {
is_criminal = yes
}
}
pay_short_term_gold = {
target = scope:taker
gold = scope:gold
}
}
else = {
pay_treasury_or_gold = {
target = scope:taker
value = scope:gold
}
}
}
# Otherwise only deduct gold if the AI can afford it.
else_if = {
limit = { short_term_treasury_or_gold >= $GOLD$ }
if = {
limit = {
scope:task_contract = {
is_criminal = yes
}
}
pay_short_term_gold = {
target = scope:taker
gold = scope:gold
}
}
else = {
pay_treasury_or_gold = {
target = scope:taker
value = scope:gold
}
}
}
# Else we magic the gold up so we don't bankrupt people foolishly.
else = {
scope:taker = { add_gold = scope:gold }
}
}
}
}
# Everything else.
scope:taker = {
# Prestige.
if = {
limit = { $PRESTIGE$ != 0 }
add_prestige = {
value = {
value = $PRESTIGE$
if = {
limit = { $EXTRA_REWARD$ = flag:yes }
multiply = task_contract_extra_reward_multiplier_value
}As written in game/common/scripted_effects/00_laamp_effects.txt.
The first 120 of its 190 lines; the rest is in game/common/scripted_effects/00_laamp_effects.txt from line 410.
Where it is used
Every place in common/, events/ and history/ that calls laamp_rewards_disburse_ordinary_currency_effect.
Task contracts (57)
- laamp_base_0001
- laamp_base_0011
- laamp_base_0021
- laamp_base_0031
- laamp_base_0041
- laamp_base_1001
51 more
- laamp_base_1011
- laamp_base_1021
- laamp_base_1031
- laamp_base_1041
- laamp_base_2001
- laamp_base_2011
- laamp_base_2021
- laamp_base_2031
- laamp_base_2041
- laamp_base_3001
- laamp_base_3011
- laamp_base_3021
- laamp_base_3031
- laamp_base_3041
- laamp_base_4001
- laamp_base_4011
- laamp_base_4021
- laamp_base_4031
- laamp_base_4041
- laamp_base_4100
- laamp_base_5001
- laamp_base_5011
- laamp_base_5021
- laamp_base_5031
- laamp_base_5041
- laamp_base_5051
- laamp_base_6001
- laamp_base_6011
- laamp_base_6021
- laamp_base_6031
- laamp_boost_legitimacy_contract
- laamp_cultural_minority_contract
- laamp_eliminate_heir_contract
- laamp_fight_faith_conversion_contract
- laamp_find_secret_contract
- laamp_gain_wanderer_contract
- laamp_help_fabricate_claim_contract
- laamp_help_faith_conversion_contract
- laamp_help_find_secrets_contract
- laamp_help_increase_control_contract
- laamp_help_train_commanders_contract
- laamp_prison_break_contract
- laamp_religious_minority_contract
- laamp_rid_councillor_contract
- laamp_steal_artifact_contract
- laamp_transport_animal
- laamp_transport_artifact
- laamp_transport_explorer
- laamp_transport_gold
- laamp_transport_vip
- laamp_transport_ward
Source: game/common/scripted_effects/00_laamp_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.