• 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.
Does anyone knwo about the "add_betrothal" command or has used it in a mod`The wiki says it is broken ... :confused:
Maybe it used to be broken, but I've managed to get it to work just fine. It is used just like the add_spouse command.
 
Maybe it used to be broken, but I've managed to get it to work just fine. It is used just like the add_spouse command.

Thanks! Indeed, it works.
Another question: Do we have a scope for a promised one - not the actual spouse, but the coming Mr./Mrs. xxxx ?
 
Speaking of scopes, how do I scope to a character's oldest living brother in an event? This is the closest I've come, but it will randomly pick among a character's older brothers:

Code:
if = {
    limit = {
        any_sibling = {
            is_female = no
            is_older_than = ROOT
        }
    }
    random_sibling = {
        #do stuff
    }
    break = yes
}
 
Speaking of scopes, how do I scope to a character's oldest living brother in an event? This is the closest I've come, but it will randomly pick among a character's older brothers:

Code:
if = {
    limit = {
        any_sibling = {
            is_female = no
            is_older_than = ROOT
        }
    }
    random_sibling = {
        #do stuff
    }
    break = yes
}

Code:
if = {
    limit = {
        any_sibling = {
            is_female = no
            is_older_than = ROOT
        }
    }
    random_sibling = {
        limit = {
            is_female = no
            is_older_than = ROOT
            NOT = {
                ROOT = {
                    any_sibling = {
                        is_female = no
                        is_older_than = PREVPREV
                        NOT = { character = PREVPREV }   # Probably unnecessary, but just in case
                        is_alive = yes  # Probably unnecessary, but just in case
                    }
                }
            }
        }
        #do stuff
    }
    break = yes
}

This should work.
 
Try using The Validator program in the pinned thread named "List of Mods/Utilities". That should find invalid syntax that has changed since Horse Lords and give you a jumping off point. After that, make sure to look in your %userprofile%\Documents\Paradox Interactive\Crusader Kings II\logs folder and look at the logfiles there for error messages.

Thank you. The game will now start, but almost immediately crashes at "Initialising Maplogic" and does not seem to leave any error messages/logs. :/
 
Code:
if = {
    limit = {
        any_sibling = {
            is_female = no
            is_older_than = ROOT
        }
    }
    random_sibling = {
        limit = {
            is_female = no
            is_older_than = ROOT
            NOT = {
                ROOT = {
                    any_sibling = {
                        is_female = no
                        is_older_than = PREVPREV
                        NOT = { character = PREVPREV }   # Probably unnecessary, but just in case
                        is_alive = yes  # Probably unnecessary, but just in case
                    }
                }
            }
        }
        #do stuff
    }
    break = yes
}

This should work.
Thank you so much. I've been analyzing this masterpiece the past half-hour or so. The only thing that's throwing me is the NOT operator. What's wrong with my interpretation?

Example: Five brothers are born in this order: Alpha (Dead), Beta, Charlie, Delta, Epsilon (ROOT of event). Beta is the oldest living brother.
#loop 1 through any_sibling
Beta
any_sibling
ROOT assigned to = nobody
random sibling

#loop 2
Charlie
any_sibling
ROOT assigned to = Beta
random sibling

#loop 3
Delta
any_sibling
ROOT assigned to = Beta
random sibling

#end of loop
ROOT = Beta

Stack pops up to random_sibling:
males only
older than dead bro
not Beta?

EDIT: Also posting ByzCrusader's post, so it doesn't get buried by page change. I'm not sure what you should check, Byz:
Thank you. The game will now start, but almost immediately crashes at "Initialising Maplogic" and does not seem to leave any error messages/logs. :/
 
Last edited:
As far as I can tell there isn't actually any loop in your code. Going through it line by line:
Code:
if = {
   limit = {       # If the stuff inside this clause evaluates to true, then do the stuff below this clause
        any_sibling = {              # Look through all of ROOT's siblings (i.e., if any of ROOT's siblings fulfills all the conditions in this clause, return true for this clause)
            is_female = no         # Check if the sibling is not female (i.e. male)
            is_older_than = ROOT      # Check if the sibling is older than ROOT
        }       # So basically we're just checking to see if ROOT has an older brother.
    }      # I'm not sure if this is where you're confused, but what happens in the limit is entirely irrelevant for what happens below. All the game cares about is whether or not it evaluates to true.
    random_sibling = {        # Now we're going to take one random one of ROOT's siblings. Note that since you don't have a limit clause here, this will actually take any sibling - older or younger, male or female.
        #do stuff
    }
    break = yes
}

Also, note that ROOT does not and cannot change within a single event.
 
Hey guys,

For province_setup is there anything that would cause it to not take effect? I've got the override in the .mod file, and all of the provinces are represented in the file but the terrain types aren't changing. Trying to get rid of provinces with ocean terrain types but they insist on existing still.
 
Is there a way for an event to give an imprisonment reason, rather than directly imprisoning a character? I can't find anything on the wiki.

Edit: never mind, I found it. You can define an opinion modifier as an imprisonment reason and have the event give that reason.
 
Speaking of scopes, how do I scope to a character's oldest living brother in an event? This is the closest I've come, but it will randomly pick among a character's older brothers:

Code:
if = {
    limit = {
        any_sibling = {
            is_female = no
            is_older_than = ROOT
        }
    }
    random_sibling = {
        #do stuff
    }
    break = yes
}
Another solution:
Code:
save_event_target_as = oldest   #Saves ROOT as the target
any_sibling = {   #Scopes to all living siblings
   limit = {
       is_female = no
       is_older_than = event_target:oldest
   }
   save_event_target_as = oldest
}
event_target:oldest = {
   if = {
       limit = {
           NOT = { character = ROOT }
       }
       <do stuff>
   }
}
clear_event_target = oldest
 
Last edited:
Another solution:
Code:
save_event_target_as = oldest   #Saves ROOT as the target
any_sibling = {   #Scopes to all living siblings
   limit = {
       is_female = no
       is_older_than = event_target:oldest
   }
   save_event_target_as = oldest
}
event_target:oldest = {
   if = {
       limit = {
           NOT = { character = ROOT }
       }
       <do stuff>
   }
}
clear_event_target = oldest
That seems like it would work well, and the code makes more sense to me. I tested it out, though, and the code I inserted into <do stuff> wasn't being executed. I read on the Event Modding page on the CK II wiki that using event targets inside an Immediate block (which this conditional is in) can cause unexpected effects. Could that be issue?
 
Event Modding page on the CK II wiki that using event targets inside an Immediate block (which this conditional is in) can cause unexpected effects. Could that be issue?
Not sure, never had any problems with it. Just tested that code in both decisions and events, and it seems to work fine.

Maybe the scopes are different in the instance where you're using it. If the base character (whose oldest brother you need to find) isn't ROOT, then the first save_event_target_as = oldest and NOT = { character = ROOT } need to be modified.
 
Code:
if = {
    limit = {
        any_sibling = {
            is_female = no
            is_older_than = ROOT
        }
    }
    random_sibling = {
        limit = {
            is_female = no
            is_older_than = ROOT
            NOT = {
                ROOT = {
                    any_sibling = {
                        is_female = no
                        is_older_than = PREVPREV
                        NOT = { character = PREVPREV }   # Probably unnecessary, but just in case
                        is_alive = yes  # Probably unnecessary, but just in case
                    }
                }
            }
        }
        #do stuff
    }
    break = yes
}

This should work.

Hm, why do you have two limit-loops in this event? ("any_sibling" and then "random_sibling"?
 
Hm, why do you have two limit-loops in this event? ("any_sibling" and then "random_sibling"?

Code:
if = {
   limit = {            # This limit clause is used to determine if the clauses under it are executed. It is the condition of the if clause.
        any_sibling = {
            is_female = no
            is_older_than = ROOT
        }
    }
    random_sibling = {         # This limit clause has absolutely nothing to do with the first clause, except that the game will only ever get here if the first limit clause evaluates to true.
        limit = {         # What happens here is that the game will go through each of ROOT's siblings and check these conditions for each one of them. Then, out of all ROOT's siblings for which all of the below is true (we have structured this so that there should only be one choice), the game will execute the commands below.
            is_female = no
            is_older_than = ROOT
            NOT = {
                ROOT = {
                    any_sibling = {
                        is_female = no
                        is_older_than = PREVPREV
                        NOT = { character = PREVPREV }   # Probably unnecessary, but just in case
                        is_alive = yes  # Probably unnecessary, but just in case
                    }
                }
            }
        }
        #do stuff
    }
    break = yes
}