• 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.
Events and decisions
I know you can create "character flag"s but that is tedious. Is there another way to do this in order for the decision and events to only fire once?
Something along the lines of "Fire only once = yes" is basicly what I'm looking for. But I couldn't find any of those in the files, so I don't know if it actually works. Any one knows?
I don't think Clausewitz Engine ever has that, unlike Europa Engine. The standard procedure is to use a global flag.
 
I don't think Clausewitz Engine ever has that, unlike Europa Engine. The standard procedure is to use a global flag.
Sadness :( Well, that is how it is then. Do I have to create a global flag in the same very event? or do I have to go into another file and create the global flag there?

Basiclyy, how do you create and use global flags? (Like for use for a storyline)
 
Is there a collection of all the event pictures? Currently, they're spread around in the zip files of the DLCs and it's hard to find appropriate pictures for custom events.

There is also some pictures in the gfx/event_pictures. Those in the DLC folder shouldn't be viewable by those who do not own the DLC and it is think forbidden to add the actual file of these (DLC) pictures to your mod as it would be sharing DLC content to those without.
 
I'm not sure whether to post in this thread, or whether I should create a new thread, since my question(s) take some explaining. I've been playing CK2 for a while now and after the release of JD thought I'd try getting into modding a bit, since I've had fun modding other games for a long time going back, and since the chinese content is what I'm most interested in playing and modifying.

What I've done so far is: I've introduced a new government type that is meant to make Chinese Imperialism a little more fun:
The idea is, basically, that vassals of a Chinese Imperial Government character can adopt the government I've created, to make their titles non-hereditary (succession like in a republic). That part I've mostly figured out so far.
However, the tricky part is going to be coding things that make characters actually adopt this government type, once their top liege has adopted Chinese Imperialism. Should all vassals just immediately convert? Or should I use a decision for them, like with tribal/nomadic characters? Ideally, there would also be a character interaction the emperor can perform, that would convince and/or force the prompted vassal to change their government form to the new one, also coming with an opinion malus toward the emperor for weakening their dynastyies' standing in the empire.

What do you guys think? And could you point me to some examples of where code similar to what I want to do is contained in the base game?
 
So I have a quick question to ask. How would I go about creating a mod that changes the amount of threat a nation gains by taking a province? I need it for a upcoming multiplayer campaign I'll be doing.
 
Hello again,

i have a member of the court with a minor title who should recieve an event. In this event there should be a third party to come in play: a prisoner.

How do I scope to this prisoner?

Code:
character_event = {
    id = anus_tormentor_jobs.1100
    desc = anus_tormentor_jobs_1100
    picture = GFX_evt_prison_1
    border = GFX_event_normal_frame_intrigue

    trigger = {
        liege = {
            has_character_flag = tormentor_job
            num_of_prisoners = 1
        }
    }
   
    mean_time_to_happen = {
        months = 4
    }

    immediate = {
        liege = {
            random_realm_character = {
                limit = {
                    prisoner = yes
                }
                save_event_target_as = recruited_tormentor_target
            }
        }
    }

Wouldn't that scope also to the prisoners of my vassals?
 
Hello again,

i have a member of the court with a minor title who should recieve an event. In this event there should be a third party to come in play: a prisoner.

How do I scope to this prisoner?

Code:
character_event = {
    id = anus_tormentor_jobs.1100
    desc = anus_tormentor_jobs_1100
    picture = GFX_evt_prison_1
    border = GFX_event_normal_frame_intrigue

    trigger = {
        liege = {
            has_character_flag = tormentor_job
            num_of_prisoners = 1
        }
    }
 
    mean_time_to_happen = {
        months = 4
    }

    immediate = {
        liege = {
            random_realm_character = {
                limit = {
                    prisoner = yes
                }
                save_event_target_as = recruited_tormentor_target
            }
        }
    }

Wouldn't that scope also to the prisoners of my vassals?
Yes add "host = ROOT" after "prisoner = yes"
Or maybe "host = FROM"
 
I'm having issues getting an event to fire, and would like someone to proofread the code to help me find where I went wrong. This event is supposed to:

1) Check for all character above a minimum age (17).
2) Check all characters for at least one of many possible prerequisite traits (traits A through G)
3) Add a certain trait (X) if the above two conditions are met.

Code:
}
#character
on_yearly_pulse = {
    events = {
        test.1

    }
}

Code:
namespace = test
character_event = {
    id = test.1
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
        age = 17
        OR = {
            trait = A
            trait = B
            trait = C
            trait = D
            trait = E
            trait = F
            trait = G
        }
        NOT = { trait = X }
    }
    
    immediate = {
        add_trait = X
    }
}

If you see where I messed up, or have any general recommendations for a newbie coder, please let me know.
 
I'm having issues getting an event to fire, and would like someone to proofread the code to help me find where I went wrong. This event is supposed to:

1) Check for all character above a minimum age (17).
2) Check all characters for at least one of many possible prerequisite traits (traits A through G)
3) Add a certain trait (X) if the above two conditions are met.

Code:
}
#character
on_yearly_pulse = {
    events = {
        test.1

    }
}

Code:
namespace = test
character_event = {
    id = test.1
    hide_window = yes
    is_triggered_only = yes
   
    trigger = {
        age = 17
        OR = {
            trait = A
            trait = B
            trait = C
            trait = D
            trait = E
            trait = F
            trait = G
        }
        NOT = { trait = X }
    }
   
    immediate = {
        add_trait = X
    }
}

If you see where I messed up, or have any general recommendations for a newbie coder, please let me know.
Does the event work if you fire it via the console?
 
I'm having issues getting an event to fire, and would like someone to proofread the code to help me find where I went wrong. This event is supposed to:

1) Check for all character above a minimum age (17).
2) Check all characters for at least one of many possible prerequisite traits (traits A through G)
3) Add a certain trait (X) if the above two conditions are met.

Code:
}
#character
on_yearly_pulse = {
    events = {
        test.1

    }
}

Code:
namespace = test
character_event = {
    id = test.1
    hide_window = yes
    is_triggered_only = yes
 
    trigger = {
        age = 17
        OR = {
            trait = A
            trait = B
            trait = C
            trait = D
            trait = E
            trait = F
            trait = G
        }
        NOT = { trait = X }
    }
 
    immediate = {
        add_trait = X
    }
}

If you see where I messed up, or have any general recommendations for a newbie coder, please let me know.

I don't see anything wrong here, make sure you check both files for any missing brackets as that could break stuff. Check with the validator as its possibly the easiest way.

Also you may want to make this change:

Code:
min_age = 17

trigger = {
        OR = {
            trait = A
            trait = B
            trait = C
            trait = D
            trait = E
            trait = F
            trait = G
        }
     }

Age can be used as a pre-trigger and is much better performance wise.
 
Here's more of a quicky than my last one: Do "is_feudal = yes" and "is_republic = yes" only apply specifically to the feudal and republic governments respectively, or to all governments defined in the respective [...]_governments.txt's?
 
Here's more of a quicky than my last one: Do "is_feudal = yes" and "is_republic = yes" only apply specifically to the feudal and republic governments respectively, or to all governments defined in the respective [...]_governments.txt's?

All governments in their respective file. The exception is is_merchant_republic = yes.
 
Can saved event targets be used in dynamic flags? So if I save a certain scope as an event target variable, can I use it in a dynamic flag by appending @ and the name of my scope saved as the event target variable? I didn't find any information about this particular combination on the wiki.
 
How do I tell an event to check the traits and attributes of a character that has a certain character flag, as opposed to the default game behaviour of checking the character the event is happening to?