Scripted effect · Roads to Power files
ep3_adventurer_ai_war_travel_effect
ep3_adventurer_ai_war_travel_effect = { ADVENTURER = … WAR_TARGET = … }game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt, line 1496 (60 lines). Parameters: $ADVENTURER$, $WAR_TARGET$.
ep3_adventurer_ai_war_travel_effect is a scripted effect in Crusader Kings III, in the Roads to Power files, written at line 1496 of its file. A call passes 2 parameters: ADVENTURER and WAR_TARGET. The game's script calls it in 1 place, among them on_adventurer_ai_war_target_arrival (on action). Patch 1.20.1.2, from game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt.
The comment above it in the file
Move adventurer to the war target, if necessary ADVENTURER = character WAR_TARGET = character
What it does
Every line of it is script with no tooltip text: the script is below.
The script as written (60 lines of game script)
ep3_adventurer_ai_war_travel_effect = {
$ADVENTURER$.domicile.domicile_location = { save_scope_as = current_location } # Since passed scopes can't be used in square_distance
$WAR_TARGET$ = { # Find closest neighboring realm, and its closest county, to you, and go there
ordered_neighboring_and_across_water_top_liege_realm_owner = {
limit = {
# Always prefer not across water, but allow it in edge cases
save_temporary_scope_as = war_neighbour_temp
$WAR_TARGET$ = {
any_neighboring_top_liege_realm_owner = { this = scope:war_neighbour_temp }
}
}
alternative_limit = { always = yes }
order_by = {
value = 0
subtract = "capital_county.squared_distance(scope:current_location)"
}
save_scope_as = war_neighbour
ordered_sub_realm_county = {
limit = {
any_neighboring_county = {
holder ?= {
OR = {
this = $WAR_TARGET$
target_is_liege_or_above = $WAR_TARGET$
}
}
}
}
order_by = {
value = 0
subtract = "title_province.squared_distance(scope:current_location)"
}
save_scope_as = war_stage
}
}
}
save_scope_value_as = { # Approx provisions for journey
name = lammp_travel_provisions
value = {
value = "scope:current_location.squared_distance(scope:war_stage.title_province)"
divide = 300
}
}
$ADVENTURER$ = {
domicile = { # the AI doesn't have to know how to use provisions efficiently, so just add a couple so that they don't suicide
if = {
limit = { provisions < scope:lammp_travel_provisions }
change_provisions = scope:lammp_travel_provisions
}
}
start_travel_plan = {
destination = scope:war_stage.title_province
travel_with_domicile = yes
players_use_planner = no
return_trip = no
on_arrival_destinations = all
on_arrival_on_action = on_adventurer_ai_war_target_arrival
}
}
}As written in game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt.
Where it is used
Every place in common/, events/ and history/ that calls ep3_adventurer_ai_war_travel_effect.
On actions (the game's own hooks) (1)
- on_adventurer_ai_war_target_arrival
Source: game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.