• 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.
No, it's really easy. Use effect = { character_event = { id = reinforcements.1 } } in character history.
Thanks that worked. Still can't get the option to work sadly.

namespace = reinforcements
# Reinforcements

character_event = {
id = reinforcements.1
desc = "EVTDESCreinforcements.1"
picture = "GFX_event_beach_landing"

hide_from = yes

is_triggered_only = yes

immediate = {
spawn_unit = {
province = 334 # Napoli
owner = ROOT
leader = ROOT
troops = {
archers = { 500 500 }
heavy_infantry = { 1000 1000 }
light_infantry = { 300 300 }
light_cavalry = { 150 150 }
knights = { 50 50 }
}
attrition = 1.0
}
spawn_fleet = {
province = 334 # Napoli
owner = ROOT
disband_on_peace = yes
earmark = hectors_invasion_fleet
troops = {
galleys = { 20 20 }
}
}
}

option = {
name = "EVTOPTAreinforcements.1
holder_scope = {
c_80101 = {
give_minor_title = title_commander
}
spawn_unit = { #Spawn Armand
province = 337 # Catanzaro
owner = THIS
leader = 80101
disband_on_peace = yes
troops = {
archers = { 200 200 }
heavy_infantry = { 1200 1200}
light_infantry = { 600 600 }
}
attrition = 1.0
}
}
}
}
 
Thanks that worked. Still can't get the option to work sadly.

Please enclose your script in code tags next time, like so:

Code:
[code]
script
[\code]

With that out of the way, your use of holder_scsope makes no sense. It's used in ROOT, which is the character receiving the event, but only titles have holders.

Try this version:
Code:
namespace = reinforcements
# Reinforcements

character_event = {
    id = reinforcements.1
    desc = "EVTDESCreinforcements.1"
    picture = "GFX_event_beach_landing"
   
    hide_from = yes
   
    is_triggered_only = yes
   
    immediate = {
        spawn_unit = {
            province = 334 # Napoli
            owner = ROOT
            leader = ROOT
            troops = {
                archers = { 500 500 }
                heavy_infantry = { 1000 1000 }
                light_infantry = { 300 300 }
                light_cavalry = { 150 150 }
                knights = { 50 50 }
            }
            attrition = 1.0
        }
        spawn_fleet = {
            province = 334 # Napoli
            owner = ROOT
            disband_on_peace = yes
            earmark = hectors_invasion_fleet
            troops = {
                galleys = { 20 20 }
            }
        }
    }
   
    option = {
        name = "EVTOPTAreinforcements.1"
        c_80101 = {
            give_minor_title = title_commander
        }
        spawn_unit = { #Spawn Armand
            province = 337 # Catanzaro
            owner = THIS
            leader = c_80101
            disband_on_peace = yes
            troops = {
                archers = { 200 200 }
                heavy_infantry = { 1200 1200}
                light_infantry = { 600 600 }
            }
            attrition = 1.0
        }
    }
}
 
How does one change opinion of characters via events? (I'm very new to event modding). The add spouse option works, but the opinion does not change for the respective characters. I checked AGOT for similar events, but the script is very complex there for me.

Code:
## Zafira Gerkan, sister of Lord Naberius
  option = {
    name = EVTOPTBvullon.story.1
    ai_chance = {
      factor = 20
    }
    c_7006 = {
        add_spouse = ROOT
    }
    ## Lord Naberius is impressed
    c_7003 = {
        opinion = {
            who = ROOT
            value = 50
        }
    }
    ## Rondo Vullon is not impressed
    c_8007 = {
        opinion = {
            who = ROOT
            value = -50
        }
    }
  }
 
How does one change opinion of characters via events? (I'm very new to event modding). The add spouse option works, but the opinion does not change for the respective characters. I checked AGOT for similar events, but the script is very complex there for me.

Code:
## Zafira Gerkan, sister of Lord Naberius
  option = {
    name = EVTOPTBvullon.story.1
    ai_chance = {
      factor = 20
    }
    c_7006 = {
        add_spouse = ROOT
    }
    ## Lord Naberius is impressed
    c_7003 = {
        opinion = {
            who = ROOT
            value = 50
        }
    }
    ## Rondo Vullon is not impressed
    c_8007 = {
        opinion = {
            who = ROOT
            value = -50
        }
    }
  }
Check the info on the opinion and reverse_opinion commands here https://ck2.paradoxwikis.com/Commands

You have to include a specific opinion modifier with those commands, you can't just give a value. The game's opinion modifiers can be found in \common\opinion_modifiers\ for reference, and you can also create your own.

Are the c_#### scopes in your code referring to characters or county titles? I assumed the latter at first and was puzzled.
 
  • 1Like
Reactions:
What would be the simplest way to make targeted decision mod that allows only player controlled character to excommunicate his vassal or courtier for piety? I.e. add_trait excommunicated to target vassal or courtier for cost of like 100 piety?
 
What would be the simplest way to make targeted decision mod that allows only player controlled character to excommunicate his vassal or courtier for piety? I.e. add_trait excommunicated to target vassal or courtier for cost of like 100 piety?
See the Decision Modding page, Commands page, and Conditions page for details on how it all works.

It's a pretty basic decision though, so it'd go something like this.
Code:
targeted_decisions = {   # All decisions that have a character as a target need to go inside your targeted_decisions block. You only need one such block per file, so if you're adding this decision to a file that already has a targeted_decisions block, put that decision inside your existing block rather than making a new one.

   excommunicate_vassal_player_only_decision = {   # This can be any string, and it will be the internal name of this decision in your mod.
      ai = no   # This is a pre-filter. Only very specific conditions can be used in a pre-filter, and this is one of them. It means that only a player can use the decision.

      # Potential is who you can target with the decision. If someone doesn't meet the requirements here, the decision will simply not show up on the list of diplomatic actions you can get when right-clicking a character.
      potential = {
         liege = { ai =  no }   # The liege scope points to the liege of the targeted character. This potential means that the decision will only show up for characters who are the direct vassal of a player.
      }

      # Allow is what conditions are required to activate the decision. A decision might show up in the diplomatic actions menu of a character if they meet its potential, but if the Allow conditions aren't met, then the decision won't be clickable but will be grayed out.
      allow = {
         # In targeted decisions, the FROM scope is the decision taker, i.e. the person who is targeting someone else with the decision. In this case, the player.
         FROM = {
            piety >= 100   # Thus the decision will be grayed out if the player doesn't have at least 100 piety.
         }
         NOT = { trait = excommunicated } # It doesn't make sense to allow this decision for someone who's already excommunicated, so they must not be excommunicated already.
      }

      # The effect block is what happens when the decision is taken.
      effect = {
         FROM = { piety = -100 }   # 100 piety is removed from the decision taker, in this case the player.
         add_trait = excommunicated
      }
   }
   
}

If you don't know, # denotes a comment. The game will ignore anything written after a # sign.

You will also need to make a localization for the decision, using excommunicate_vassal_player_only_decision for what the decision's name will appear as in the game, and excommunicate_vassal_player_only_decision_desc for what the description in the game will appear as.

I have not double-checked this code, so beware of mistakes.
 
See the Decision Modding page, Commands page, and Conditions page for details on how it all works.

It's a pretty basic decision though, so it'd go something like this.
Code:
targeted_decisions = {   # All decisions that have a character as a target need to go inside your targeted_decisions block. You only need one such block per file, so if you're adding this decision to a file that already has a targeted_decisions block, put that decision inside your existing block rather than making a new one.

   excommunicate_vassal_player_only_decision = {   # This can be any string, and it will be the internal name of this decision in your mod.
      ai = no   # This is a pre-filter. Only very specific conditions can be used in a pre-filter, and this is one of them. It means that only a player can use the decision.

      # Potential is who you can target with the decision. If someone doesn't meet the requirements here, the decision will simply not show up on the list of diplomatic actions you can get when right-clicking a character.
      potential = {
         liege = { ai =  no }   # The liege scope points to the liege of the targeted character. This potential means that the decision will only show up for characters who are the direct vassal of a player.
      }

      # Allow is what conditions are required to activate the decision. A decision might show up in the diplomatic actions menu of a character if they meet its potential, but if the Allow conditions aren't met, then the decision won't be clickable but will be grayed out.
      allow = {
         # In targeted decisions, the FROM scope is the decision taker, i.e. the person who is targeting someone else with the decision. In this case, the player.
         FROM = {
            piety >= 100   # Thus the decision will be grayed out if the player doesn't have at least 100 piety.
         }
         NOT = { trait = excommunicated } # It doesn't make sense to allow this decision for someone who's already excommunicated, so they must not be excommunicated already.
      }

      # The effect block is what happens when the decision is taken.
      effect = {
         FROM = { piety = -100 }   # 100 piety is removed from the decision taker, in this case the player.
         add_trait = excommunicated
      }
   }
  
}

If you don't know, # denotes a comment. The game will ignore anything written after a # sign.

You will also need to make a localization for the decision, using excommunicate_vassal_player_only_decision for what the decision's name will appear as in the game, and excommunicate_vassal_player_only_decision_desc for what the description in the game will appear as.

I have not double-checked this code, so beware of mistakes.
Seems to work fine, thank you very much.

Another thing I tried to add was to not only allow to target direct vassals but also the indirect ones (vassals of my vassal). I tried changing the line liege = { ai = no } to is_vassal_or_below = ROOT. According to conditions on wiki it should check if targeted character is your direct or indirect vassal but it didn't show the decision at all. What did I do wrong here?

Also, as a follow up to that, I tried to add custom lift excommunication decision and did it like that:

Code:
    lift_excommunication_from_vassal = {   
        ai = no
        from_potential  = {
            religion = catholic
            }
        }
          potential = {
            liege = { ai =  no }
            religion = FROM
        }
        allow = {
            FROM = {
                piety >= 25
            }
        trait = excommunicated 
        }
        effect = {
            FROM = { piety = -25 }
            remove_trait = excommunicated
            }
        }   
    }

So I added the requirements for the player to be catholic and for vassal to be catholic (that worked in the excommunicate decision so I guess it's not wrong here) but for some reason this decision didn't appear in the game either. Any idea what is wrong here?
 
Seems to work fine, thank you very much.

Another thing I tried to add was to not only allow to target direct vassals but also the indirect ones (vassals of my vassal). I tried changing the line liege = { ai = no } to is_vassal_or_below = ROOT. According to conditions on wiki it should check if targeted character is your direct or indirect vassal but it didn't show the decision at all. What did I do wrong here?

Also, as a follow up to that, I tried to add custom lift excommunication decision and did it like that:

Code:
    lift_excommunication_from_vassal = {
        ai = no
        from_potential  = {
            religion = catholic
            }
        }
          potential = {
            liege = { ai =  no }
            religion = FROM
        }
        allow = {
            FROM = {
                piety >= 25
            }
        trait = excommunicated
        }
        effect = {
            FROM = { piety = -25 }
            remove_trait = excommunicated
            }
        }
    }

So I added the requirements for the player to be catholic and for vassal to be catholic (that worked in the excommunicate decision so I guess it's not wrong here) but for some reason this decision didn't appear in the game either. Any idea what is wrong here?
is_vassal_or_below checks if the condition target is the vassal of the scope. The condition target is what comes after the = sign here. But in a targeted decision, ROOT is the person targeted by the decision. Thus, in this case is_vassal_or_below = ROOT is checking whether or not the scope is the vassal of the person you're targeting, which the player won't be in your intended use case.

Inside your potential block, you should instead put is_vassal_or_below = FROM, because in targeted decisions, FROM is the decision taker, in this case the player. Thus the it pass the potential if the targeted character is your vassal.

For your excommunication-lifting decision, it looks like you have a couple of stray brackets. Brackets should always come in pairs, one to open a segment and one to close it. Extra brackets will cause errors when the game tries to evaluate the code. (So will missing brackets, for that matter.)

You have a stray bracket in your from_potential block, alone on the line right below religion = catholic.

You have a second stray bracket in your effect block, alone on the line right below remove_trait = excommunicated.

Remove those stray brackets.

If you're not already, I highly recommend using Notepad++. When your cursor is next to a bracket, it will highlight in red and also highlight its matching bracket (the opening bracket if your cursor is at the closing one, or vice versa), giving you an easy visual cue to check if your brackets are right or if you're missing one or have an extra.

I also recommend downloading the Validator, which is great at catching errors like this. If you're going to be doing a lot of CK2 coding, it's a must. Can't tell you how many times I've pored over code that wasn't working, unable to find the error, only to run Validator and have it find the error immediately.
 
is_vassal_or_below checks if the condition target is the vassal of the scope. The condition target is what comes after the = sign here. But in a targeted decision, ROOT is the person targeted by the decision. Thus, in this case is_vassal_or_below = ROOT is checking whether or not the scope is the vassal of the person you're targeting, which the player won't be in your intended use case.

Inside your potential block, you should instead put is_vassal_or_below = FROM, because in targeted decisions, FROM is the decision taker, in this case the player. Thus the it pass the potential if the targeted character is your vassal.

For your excommunication-lifting decision, it looks like you have a couple of stray brackets. Brackets should always come in pairs, one to open a segment and one to close it. Extra brackets will cause errors when the game tries to evaluate the code. (So will missing brackets, for that matter.)

You have a stray bracket in your from_potential block, alone on the line right below religion = catholic.

You have a second stray bracket in your effect block, alone on the line right below remove_trait = excommunicated.

Remove those stray brackets.

If you're not already, I highly recommend using Notepad++. When your cursor is next to a bracket, it will highlight in red and also highlight its matching bracket (the opening bracket if your cursor is at the closing one, or vice versa), giving you an easy visual cue to check if your brackets are right or if you're missing one or have an extra.

I also recommend downloading the Validator, which is great at catching errors like this. If you're going to be doing a lot of CK2 coding, it's a must. Can't tell you how many times I've pored over code that wasn't working, unable to find the error, only to run Validator and have it find the error immediately.
Thanks for the suggestions, notepad was helpful and I managed to make it work. Do you have any idea if the similar decision to excommunicate but specifically the one pope can make is somewhere in the game files? Because I tried to looks for it and couldn't find anything. I also remember when lots of people complained about pope excommunicating pious catholic rulers for seemingly no reason at all, so maybe it is completely random after all but some basic trigger must exist somewhere.
 
Thanks for the suggestions, notepad was helpful and I managed to make it work. Do you have any idea if the similar decision to excommunicate but specifically the one pope can make is somewhere in the game files? Because I tried to looks for it and couldn't find anything. I also remember when lots of people complained about pope excommunicating pious catholic rulers for seemingly no reason at all, so maybe it is completely random after all but some basic trigger must exist somewhere.
Notepad++ not plain Notepad.

Searching add_trait = excommunicated brings up several hits in /events/, you might check there. It might also be a hard-coded decision that doesn't appear anywhere in moddable files we can access. As for the pope excommunicating people, it can happen when a ruler refuses a request of his (like instituting Papal Investiture, the most common request refusal that can result in excommunication I think), but it can also happen when any ruler requests the Pope to excommunicate someone, there's that whole score thing as to whether the Pope will accept, which depends on how much he likes the request and how pious they are, versus how much he likes the target and how pious they are.
 
so I've made a mod to change the colour of certain kingdoms (like the bright greens of Africa and Egypt) but I found that it changes Kingdom of Sweden to a dull red colour

1738752948689.png

so I changed the default colour of Sweden too but it still stays this shade. what could be the reason?

attaching relevant file
 

Attachments

  • landed_titles.txt
    852,3 KB · Views: 0
so I've made a mod to change the colour of certain kingdoms (like the bright greens of Africa and Egypt) but I found that it changes Kingdom of Sweden to a dull red colour


so I changed the default colour of Sweden too but it still stays this shade. what could be the reason?

attaching relevant file

It's likely the incorrect file encoding. CK2 requires files to be encoded in Win-1252, not UTF8, which in this file breaks various cultural title names, causing the remainder of the file to be parsed incorrectly.
 
  • 1Like
Reactions: