Crusader Kings III

Crusader Kings III

Commanders +
If I modify it like this, will it work properly without an error log?
I got the corresponding error log below for the fow_trait.00071 event.

-------------------------------------
[jomini_script_system.cpp:278]: Script system error!
Error: Could not fetch title or province from scope 'county'
Script location: file: events/com_commander_events.txt line: 476

[jomini_script_system.cpp:278]: Script system error!
Error: Event target link 'county' returned an unset scope
Script location: file: events/com_commander_events.txt line: 476

[jomini_script_system.cpp:278]: Script system error!
Error: is_at_war_with trigger []
Script location: file: events/com_commander_events.txt line: 476
-------------------------------------

Can I modify the script code like this to properly handle the error log?

I want to check with you that the code is working properly.


fow_trait.00071 = {
hidden = yes

trigger = {
exists = scope:army.army_commander
scope:army.army_commander = {
has_trait = focus_specialist
}
}

immediate = {
scope:army.army_commander = {
if = {
limit = {
is_at_war_with = this.location.county.holder
}
this_location_county = {
set_variable = {
name = target_county
value = ROOT
}
}
this_location_county = {
this_location_county_holder = {
set_variable = {
name = target_title
value = ROOT
}
}
}
ROOT = {
this_location_county = {
this_location_county_holder_primary_title = {
set_variable = {
name = target_capital_county
value = ROOT
}
}
}
}
target_county = target_capital_county
add_character_modifier = focus_specialist_modifier
}
else = {
remove_character_modifier = focus_specialist_modifier
}
}
}
}