Results 1 to 11 of 11

Thread: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

  1. #1

    Default How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    I would like a change in the level of political influence to result in the player receiving a certain message.


    I know that this can be done by writing an appropriate script that will instruct the game to display a given message when certain conditions are met.


    However, I am having trouble formulating these conditions. I tried to use the formula from the thirst for power trait, only that the level of political power that is measured by the trait does not correspond in any way to the percentage of influence that is displayed in the game (I suspect that this is some kind of calculation based on the number of gravitas, because the numbers I got in log form were nowhere near the percentage of influence or the number of senators).


    I was wondering about the CampaignEffectsBundleAwarded function, but I don't know if it's possible to define the specific effect it would take into account, and in this case the effect bundle key, which can be found in the effect_bundles_to_effects_junctions table.


    I would appreciate any suggestions.

  2. #2
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    you can spawn incidents with +/- power payload through lua
    will affect ruling party power only

    I don't really think there is any other way about power stuff (except the effect that works the same way)

    if you want to spawn stuff depending on power% then trying through that pol script is the only way
    I dunno if it can work or not, you should contact a rl coder that has lua knowledge

  3. #3

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    Quote Originally Posted by Jake Armitage View Post
    if you want to spawn stuff depending on power% then trying through that pol script is the only way
    I dunno if it can work or not, you should contact a rl coder that has lua knowledge
    For me it seems, that the other (indirect) way, would be to check if one of the level of support effect bundles (which depends on % power support and could be modified) was appiled to a faction.

  4. #4
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    you can track down effects through db cdir event system only, you can't via lua and you can't via UI 'cause most of the times effects aren't individually listed but... they are a UI list handled via the dll
    one way could be through UI texts but expert modders and rl coders told me it won't work

  5. #5

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    Quote Originally Posted by Jake Armitage View Post
    you can track down effects through db cdir event system only, you can't via lua and you can't via UI 'cause most of the times effects aren't individually listed but... they are a UI list handled via the dll
    one way could be through UI texts but expert modders and rl coders told me it won't work
    Yeah, UI text was also last thing that I thought about...

    Anyway, using the code implemented in thirst for power trait I made some test regarding the values that are returned for each party of Rome faction in the vanilla. It seems that there is a strong correlation between % of influence for ruling party and returned values of power (when comparing them to total power returned for all parties). The result were as follows:
    turn - influence % value - % power value as a result of comparision with the sum of all parties' power:
    1 - 26 - 21,8
    2 - 30 - 25,9
    3 - 32 - 29,2
    4 - 34 - 31,8
    5 - 40 - 37,8
    6 - 42 - 40
    7 - 43 - 41,7
    8 - 47 - 45,9
    9 - 48 - 47,5
    10 - 52 - 50,7
    11 - 55 - 53,6
    12 - 57 - 55,2
    13 - 58 - 56,6

    As you can see the sample is not big enough to draw any definitive conclusions (although I use some political actions to see if it will has some influence on the existing gap between both values - look at turns 4 and 5 for example) but it seems to be worth of further testing. Probably CA prepared slighty different method for influence's calculation but it is still - at some point - linked to these power values or even is based on them, but of course we don't know the full formula.
    Last edited by K4mil; September 07, 2022 at 12:08 PM.

  6. #6
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    can you upload the pack you're using for tracking down those values?

  7. #7

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    Quote Originally Posted by Jake Armitage View Post
    can you upload the pack you're using for tracking down those values?
    Here is a pack with scripts extracted from my mod where I used it to show a player a proper message when level of influence is changed. As you can see from the above, it is not 100% accurate but I can live with it (and the players too) - https://www.mediafire.com/file/y73k6...ence.pack/file

    I also discovered that the starting power values are definied in political_parties_power_effect_bundles. If you set the values of power to be identical for each party it still results in some differences in the influence at the start of the campaign but they are less significant and therefore the formula to calculate % of influence based on proportion of power tracked by this script is more accurate even from the begining (when differences are the most noticeable). I also tested it with some in-game political function like purge option and it properly reacts to that kind of changes.

    Based on that script it is possible to track current % of influence of each party and make it a trigger for various in-game events/effects.
    Last edited by K4mil; September 08, 2022 at 09:03 AM.

  8. #8
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    thank you man, I'll check it for sure

  9. #9
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    ps. just a reminder

    keep in mind that DeI has 7/8 parties for faction, you may want to consider the ones that spawn after a civil war, eventually. they are brand new ones

    local first_party = parties[1]
    dev.log(ruling_party)
    local second_party = parties[2]
    local third_party = parties[3]
    local fourth_party = parties[4]

    hope they just work with integers as the others do, they should

  10. #10

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    Quote Originally Posted by Jake Armitage View Post
    ps. just a reminder

    keep in mind that DeI has 7/8 parties for faction, you may want to consider the ones that spawn after a civil war, eventually. they are brand new ones

    local first_party = parties[1]
    dev.log(ruling_party)
    local second_party = parties[2]
    local third_party = parties[3]
    local fourth_party = parties[4]

    hope they just work with integers as the others do, they should
    Yes I also thought about that but they probably "take place" of the eliminated party because I didn't recive any results when I checked it for fifth party. Anyway, I don't know if I'll make a mod which includes a more ambitious mechanics than I introduced in current version (which I probably publish on steam and update submod thread in DeI section), but I hope that these "findings" will be useful also for other modders in their work and that maybe they will discover the full formula which stands behind in-game % influence calculation. And to be honest, my work is mainly an effect of your previous findings
    Last edited by K4mil; September 08, 2022 at 11:15 AM.

  11. #11
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: How to make a change in the level of influence in the senate a trigger for a player to receive a certain message?

    it would be better to test while a spawned party is effectively in the game, could be it replaces 2/3/4 but I'm prone to assume it doesn't

    you've done a really useful thing and I thank you for that
    about "my" findings... well yes I snooped ca scripts but now that I see your lua I really am not sure if I'd have been able to actually build something that would have worked

    ps. I wrote you a lil msg in discord so to check if you're alive there
    Last edited by Jake Armitage; September 09, 2022 at 05:27 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •