Scripted effect
spawn_join_war_contracts_effect
spawn_join_war_contracts_effect = { ATTACKER = … DEFENDER = … LAAMP = … WAR = … }game/common/scripted_effects/00_laamp_effects.txt, line 161 (190 lines). Parameters: $ATTACKER$, $DEFENDER$, $LAAMP$, $WAR$.
spawn_join_war_contracts_effect is a scripted effect in Crusader Kings III, written at line 161 of its file. A call passes 4 parameters: ATTACKER, DEFENDER, LAAMP and WAR. The game's script calls it in 2 places, among them on_war_started (on action) and player_adventurer_contract_generation_on_domicile_moved_effect (scripted effect). Patch 1.20.1.2, from game/common/scripted_effects/00_laamp_effects.txt.
What it does
Every line of it is script with no tooltip text: the script is below.
The script as written (120 lines of game script)
spawn_join_war_contracts_effect = {
$WAR$ = { save_scope_as = war }
$ATTACKER$ = { save_scope_as = attacker }
$DEFENDER$ = { save_scope_as = defender }
$LAAMP$ = {
#spawn a defensive join war contract, if defender is weaker than attacker or in a civil war
if = {
limit = {
OR = {
task_contract_join_war_attacker_strength_ratio_value > 1
scope:war = {
using_civil_war_cb_trigger = yes
}
}
can_create_task_contract = {
type_name = laamp_join_war_contract
employer = scope:defender
}
}
send_interface_message = {
type = msg_task_contract_created
title = join_war_contract_spawn.t
desc = join_war_contract_spawn.desc_defender
left_icon = scope:attacker
right_icon = scope:defender
create_task_contract = {
task_contract_employer = scope:defender
task_contract_type = laamp_join_war_contract
task_contract_tier = scope:defender.task_contract_tier_value
location = scope:defender.default_location
save_scope_as = new_contract_defender
}
}
scope:new_contract_defender = {
set_variable = {
name = retain_despite_distance
value = yes
}
set_variable = {
name = task_contract_war
value = scope:war
}
set_variable = {
name = task_contract_employer
value = scope:defender
}
set_variable = {
name = task_contract_target
value = scope:war.primary_attacker
}
}
}
#spawn an offensive join war contract for the same war, if attacker has +/- 60% the strength of defender
if = {
limit = {
task_contract_join_war_attacker_strength_ratio_value >= 0.4
task_contract_join_war_attacker_strength_ratio_value <= 1.6
can_create_task_contract = {
type_name = laamp_join_war_contract
employer = scope:attacker
}
}
send_interface_message = {
type = msg_task_contract_created
title = join_war_contract_spawn.t
desc = join_war_contract_spawn.desc_attacker
left_icon = scope:attacker
right_icon = scope:defender
create_task_contract = {
task_contract_employer = scope:attacker
task_contract_type = laamp_join_war_contract
task_contract_tier = scope:attacker.task_contract_tier_value
location = scope:attacker.default_location
save_scope_as = new_contract_attacker
}
}
scope:new_contract_attacker = {
set_variable = {
name = retain_despite_distance
value = yes
}
set_variable = {
name = task_contract_war
value = scope:war
}
set_variable = {
name = task_contract_employer
value = scope:attacker
}
set_variable = {
name = task_contract_target
value = scope:war.primary_defender
}
}
}
#else spawn contracts for both sides if their strength difference is +/- 100%
if = {
limit = {
NOR = {
exists = scope:new_contract_defender
exists = scope:new_contract_attacker
}
task_contract_join_war_attacker_strength_ratio_value >= 0
task_contract_join_war_attacker_strength_ratio_value <= 2
}
if = {
limit = {
can_create_task_contract = {
type_name = laamp_join_war_contract
employer = scope:attacker
}
}
send_interface_message = {
type = msg_task_contract_created
title = join_war_contract_spawn.t
desc = join_war_contract_spawn.desc_attacker
left_icon = scope:attacker
right_icon = scope:defender
create_task_contract = {
task_contract_employer = scope:attackerAs 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 161.
Where it is used
Every place in common/, events/ and history/ that calls spawn_join_war_contracts_effect.
On actions (the game's own hooks) (1)
- on_war_started
Scripted effects (1)
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.