• 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.
I think you're misunderstanding how event targets work. The mother event passes all event targets to daughter events; changes in one daughter event will not affect the copy of the event target in sister events, but only in its daughter events. You have to structure your event chain with that fact in mind.
 
Yeah, as richvh points out, just because the name of the event_target is the same, the "instance" of the event_target is actually unique for each chain of the event. That's on purpose. The only way you can have different chains of an event interact with the same event_target is to use a global_event_target instead.
 
In the first version, the mother event has many daughter events, the event target is changed in a daughter event, and all sister events see the change. This is seen from the fact that in the first event version, there's only ever one log line from the daughter events.

My point is not that in that the changes fail to propagate in the second version, but that they do in the first case and don't in second case, which differ only in having a time delay. It's the mismatch that's puzzling me.

I could very well be (and probably am) misunderstanding how things are intended to work, but if so, I don't think @richvh's solves my misconceptions (to be clear, @richvh's post indicates that the second version behaves correctly, but that just raises the question why the first version behaves differently, because it shows a change made by a daughter event propagating upwards to the mother event and inherited by other daughters, so it's not always the case that the daughters inherit independent copies).
 
Last edited:
  • 1
Reactions:
In the first version, the mother event has many daughter events, the event target is changed in a daughter event, and all sister events see the change. This is seen from the fact that in the first event version, there's only ever one log line from the daughter events.

My point is not that in that the changes fail to propagate in the second version, but that they do in the first case and don't in second case, which differ only in having a time delay. It's the mismatch that's puzzling me.

I could very well be (and probably am) misunderstanding how things are intended to work, but if so, I don't think @richvh's solves my misconceptions (to be clear, @richvh's post indicates that the second version behaves correctly, but that just raises the question why the first version behaves differently, because it shows a change made by a daughter event propagating upwards to the mother event and inherited by other daughters, so it's not always the case that the daughters inherit independent copies).
Very interesting find. We're investigating this.
 
In the first version, the mother event has many daughter events, the event target is changed in a daughter event, and all sister events see the change. This is seen from the fact that in the first event version, there's only ever one log line from the daughter events.

My point is not that in that the changes fail to propagate in the second version, but that they do in the first case and don't in second case, which differ only in having a time delay. It's the mismatch that's puzzling me.

I could very well be (and probably am) misunderstanding how things are intended to work, but if so, I don't think @richvh's solves my misconceptions (to be clear, @richvh's post indicates that the second version behaves correctly, but that just raises the question why the first version behaves differently, because it shows a change made by a daughter event propagating upwards to the mother event and inherited by other daughters, so it's not always the case that the daughters inherit independent copies).

You are actually right. When shooting an event in immediate with no delay, the new event actually uses the original event's scope (sort of like a sub-routine). I wasn't aware of this behavior (it does not work like that in EU4) and personally I think it is dangerous. But now we have it and we won't change it. So take that into account when scripting.
 
Last edited:
  • 3
Reactions:
You are actually right. When shooting an event in immediate with no delay, the the new event actually uses the original event's scope (sort of like a sub-routine). I wasn't aware of this behavior (it does not work like that in EU4) and personally I think it is dangerous. But now we have it and we won't change it. So take that into account when scripting.

What do you exactly mean by "the original event scope"? Concretely, say I fire an event to character A, and in the immediate I fire a second event without delay to character B and C. Does this e.g. affect the pointers (ROOT FROM; FROMFROM, etc.) or only the event_targets?
Which kind of precautions should we then be taking when firing events from immediate without delay, as opposed to doing so with delay?
 
  • 1
Reactions:
What do you exactly mean by "the original event scope"? Concretely, say I fire an event to character A, and in the immediate I fire a second event without delay to character B and C. Does this e.g. affect the pointers (ROOT FROM; FROMFROM, etc.) or only the event_targets?
Which kind of precautions should we then be taking when firing events from immediate without delay, as opposed to doing so with delay?

Normally when one event fires a another one, the second event creates a FROM scope that is a copy of the original event's scope. And should that event fire a third event, that event will create a chain of two FROM scopes that are copies of the earlier event scopes. But in this case, shooting an event in immediate with no delay, the new event doesn't create a copy for the FROM scope but actually points back to the original scope. Which means if you, as in the example above, fire several such events they can all reach/change the original scope. But I don't believe this will concern anything other than event targets.
 
  • 5
Reactions:
We have come across an issue with the marriage AI. It seems a recent patch may of messed up the marriage AI for those characters who are in a 'divine_blood = yes' dynasty. They seem to only ever want marriages within their own dynasty, never going for political marriages outside the dynasty. They will even remain unmarried for their entire lives if there are no suitable marriage candidates in their own dynasty. Needless to say this has dire consequences for the Targaryens in AGoT :D

Some sort of balance in between where they sometimes go for incest and sometimes not would be good.
 
We have come across an issue with the marriage AI. It seems a recent patch may of messed up the marriage AI for those characters who are in a 'divine_blood = yes' dynasty. They seem to only ever want marriages within their own dynasty, never going for political marriages outside the dynasty. They will even remain unmarried for their entire lives if there are no suitable marriage candidates in their own dynasty. Needless to say this has dire consequences for the Targaryens in AGoT :D

Some sort of balance in between where they sometimes go for incest and sometimes not would be good.
Given that this also adversely affects Zoroastrians in vanilla, you should probably also make a thread in the Bug Reports subforum.
 
Given that this also adversely affects Zoroastrians in vanilla, you should probably also make a thread in the Bug Reports subforum.
I've made sure that this is on our bug-tracking database. I might end up being the one that fixes it in the end but we're aware of it now at least.
 
  • 4
Reactions:
Patch 2.5.2 issue: infamy_modifier does not work-- at all.

One of the key issues addressed with infamy in patch 2.5.2 was the ability to vary the total amount of infamy gained from a war individually by CB type via a new CB parameter infamy_modifier, which is supposed to be a multiplier/factor applied to any Threat which might be gained from that type of war. This new parameter is used in several vanilla CBs, as heavily advertised with patch 2.5.2. However, infamy_modifier does NOT work.

Regardless of the value or formatting of the numeric parameter given to infamy_modifier in any CB, it has no effect whatsoever upon the Threat value gained from CB success. It is as if the implementation of this feature were simply forgotten in the merge for the release of patch 2.5.2.

I've been dealing with this in many of my own mods' CBs for awhile, but I finally decided to thoroughly test this in isolation and report it, because it is a game-changing feature insofar as the Threat mechanic is concerned and is already relied-upon by vanilla. The [probably obvious] fix for this issue will likely result in a major face-palm somewhere in Stockholm, although in the interest of simply having this functionality ASAP, I do hope that I'll be the one facepalming. ;)

I've written an ultra-simple, annotated test CB to demonstrate the problem. I've also placed the CB file into a test mod for easy verification, which is attached to this post.

First, let's cover the test CB for reference, and then I'll show you it in action-- or, rather, as far as infamy_modifier goes, lack of action.

Code:
# This infamy_modifier test CB was designed to be as simple as possible, usable within fully vanilla context,
# and used in the same way(s) that vanilla 2.5.2 uses infamy_modifier. It shows that, for all intents and purposes,
# the CB parameter `infamy_modifier` is ignored.
#
# I chose an is_permanent=yes, check_de_jure_tier=DUKE invasion-style CB only allowed between independent ROOT and FROM.
# The CB itself, of course, is entirely WAD, aside from infamy_modifier's epic fail.

cb_test_infamy_modifier = {
    name = CB_NAME_INVASION
    war_name = WAR_NAME_INVASION
    sprite = 8
    truce_days = 3650
    hostile_against_others = yes
    can_ask_to_join_war = no
    is_permanent = yes
    check_de_jure_tier = DUKE
  
    allowed_to_target_tributaries = no
    allowed_to_target_suzerains = no
  
    # None of these infamy_modifier variants affected Threat gain due to any war outcome (all tested):

    # infamy_modifier = 0 # Why initially chosen: main, desired behavior that led to discovery of this problem
  
    infamy_modifier = 0.0 # Why: perhaps there's a parsing issue with bare integers on the RHS (e.g., 0 as above)
  
    # infamy_modifier = 0.01  # Why: perhaps it doesn't work with a strictly-zero-valued parameter at all
    # infamy_modifier = 0.85  # Why: sanity-checking a value used in vanilla's `claim` CB (#1) -- no dice
    # infamy_modifier = -1.0  # Why: maybe it's not a multiplier/factor but indeed a "modifier," as its name suggests
    # infamy_modifier = -0.99 # Why: maybe it doesn't like 0% infamy at all, given the prior "modifier" logic
    # infamy_modifier = -0.85 # ...

    can_use = {
        ROOT = {
            independent = yes
            NOT = { same_realm = FROM }
        }
    }

    can_use_title = {
        # Any duchy with a direct border
        any_direct_de_jure_vassal_title = {
            holder_scope = { same_realm = FROM }
            location = {
                any_neighbor_province = {
                    owner = { same_realm = ROOT }
                }
            }
        }
    }

    is_valid_title = {
        FROM = {
            any_realm_title = {
                de_jure_liege_or_above = PREVPREV
            }
        }
    }

    on_success_title = {
        ROOT = {
            vassalize_or_take_under_title = {
                title = PREV
                enemy = FROM
                type = invasion
            }
        }
        if = {
            limit = { holder_scope = { same_realm = FROM } }
            usurp_title_only = { target = ROOT type = invasion }
        }
      
        # Variants such as this were also tried (though definitely not necessary):
      
        # ROOT = {
        #     gain_settlements_under_title = {
        #         title = PREV
        #         enemy = FROM
        #         is_crusade = yes # Even if the title holder is not participating in the war...
        #         type = invasion
        #     }
        # }
    }

    on_fail = { } # No need

    on_reverse_demand = { } # No need

    attacker_ai_victory_worth = {
        factor = -1 # always accept
    }

    attacker_ai_defeat_worth = {
        factor = 100
    }

    defender_ai_victory_worth = {
        factor = -1 # always accept
    }

    defender_ai_defeat_worth = {
        factor = 100
    }
}

Got it? Good. Now, let's see it in action...

Spoiler: Despite infamy_modifier = 0.0 in the CB (as one of the numerous values tried), we will still accrue the same amount of Threat as we do in any war with the parameter set to anything else or excluded altogether.

I load up in 1066 as Heinrich Salian [Holy Roman Emperor]. I immediately use the test CB to invade France for the neighboring Duchy of Flanders:



Now, since I'd rather this not get bloody, I then immediately switch to King Philippe of France and surrender to the HRE:



I switch back to the HRE, and I accept the French surrender:



Excellent. Flanders is now under my control, and I've won-- but, wait, what's this?



I've gained 12.00% Threat due to the 'Holy Roman Invasion of Flanders,' and yet I should not have accrued any Threat at all. Once I unpause, the defensive pacts form (as they start forming at 5% Threat).

...

Beers to @Divine if he can tell us how to properly write CBs with varying levels of Threat impact w/ the current patch.

Presently, for special-purpose CBs which tend to come up in "restoration / unification / anarchy" historical scenarios (or, say, various historical invasions in the game already), my only options to prevent the Defensive Pact mechanic from overreacting to these types of wars and thus preventing the desired behavior are to either:

  • Disable the Threat / D-Pact mechanic entirely -- game/mod-global
  • Prevent the involved AIs from using any CBs via normal war declaration mechanisms and force all "desired" war declarations to be scripted (using the infamy = 0 parameter which can be passed to the war and reverse_war commands).
Thanks for taking the time to read this, and hopefully there'll soon be a solution. I'm sure users of vanilla would appreciate the fix as well.
 

Attachments

  • cb_test_infamy_modifier.zip
    2,2 KB · Views: 4
  • 2
Reactions:
Patch 2.5.2 issue: infamy_modifier does not work-- at all.

One of the key issues addressed with infamy in patch 2.5.2 was the ability to vary the total amount of infamy gained from a war individually by CB type via a new CB parameter infamy_modifier, which is supposed to be a multiplier/factor applied to any Threat which might be gained from that type of war. This new parameter is used in several vanilla CBs, as heavily advertised with patch 2.5.2. However, infamy_modifier does NOT work.

...

Good observation and information. I've been doing some test-cases in the dev-version and I've managed to somewhat reproduce your scenario. However the game seems to read the infamy_modifier for me (which is functionally used as a multiplier). The culprit to why I gained infamy was that there's a value in defines that is forcing me to gain some minimum amount of infamy for every province conquered.

Can you try to modify the value
Code:
NInfamy - MIN_INFAMY_PER_WAR_PROVINCE
in common/defines.lua and set it to 0 and see if you still have trouble modifying the infamy values. If there's still an issue in the live version I'll have to fetch that version to see where it is wrong.
 
  • 4
Reactions:
Good observation and information. I've been doing some test-cases in the dev-version and I've managed to somewhat reproduce your scenario. However the game seems to read the infamy_modifier for me (which is functionally used as a multiplier). The culprit to why I gained infamy was that there's a value in defines that is forcing me to gain some minimum amount of infamy for every province conquered.

Can you try to modify the value
Code:
NInfamy - MIN_INFAMY_PER_WAR_PROVINCE
in common/defines.lua and set it to 0 and see if you still have trouble modifying the infamy values. If there's still an issue in the live version I'll have to fetch that version to see where it is wrong.

Beers, Divine-- I now owe you at least a couple more. Thanks for the swift reply. Spot-on diagnosis, and indeed, your suggested solution is fully-functional for the live version (2.5.2).

To sum up, in order for lower (or, almost any, in practice) values of `infamy_modifier` in CBs to make any difference to actual Threat gain, add this to your mods' define overrides, folks:

Code:
NDefines.NInfamy.MIN_INFAMY_PER_WAR_PROVINCE = 0

Since my last post included a picture show too, here's the final screenshot after declaring and winning the same war with the cb_test_infamy_modifier CB which I previously referenced -- after overriding MIN_INFAMY_PER_WAR_PROVINCE as suggested:



( No threat gained whatsoever; not even a 'Holy Roman Invasion of Flanders -- 0.00%' on the Threat tooltip breakdown )

Total success, and again, thanks for the swift and poignant diagnosis, Divine.
 
So that means MIN_INFAMY_PER_WAR_PROVINCE overrides any infamy_modifier setting in a CB?

That's...not exactly great. I would have assumed the infamy_modifier multiplier would apply after all other calculations.
 
  • 1
Reactions:
So that means MIN_INFAMY_PER_WAR_PROVINCE overrides any infamy_modifier setting in a CB?

That's...not exactly great. I would have assumed the infamy_modifier multiplier would apply after all other calculations.
I agree that [future, perhaps] application of infamy_modifier after all other Threat calculations would be a design featuring more utility and flexibility whilst much more commonly "working as expected" for scripters.
 
Something that Galle pointed out in another thread, and that I'd like to report in case it's a bug rather than a misuse.

When you create a new character you can use the command dna = <string> to specify the dna of a character. Now one would think that the game could let a RHS to be a valid argument for the dna command (e.g. dna = ROOT, dna = event_target:my_target). but this is not the case, instead, the game try to apply the name of the scope as the dna (for example try to use "ROOT" or "event_target:my_target" as a dna string. Just wanted to note here in case this is a non-intended behaviour of the code.
 
Something that Galle pointed out in another thread, and that I'd like to report in case it's a bug rather than a misuse.

When you create a new character you can use the command dna = <string> to specify the dna of a character. Now one would think that the game could let a RHS to be a valid argument for the dna command (e.g. dna = ROOT, dna = event_target:my_target). but this is not the case, instead, the game try to apply the name of the scope as the dna (for example try to use "ROOT" or "event_target:my_target" as a dna string. Just wanted to note here in case this is a non-intended behaviour of the code.
I do believe that is the intended use as you are setting the dna to be that string not copying it from a scope, hence there is a suggestion for a copy_dna and set_dna commands in the suggestions thread
 
So that means MIN_INFAMY_PER_WAR_PROVINCE overrides any infamy_modifier setting in a CB?

That's...not exactly great. I would have assumed the infamy_modifier multiplier would apply after all other calculations.

If I'm understanding this correctly, MIN_INFAMY_PER_WAR_PROVINCE sets a floor on infamy gain after modifiers are applied. That's the behavior I'd expect from the name, and it sounds potentially useful to me. That said, the default value should most definitely be low enough that CBs with a modifier of 1 generally exceed the minimum.
 
  • 2
Reactions:
Here's something that may just be something as innocuous as an oversight on the tool tip front, but I figured I should ask and see what the consensus may be.

Currently as a Merchant Republic you cannot build a trade post in a province that is also on any pre-defined trade route, like the Silk Road, unless you own the whole province. This goes counter to the stated intention of the written tool tip as so:

Screenshot 2016-04-20 22.45.33.jpg


It stipulates that you may build a TP in any province, even foreign ones, as an MR. Most importantly it does not imply that MRs should be locked out of building a TP there, quite the opposite in fact.
It only explains that the owner can also build a TP there. If we examine the actual checks portion of the tooltip however, we can clearly see a "Directly Owns Province" as being part of the implied AND section of the allowance.

If one were to look at the Build TP description of a coastal province without a trade route, you would see almost the exact same tooltip, except for one important aspect:

Screenshot 2016-04-20 22.45.22.jpg


The "Directly Owns Province" check is completely gone in this case, but the text description at the top reads the same nonetheless.

What is the intended behaviour here? Should MRs be able to build a TP in a province on a trade route they do not fully control, or is this simply an incorrect tool tip and is in fact intended that they cannot build there?

Any help or input would be greatly appreciated :)
 
Here's something that may just be something as innocuous as an oversight on the tool tip front, but I figured I should ask and see what the consensus may be.

Currently as a Merchant Republic you cannot build a trade post in a province that is also on any pre-defined trade route, like the Silk Road, unless you own the whole province. This goes counter to the stated intention of the written tool tip as so:

View attachment 172016

It stipulates that you may build a TP in any province, even foreign ones, as an MR. Most importantly it does not imply that MRs should be locked out of building a TP there, quite the opposite in fact.
It only explains that the owner can also build a TP there. If we examine the actual checks portion of the tooltip however, we can clearly see a "Directly Owns Province" as being part of the implied AND section of the allowance.

If one were to look at the Build TP description of a coastal province without a trade route, you would see almost the exact same tooltip, except for one important aspect:

View attachment 172014

The "Directly Owns Province" check is completely gone in this case, but the text description at the top reads the same nonetheless.

What is the intended behaviour here? Should MRs be able to build a TP in a province on a trade route they do not fully control, or is this simply an incorrect tool tip and is in fact intended that they cannot build there?

Any help or input would be greatly appreciated :)
That does seem a little bit off with the current tooltip. I think it might be working as designed so the Merchant Republics have to fight other rulers for control of the trade route provinces which would imply that the descriptive text doesn't tell the whole truth. However I'm poking the dev-team to take a quick look on it.

Edit: @zeress Actually it seemed like they wanted wanted the coastal province in the same ocean rule to take precedence over the other rules. So I took the liberty of fixing that. So coastal provinces in the same ocean as the Merchant Republic should, in an upcoming patch, now always be a valid placement for a trade post regardless of the trade route status.
 
Last edited: