• 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.
Pls, can anyone explain what ”tick” means in Pdx games? ... I remember I read a thorough explanation somewhere years ago but I can’t find that anymore ...
I am not a modder but I love to play around with the savegames and I can’t wrap my brain around that ... Thx

It refers to the main update loop. In CK3, one day is a tick while in HOI4 it's one hour.
 
  • 1Like
Reactions:
For on_actions, does anyone know for a random_events section, if there's any functional difference between chance_to_happen and chance_of_no_event, versus simply putting in something like "1000 = 0"? I understand chance_of_no_event and chance_to_happen allow you to add in various modifiers to modify the chances of things appearing based on other triggers, but I'm interested in if anyone knows if there's any reason why I would choose one option over the other if no modifiers were involved.

What I mean is, let's say I have the three following options:

Code:
random_events = {
    chance_to_happen = 25
    100 = cool_event.1
}


Code:
random_events = {
    chance_of_no_event = {
        value = 75
    }
    100 = cool_event.1
}


Code:
random_events = {
    300 = 0
    100 = cool_event.1
}

Is there functionally any difference between the three? Presumably in each situation there's a 25% chance "cool_event.1" will fire.

I realize this is a bit old, but since I was wondering this myself and effected an understanding, I figured I'd answer it.

Functionally, the options you present are all identical. If, as you suggest, no modifiers are involved, I'd use chance_to_happen, since presumably not having to evaluate a script value is going to be better for performance. However, there are reasons you might choose one over another—or use them in combination—when things get a bit more complex.

Starting with the first two, the effects of chance_to_happen and chance_of_no_event are basically the same when used in isolation. The obvious difference, of course, is that chance_of_no_event takes a script value, which can be adjusted with conditionals, while chance_to_happen takes only a simple percentage chance. The two can be used in combination, however, and will chance_of_no_event will only be evaluated if chance_to_happen evaluates as true.

Code:
random_events = {
    chance_to_happen = 25
    chance_of_no_event = {
        value = 75
    }
    100 = cool_event.1 # will have a 6.25% chance of firing
}

n = 0 differs from the prior two cases in that, if both of those evaluate to true (or are omitted entirely), one event from the list will always fire so long as its trigger is valid. Thus, consider the following:—

Code:
random_events = {
    100 = common_event.1
    100 = common_event.2
    100 = common_event.3
    1 = very_rare_event.1
}

If the triggers for the common events evaluate to false because they're not valid to run, for whatever reason, the 'very rare' event will suddenly have a 100% chance of firing. Adding 100 = 0 to the above code, then, effectively acts a null event that does nothing but will always be available for selection—keeping the 'very rare' event, well, rare, even if none of the other options are available.
 
  • 1Love
Reactions:
I can't seem to get this working. I want to trigger a dialogue option only if the player has at least one of a number of titles in their realm.

Code:
            trigger = {
                if = {
                    limit = {
                        OR = {
                            completely_controls = title:b_nimes
                            completely_controls = title:b_pula
                            completely_controls = title:b_alexandria
                            completely_controls = title:b_roma
                            completely_controls = title:b_tunis
                        }
                    }
                }
            }

I'll be honest - I don't know what the precise syntax should look like, but from what I've looked up this seems to follow the correct pattern. But it's obviously not. I don't understand why practically every if = { is followed by a limit = { - what does the limit command do? Is it necessary?
 
I can't seem to get this working. I want to trigger a dialogue option only if the player has at least one of a number of titles in their realm.

Code:
            trigger = {
                if = {
                    limit = {
                        OR = {
                            completely_controls = title:b_nimes
                            completely_controls = title:b_pula
                            completely_controls = title:b_alexandria
                            completely_controls = title:b_roma
                            completely_controls = title:b_tunis
                        }
                    }
                }
            }

I'll be honest - I don't know what the precise syntax should look like, but from what I've looked up this seems to follow the correct pattern. But it's obviously not. I don't understand why practically every if = { is followed by a limit = { - what does the limit command do? Is it necessary?

The limit is what defines whether the code in the if block runs—but if, as I understand, this is a trigger inside an option block, you don't need either the if or the limit blocks! Try this:—

Code:
        option = {
            trigger = {
                OR = {
                    completely_controls = title:b_nimes
                    completely_controls = title:b_pula
                    completely_controls = title:b_alexandria
                    completely_controls = title:b_roma
                    completely_controls = title:b_tunis
                }
            }
            # The rest of the option block—at least a name with a localization key and the effects of choosing it
        }
 
  • 2Like
Reactions:
The limit is what defines whether the code in the if block runs—but if, as I understand, this is a trigger inside an option block, you don't need either the if or the limit blocks! Try this:—

Code:
        option = {
            trigger = {
                OR = {
                    completely_controls = title:b_nimes
                    completely_controls = title:b_pula
                    completely_controls = title:b_alexandria
                    completely_controls = title:b_roma
                    completely_controls = title:b_tunis
                }
            }
            # The rest of the option block—at least a name with a localization key and the effects of choosing it
        }
That's done the trick, thanks!

I guess I was stuck on the idea that this being a conditional matter, it MUST have an if in there somewhere, right? But of course the trigger is already a conditional so it doesn't need to have another. Thanks!

Okay, on to my second question of the day - I want a scope to return the name of a given holy site, but I'm not even sure if that's possible.

Getting the barony name is easy enough, but not every holy site matches the barony name (Sparta, for example), but I can't seem to get a way to return the holy site as defined in 00_holy_sites.txt.

So if there isn't a way to scope the name of a holy site, how can I get a scope to return a simple word of text that I define? Am I going to have to use custom localization, or can I avoid that and put it in the normal script?
 
Last edited:
Okay, on to my second question of the day - I want a scope to return the name of a given holy site, but I'm not even sure if that's possible.

Getting the barony name is easy enough, but not every holy site matches the barony name (Sparta, for example), but I can't seem to get a way to return the holy site as defined in 00_holy_sites.txt.

So if there isn't a way to scope the name of a holy site, how can I get a scope to return a simple word of text that I define? Am I going to have to use custom localization, or can I avoid that and put it in the normal script?

While getting a holy site's name is possible in certain circumstances—the name appears in the faith window and on the faith mapmode—I'm not entirely sure it's possible to do so from event localization. Even pilgrimage.0001, which provides a list of holy sites one can visit, shows 'the churches of Vaticano' as a location a Catholic might visit, though the holy site's name is 'Rome.' There's also the issue of the fact that single locations house differently-named holy sites for different religions—Sarnath and Varanasi, for example, which both subside within c_varanasi.

It's a bit out of my comfort zone to provide you a definitive answer to your second question, though if the simple word of text you wish to define is the name of the holy site, you should be able to just use the existing localization keys for holy site names in localization\english\religion\religion_l_english.yml.

The way I would probably try going about it—and I have no idea if it's a good way to go about it, 'cause it does seem computationally-expensive—would be to use switch to loop through holy sites known by you to have a name different from that of their holdings, checking against the character's faith where necessary to ensure you get the correct name for shared holy sites. If the holding scope matches that of the site with a different name, return its loc key—otherwise, if you get to the end and haven't yet returned anything, return the holding name instead.

As I say, this seems quite expensive, not to mention troublesome, so my honest advice, assuming no one else contradicts me and shows an easy way to get the holy site name, would be to settle for the holding name instead. You could always prefix it with something like 'the holy site at' to make it flow better in the text.
 
  • 1Like
Reactions:
While getting a holy site's name is possible in certain circumstances—the name appears in the faith window and on the faith mapmode—I'm not entirely sure it's possible to do so from event localization. Even pilgrimage.0001, which provides a list of holy sites one can visit, shows 'the churches of Vaticano' as a location a Catholic might visit, though the holy site's name is 'Rome.' There's also the issue of the fact that single locations house differently-named holy sites for different religions—Sarnath and Varanasi, for example, which both subside within c_varanasi.
This is pretty much the exact chain of thought that I had, so it's good to know that I'm not barking up the wrong tree (I'm barking up the right tree, but at the wrong cat). I did look into the GUI code for the faith window, but I couldn't find anything in there that might be useable. Perhaps I'm wrong, but it looks like the context is so different that it wouldn't work. Hey-ho, perhaps this is something to suggest to Paradox, that holy site names should be easily scopable.

(I was a little baffled from the very start by the pilgrimage event dialogue giving barony names rather than holy site names. It would be an improvement there as well)

Full context is that this is to return one word, in one event, one time only, so it seems counterproductive to spend so much effort on getting it working. But the whole idea is that a learned ruler can choose to visit the ruins of an old, 'dead' religion (Roman, Greek or Egyptian) and learn about that faith. So giving a barony name is less useful than the actual holy site itself. Going to "the ruins outside Tunis" doesn't carry as much meaning as "the ruins of Carthage". But the more I learn about this, the more likely it is I'll settle.

Unless someone else has a better idea for scoping holy sites by name?
 
  • 2Like
Reactions:
Hi all, is it possible to have, at a certain start date, an innovation almost discovered? You can easily set one as completely unlocked, but I don't know how if you can have it like halfway through the progress bar
 
Hi all, is it possible to have, at a certain start date, an innovation almost discovered? You can easily set one as completely unlocked, but I don't know how if you can have it like halfway through the progress bar
I'm no expert, but I don't think it's technically possible. However, would it be possible to have it undiscovered, and then have it automatically gain progress at the start of a game?
 
I made separate thread, but maybe I should asked it here:


Did anyone figure out how to return list of characters from scripted values (or whatever else). I want to mode character search, so I can add some additional filters to character list (like age based and also if someone is heir or not). character_grid is accepting list of characters for datamodel, but I did not figure out how to make a script which would return a list of something.

PS: Does anybody know where does gui turn of character search window. It is hiding automatically after interaction, and it is really annoying.
Edit: fixing hair/heir problem, tnx @x4077
 
Last edited:
  • 1Like
Reactions:
I made separate thread, but maybe I should asked it here:


Did anyone figure out how to return list of characters from scripted values (or whatever else). I want to mode character search, so I can add some additional filters to character list (like age based and also if someone is hair or not). character_grid is accepting list of characters for datamodel, but I did not figure out how to make a script which would return a list of something.

PS: Does anybody know where does gui turn of character search window. It is hiding automatically after interaction, and it is really annoying.

The Character finder GUI is in gui\window_character_finder.gui. It looks like it should be possible to add more filters there, but strangely, I can't figure out why it's closing after interactions; I agree, that is exceedingly annoying.
 
Did anyone figure out how to return list of characters from scripted values (or whatever else). I want to mode character search, so I can add some additional filters to character list (like age based and also if someone is hair or not). character_grid is accepting list of characters for datamodel, but I did not figure out how to make a script which would return a list of something.

What do you have against people do or do not have hair? Are you a baldist? Discrimination based on hair is really low.

On a serious note, take a look at the Forbes List mod ( https://mods.paradoxplaza.com/mods/13226/Any ). I used it as an example of how to build a list and bring up a custom window containing that list.
 
Is there way way to only pull traits with an index of 10000 and above from a gui?

Code:
  #Tried all of these from the fixedgridbox itself
          datamodel = "[GreaterThanOrEqualTo_int32(GetTraitForIndex(CharacterWindow.GetTraits),'(int32)9999')]"
          datamodel = "[GreaterThanOrEqualTo_int32(Index(CharacterWindow.GetTraits),'(int32)9999')]"
          datamodel = "[GreaterThanOrEqualTo_int32(GetIndex(CharacterWindow.GetTraits),'(int32)9999')]"

#And then tried this from fixedgridbox and the visible from the item to filter it there, still no luck
          datamodel = "[CharacterWindow.GetTraits]"
          visible = "[GreaterThanOrEqualTo_int32(GetTraitForIndex(Traits.Self),'(int32)9999')]"
 
Last edited:
I want to be able to get a character's consorts and lovers. I know I can use every_consort and every_relation { type = lover } and add them to a list, but this code is being run within an existing every_in_list loop, and the list persists through future iterations of the loop, and I can't find a way to clear it between them without going through every_consort and every_relation { type = lover } again to remove them after-the-fact. Is there a better way to do this?
 
Is it possible to make some specific innovations faster to discover? Or, if that's not possible, have them partially (like 30% of the progress bar) unlocked at the start of the game?
Also, alternatively, is it possible to create a modifier that gives a bonus to the Cultural Fascination Progress for only a specific innovation?
 
I want to be able to get a character's consorts and lovers. I know I can use every_consort and every_relation { type = lover } and add them to a list, but this code is being run within an existing every_in_list loop, and the list persists through future iterations of the loop, and I can't find a way to clear it between them without going through every_consort and every_relation { type = lover } again to remove them after-the-fact. Is there a better way to do this?

So you want to grab every consort and lover from a list and remove them from that list and put them in another separate one?
 
So you want to grab every consort and lover from a list and remove them from that list and put them in another separate one?

Ah, no; sorry. Basically, I have a given list through which I'm looping. For every character in the list, I want to randomly select someone who is either his spouse, concubine, or lover (and then do something with that person). However, I want to avoid other people in the list having the consorts or lovers of people earlier in the list available as targets:—

Code:
every_in_list = {
    list = my_list

    every_consort = { add_to_list = consorts_and_lovers }
    every_relation = {
        type = lover
        add_to_list = consorts_and_lovers
    }

    random_in_list = {
        list = consorts_and_lovers

        # Do something with a random member of consorts_and_lovers…

        # Because consorts_and_lovers persists through iterations of the outer every_in_list loop, each iteration
        # will add the current scope's consorts and lovers to the existing list of other consorts and lovers of
        # earlier-processed members of my_list, unless the consorts_and_lovers list is depopulated at the end
        # of each run, requiring another run through every_consort and every_relation…
    }

    every_consort = { remove_from_list = consorts_and_lovers }
    every_relation = {
        type = lover
        remove_from_list = consorts_and_lovers
    }
}

Basically, this seems so inefficient that I can't imagine it's the right way to go about it.

One other thought is to use add_to_temporary_list instead, but the documentation ('Adds the current scope to an arbitrarily-named list to be referenced later in the same effect') is rather unclear on whether or not that list will persist only through the current iteration of the loop or if it will persist throughout the entirety of the event block (and thus have the same problem).

Edit: Nope, add_to_temporary_list doesn't do the trick either.
 
Last edited:
The Character finder GUI is in gui\window_character_finder.gui. It looks like it should be possible to add more filters there, but strangely, I can't figure out why it's closing after interactions; I agree, that is exceedingly annoying.
I have found that file already. My problem was how to provide a custom list for it. About auto-closing, There is toggle for character_finder (or something named similar, i cant exactly say without rechecking it in code, but window part was omitted for sure) in hud file, but that does not explain auto-closing. Maybe solution for this is cloning that window and just showing cloned window instead of original window.
 
Ah, no; sorry. Basically, I have a given list through which I'm looping. For every character in the list, I want to randomly select someone who is either his spouse, concubine, or lover (and then do something with that person). However, I want to avoid other people in the list having the consorts or lovers of people earlier in the list available as targets:—

Code:
every_in_list = {
    list = my_list

    every_consort = { add_to_list = consorts_and_lovers }
    every_relation = {
        type = lover
        add_to_list = consorts_and_lovers
    }

    random_in_list = {
        list = consorts_and_lovers

        # Do something with a random member of consorts_and_lovers…

        # Because consorts_and_lovers persists through iterations of the outer every_in_list loop, each iteration
        # will add the current scope's consorts and lovers to the existing list of other consorts and lovers of
        # earlier-processed members of my_list, unless the consorts_and_lovers list is depopulated at the end
        # of each run, requiring another run through every_consort and every_relation…
    }

    every_consort = { remove_from_list = consorts_and_lovers }
    every_relation = {
        type = lover
        remove_from_list = consorts_and_lovers
    }
}

Basically, this seems so inefficient that I can't imagine it's the right way to go about it.

One other thought is to use add_to_temporary_list instead, but the documentation ('Adds the current scope to an arbitrarily-named list to be referenced later in the same effect') is rather unclear on whether or not that list will persist only through the current iteration of the loop or if it will persist throughout the entirety of the event block (and thus have the same problem).

Edit: Nope, add_to_temporary_list doesn't do the trick either.

So basically you want to grab an item from a list and pair it with another random item and then remove them both?

Consider using a while block, since this will allow you to pick the first character and then randomly pick another.

Something like this:

Code:
while = {
    limit = {
        any_in_list = {
            list = my_list
            count > 1
        }
    }
    random_in_list = {
        list = my_list
        save_temporary_scope_as = picked_character

        # the picked character is removed here in case they don't have any consorts or lovers available
        # and must be removed from the list to satisfy the while block

        remove_from_list = scope:picked_character

        random_in_list = {
            list = my_list
            limit = {
                OR = {
                    has_relation_lover = scope:picked_character
                    is_consort_of = scope:picked_character
                }
            }
            save_temporary_scope_as = paired_character
            # Do something
            remove_from_list = scope:paired_character
        }
    }
}

Also, by any chance are you making some kind of CK3 speed dating mod or something? :D
 
  • 1
Reactions: