• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

wtrmute

Second Lieutenant
35 Badges
Mar 21, 2017
120
167
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Republic
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Monks and Mystics
  • Imperator: Rome Sign Up
  • Stellaris - Path to Destruction bundle
  • Crusader Kings Complete
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Crusader Kings II: Jade Dragon
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Crusader Kings II: Holy Fury
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Victoria 2
  • Rome Gold
  • Victoria 2: A House Divided
  • Crusader Kings II: Holy Fury Pre-order
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
Hello everyone; I've been working on a few scripts and so far I've had some difficulty with the `realm` scope. Maybe someone might be able to shed some light on what I'm doing wrong?

For starters, I wanted to select all Nestorian provinces under the Abbasid Caliphate. The first idea was doing this:

Code:
e_arabia = {
  log = "This is the [This.GetFullName]"
  any_realm_province = {
    limit = {
      religion = nestorian
    }
    log = "> The [This.Religion.GetName] province of [This.GetName] ([This.GetID])"
  }
}

However, running this with the console yields the following output in game.log:

[effectimplementation.cpp:18398]: EVENT [769.1.1]:This is the Abbasid Empire

So, the limit is wrong, somehow. So I take a step back and enumerate all the provinces of e_arabia:

Code:
e_arabia = {
  log = "This is the [This.GetFullName]"
  any_realm_province = {
    log = "> The [This.Religion.GetName] province of [This.GetName] ([This.GetID])"
  }
}

And then we get the following result:

[effectimplementation.cpp:18398]: EVENT [769.1.1]:This is the Abbasid Empire

Ok, so it wasn't the limit clause. I'm not sure why any_realm_province is failing to enumerate the provinces of the Abbasid Empire, but we can always switch the logic around. Even though it is more expensive, we can enumerate all provinces and then filter for those in the Abbasid Empire:

Code:
any_province = {
  limit = {
    realm = { title = e_arabia }
  }
  log = "> The [This.Religion.GetName] province of [This.GetName] ([This.GetID]) in the [This.Realm.GetFullName]"
}

This yields exactly zero lines of output, so I decided to enumerate all provinces and list their realm:

Code:
any_province = {
  log = "> The [This.Religion.GetName] province of [This.GetName] ([This.GetID]) in the [This.Realm.GetFullName]"
  realm = {
    log = "It belongs to the realm of the [This.GetFullName] ([This.GetID])"
  }
}

This yields a great many lines, which I will sample below:

[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Catholic province of Vestisland (1) in the Prince-Bishopric of Vestisland
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Catholic province of Austisland (2) in the Prince-Bishopric of Austisland
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Catholic province of Tír Chonaill (3) in the Chiefdom of Tír Chonaill
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
(ommitted for brevity...)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Zoroastrian province of Dihistan (631) in the Abbasid Empire
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
(ommitted for brevity...)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Catholic province of Almada (2013) in the Umayyad Sultanate
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Sunni province of Huelva (2014) in the Umayyad Sultanate
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()

So now we have something strange turn up: even though the localisation command This.Realm.GetFullName shows the correct realm, the actual scope realm is returning an odd object with a null name and a null ID! Now clearly, those belong to a realm, or the localisation command ought to return empty, as well, right? But, looking at the wiki, the realm is meant to be called from a character or title scope, so I insert an intermediary scope for county, like this:

Code:
any_province = {
  log = "> The [This.Religion.GetName] province of [This.GetName] ([This.GetID]) in the [This.Realm.GetFullName]"
  county = {
    log = "It is the seat of the [This.GetFullName] ([This.GetID])"
    realm = {
      log = "It belongs to the realm of the [This.GetFullName] ([This.GetID])"
    }
  }
}

This yields:

[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Catholic province of Vestisland (1) in the Prince-Bishopric of Vestisland
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It is the seat of the Prince-Bishopric of Vestisland (c_vestisland)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Catholic province of Austisland (2) in the Prince-Bishopric of Austisland
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It is the seat of the Prince-Bishopric of Austisland (c_austisland)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
(ommitted for brevity...)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Basra (649) in the Abbasid Empire
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It is the seat of the Sheikhdom of Basra (c_basra)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()
(ommitted for brevity...)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Sunni province of Huelva (2014) in the Umayyad Sultanate
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It is the seat of the Sheikhdom of Huelva (c_huelva)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:It belongs to the realm of the ()

So even calling realm from county scope, we still get a bad value, which is what is causing (I think) the any_realm_province and the limit = { realm = { title = /*whatever*/ } } fail.

However, it is unthinkable that a scope which is supposedly used in several places in the base game could be broken like this; I can only imagine the number of events that would be broken along with it. So it is probably still something I'm doing that I shouldn't be. Can anyone see what is going on? I would appreciate a couple of pointers, if possible.

Cheers for the attention!
 
Solution
It appears to me the wiki is wrong. My testing indicated this can only be used in character scope.
As for the amount of events broken as a result of the limited of use of this scope, don't worry. It's only used a grand total of three times in all of vanilla's script, two of which are in an event that's no longer used.
It appears to me the wiki is wrong. My testing indicated this can only be used in character scope.
As for the amount of events broken as a result of the limited of use of this scope, don't worry. It's only used a grand total of three times in all of vanilla's script, two of which are in an event that's no longer used.
 
Last edited:
  • 1
Reactions:
Solution
It appears to me the wiki is wrong. My testing indicated this can only be used in character scope.
As for the amount of events broken as a result of the limited of use of this scope, don't worry. It's only used a grand total of three times in all of vanilla's scrip, two of which are in an event that's no longer used.
Huh. That seems curious.

I went back and slightly modified the first script I tried by skipping through Al-Mansur first, and indeed the correct provinces are being returned.

Code:
e_arabia = {
  log = "This is the [This.GetFullName]"
  owner = {
    any_realm_province = {
      limit = {
        religion = nestorian
      }
      log = "> The [This.Religion.GetName] province of [This.GetName] ([This.GetID])"
    }
  }
}

[effectimplementation.cpp:18398]: EVENT [769.1.1]:This is the Abbasid Empire
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Bostra (727)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Rahbah (712)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Basra (649)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Mosul (697)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Deir (695)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Ain Said (654)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Kufa (655)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Kermanshah (688)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Ilam (689)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Al Nadjaf (692)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Karbala (694)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Samarra (696)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Al-Sukhnah (729)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Al Bichri (710)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Druz (713)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Sinjar (711)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Hasakah (698)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Kurdistan (686)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Kirkuk (687)
[effectimplementation.cpp:18398]: EVENT [769.1.1]:> The Nestorian province of Sús (656)

Erroneous SDK documentation, who'd have thunk it? I guess that realm should have the same problem of needing to go through the owner; I'll leave that test for some other day, as I think this is way is actually easier to reason about in my case.

Many thanks, @Whizzer, for the tip. I would have probably taken a while to have figured this out.
 
Upvote 0