Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

2 hours ago, bicobus said:

What is your test modus operandi?

 

create_character does a minimum, generates crap npc. Also random doesn't mean different, just not directed.

I fire the game and click "Create New Vassal" on several baronies.

 

I do not mind if the npcs are crap. What puzzles me is that whenever this command is used in any other scenario (for example in employment_decisions.txt in vanilla, or in numerous other events I created), the generated characters are always different. But these characters are virtually copies of each other. I can randomize their traits, of course, but I do not think that names or portraits are "randomizable".

Link to comment
11 hours ago, Buzhidao said:

I fire the game and click "Create New Vassal" on several baronies.

 

I do not mind if the npcs are crap. What puzzles me is that whenever this command is used in any other scenario (for example in employment_decisions.txt in vanilla, or in numerous other events I created), the generated characters are always different. But these characters are virtually copies of each other. I can randomize their traits, of course, but I do not think that names or portraits are "randomizable".

Do you do fire the event in paused state, or let you run the game in between each generation?

If you paused the game, that would explain the cloning, since the internal random generator doesn't progress.

Randoms are generated by dividing huge numbers, often runtime in ms. If the game is paused, the internal runtime doesn't increase

Link to comment
12 hours ago, Buzhidao said:

What puzzles me is that whenever this command is used in any other scenario (for example in employment_decisions.txt in vanilla, or in numerous other events I created), the generated characters are always different.

I have since found out that I was wrong on this count. It does happen in some other instances, but (I might be wrong on this as well) it only happens to female characters.

 

1 hour ago, Kiara said:

Do you do fire the event in paused state, or let you run the game in between each generation?

If you paused the game, that would explain the cloning, since the internal random generator doesn't progress.

Randoms are generated by dividing huge numbers, often runtime in ms. If the game is paused, the internal runtime doesn't increase

I thought so too at first, but sadly this isn't the case. It doesn't matter if the game is paused or running, it doesn't affect the result. Maybe if I let the game run for a few months or years between generations the result would be different, but I doubt it, and that's too long to be a reasonable solution.

 

I did manage to randomize the portraits however. I used the genetic_father clause to do it. Now all I need is a way to randomize the names.

I will try moving the script into a different scope, such as random_realm_lord or something similar, maybe that would help.

If that doesn't help, I will just generate characters with 0 health, and let death carry out the randomization.

Link to comment

No, "pausing the game" won't change the rng because you do not pause the game, you pause the flow of time. The software still runs and still consume cpu cycles.

 

You may want to use on of the create_random{_steward, _diplomat, _soldier} instead. Or put one or several random_list {} in the new_character command, which will add more entropy to the new characters trait and attributes. That is how vanilla does it to get different NPC with the employ decisions.

Link to comment

You are right, regarding the cpu cycles, but, as far as I know, somewhere deep in the paradox forum one of the people of them once stated, that some rng rely on ingame time, and some others on cpu. the starting DNA string being an ingame thing. but since it deosn't seem to be the case here, thats irrelevant. (and maybe that information is outdated like for 5 yrs, I have not that reliable of a memory)

Link to comment
15 hours ago, bicobus said:

No, "pausing the game" won't change the rng because you do not pause the game, you pause the flow of time. The software still runs and still consume cpu cycles.

 

You may want to use on of the create_random{_steward, _diplomat, _soldier} instead. Or put one or several random_list {} in the new_character command, which will add more entropy to the new characters trait and attributes. That is how vanilla does it to get different NPC with the employ decisions.

No, these education-oriented commands are essentially the same create_character command, just with a different flavor. I am using them already for different types of holdings.

random_list just allows to mix up a character's traits. Trait randomization is not the main problem now - it's generating random character names.

I wonder, if I use copy_name and try copying names from random characters of the same culture and sex, would that work, and if so, would it be CPU-intensive, because I'd have to use the random_character scope?

Link to comment

Back at my PC. Kiara, I used the code you wrote for my MTTH event and it worked. I find it a bit frustrating that the event isn't triggered by an on_action because in the particular case it would makes sense. But since you can't use MTTH in on_action events but weight multiplier (according to the wiki) and the two do not produce the same effect, I will use yours. Thanks !

 

I'm having a problem with the graphics for artifacts. The pictures I am using do not appear in the treasury, I just get an icon with a big red X.

I am using Gimp generated dds files 118x118 and 59x59 pix. which are in the gfx/ interface/inventory/artifacts folder of my mod.


 

Spoiler

 

An example of an artifact:

 

rsl_the_rack = {
            intrigue = 1
            learning = 1
            quality = 2
            stacking = no
            picture = "GFX_rsl_the_rack"
            allowed_gift = {
                        always = no
            }
            slot = instrument_of_torture
}

 

 

and the corresponding spritefile;


 

Spoiler

 

spriteTypes = {

 

spriteType = {
        name = "GFX_rsl_the_rack"
        texturefile = "gfx\\interface\\inventory\\artifacts\\rsl_the_rack.dds"
    }
    spriteType = {
        name = "GFX_rsl_the_rack_small"
        texturefile = "gfx\\interface\\inventory\\artifacts\\rsl_the_rack_small.dds"
    }

}

 

 

The wiki contains a phrase that confuses me: "The link between the GFX code and the picture is in Vanilla file interface/domestic_treasury.gfx." Does this mean that the sprite file must be in the Vanilla directory?

Link to comment

I have made a targeted_decision with third_party_potential. Since it involves three characters I would expect ( like) all three portraits to appear in the event_window triggered by the decision. However only ROOT and FROM are shown FROMFROM is absent. Does anybody know if this Is standard and if so is there a work around?

 

I just think having the three portraits is more immersive.

Link to comment

Thanks ngppgn. I seem to be running into the limits of what is possible.

 

Here is another question.

 

I am trying to implement the concept of willpower. I want it to be the sum of a characters 5 main attributes ( intrigue, martial etc. )

 

I tried the following scripted effect :

 

calculate_willpower = {
                set_variable = { which = willpower value = 0 }    
                export_to_variable = { which = willpower_1 value = intrigue }
                export_to_variable = { which = willpower_2 value = martial }
                export_to_variable = { which = willpower_3 value = diplomacy }
                export_to_variable = { which = willpower_4 value = learning }
                export_to_variable = { which = willpower_5 value = stewardship }
                change_variable = { which = willpower which = willpower_1 which = willpower_2 which = willpower_3 which = willpower_4 which = willpower_5 }
}

 

In game it executes correctly up for the last line. I hoped the change_variable command would give me the sum of willpower_1 to _5. Unhappily it returns willpower = 0

Is it possible to sum variables in CK2?

 

 

 

Link to comment
1 hour ago, joemann said:

change_variable = { which = willpower which = willpower_1 which = willpower_2 which = willpower_3 which = willpower_4 which = willpower_5 }

change_variable only works with two variables or one variable & one number, not with multiple.
But since :

change_variable = { which = a which = b }

basically means:

a = a + b

We can just write multiple change_variable commands that all change a or in your case willpower:

change_variable = { which = willpower which = willpower_1 }
change_variable = { which = willpower which = willpower_2 }
change_variable = { which = willpower which = willpower_3 }
change_variable = { which = willpower which = willpower_4 }
change_variable = { which = willpower which = willpower_5 }

 

Link to comment

Thanks, Henning for your clear explanation! It makes perfect sense.

 

I modified my scripted_effect as follows:

 

Spoiler

calculate_willpower = {
                set_variable = { which = willpower value = 0 }    
                export_to_variable = { which = willpower_1 value = intrigue }
                export_to_variable = { which = willpower_2 value = martial }
                export_to_variable = { which = willpower_3 value = diplomacy }
                export_to_variable = { which = willpower_4 value = learning }
                export_to_variable = { which = willpower_5 value = stewardship }
                change_variable = { which = willpower which = willpower_1 }
                change_variable = { which = willpower which = willpower_2 }
                change_variable = { which = willpower which = willpower_3 }
                change_variable = { which = willpower which = willpower_4 }
                change_variable = { which = willpower which = willpower_5 }

             

and expected to get the desired result. However, in the tool tip willpower stubbornly remains at 0. I must be doing something else wrong.

 

The relevant event option in which I use the effect is as follows:

 

Spoiler

narrative_event = {
    id = RSLCourt.5105
    desc = RSLCourt5105
    picture = torture_chamber
    title = rsl_last_chance
    is_triggered_only = yes # Triggered by .5100
    
                
    
    
    option = { # Convince victim to pay a ransom (using transfer_scaled_wealth)
        trigger = {
                event_target:rsl_victim_target = {
                                                OR = {
                                                     wealth = 10
                                                     liege = { wealth = 50 }
                                                     spouse = { wealth = 50 }
                                                
                                                }                                        
                }
        }
        name = EVTOPTA_Court_5105
        
        event_target:rsl_victim_target = {
                                        calculate_willpower = yes
        }
        
        
        if = {
            limit = {
                event_target:rsl_victim_target = {
                check_variable = { which = willpower value = 25 } #If our victims have at least a will_power of 25 they refuse
                }
            }
            character_event = { id = RSLCourt.5200 }  # Refusal: Leads to the will_breaking process to start
            event_target:rsl_victim_target = {
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_player_target
                                        }
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_torturer_target
                                        }
                                }
            break = yes # Removes us from this option block
        }
        # This processes if our victim has will_power below 25
        hidden_tooltip = {
                    random_list = {
                                30 = {
                                    narrative_event = { id = RSLCourt.5200 } # Refusal: Leads to the will_breaking process to start
                                    event_target:rsl_victim_target = {
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_player_target
                                        }
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_torturer_target
                                        }
                                    }
                                }    
                                70 = {
                                    narrative_event = { id = RSLCourt.5111 } # Leads to the victim submitting
                                    event_target:rsl_victim_target = {
                                        opinion = {
                                                modifier = rsl_opinion_intimidated
                                                who = event_target:rsl_player_target
                                        }
                                    }
                                }
                                
                    }
        }
        
    }

Do you see anything that would  calculate_willpower from working?

Link to comment
2 hours ago, joemann said:

However, in the tool tip willpower stubbornly remains at 0.

The game probably just skips certain commands when trying to preview what is going to happen, including scripted effects.
Try putting calculate_willpower = yes in the immediate block, since that block gets executed before showing the event. Willpower should then be set and correctly displayed in the tool tip. Otherwise I couldn't think of a way to do it.

Link to comment

Thank's I did this and willpower is now correctly calculated. However, since I believe you can not use an immediate block inside an option block (correct ?), I moved the scripted_effect up. As a result I am not getting a tool tip. I know that the scripted_effect works because I can check it with the console charinfo command.

I then tried implementing a custom tool tip in the option as follows:

Spoiler


narrative_event = {
    id = RSLCourt.5105
    desc = RSLCourt5105
    picture = torture_chamber
    title = rsl_last_chance
    is_triggered_only = yes # Triggered by .5100
    
    immediate = {
                event_target:rsl_victim_target = {                                                       
                                        calculate_willpower = yes                        
                }
    }

    
    option = { # Convince victim to pay a ransom (using transfer_scaled_wealth)
        trigger = {
                event_target:rsl_victim_target = {
                                                OR = {
                                                     wealth = 10
                                                     liege = { wealth = 50 }
                                                     spouse = { wealth = 50 }
                                                
                                                }                                        
                }
        }
        name = EVTOPTA_Court_5105
        custom_tooltip = { text = willpower_status_tt }
        
        
        
        if = {
            limit = {
                event_target:rsl_victim_target = {
                check_variable = { which = willpower value = 25 } #If our victims have at least a will_power of 25 they refuse
                }
            }
            character_event = { id = RSLCourt.5200 }  # Refusal: Leads to the will_breaking process to start
            event_target:rsl_victim_target = {
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_player_target
                                        }
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_torturer_target
                                        }
                                }
            break = yes # Removes us from this option block
        }
        # This processes if our victim has will_power below 25
        hidden_tooltip = {
                    random_list = {
                                30 = {
                                    narrative_event = { id = RSLCourt.5200 } # Refusal: Leads to the will_breaking process to start
                                    event_target:rsl_victim_target = {
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_player_target
                                        }
                                        opinion = {
                                                modifier = rsl_opinion_asshole
                                                who = event_target:rsl_torturer_target
                                        }
                                    }
                                }    
                                70 = {
                                    narrative_event = { id = RSLCourt.5111 } # Leads to the victim submitting
                                    event_target:rsl_victim_target = {
                                        opinion = {
                                                modifier = rsl_opinion_intimidated
                                                who = event_target:rsl_player_target
                                        }
                                    }
                                }
                                
                    }
        }
        
  }

 

 

 

I used the variable willpower in the localization text:

willpower_status_tt; [event_target:rsl_victim_target.willpower.GetName] is currently [event_target:rsl_victim_target.willpower.GetValue];;;;

 

However, although the tool tip shows up correctly, it only reproduces the clear text < is currently> and not the variables

 

Any idea why?

Link to comment

When I use narrative_event, I sometimes do and sometimes don't get the decorative capital letter in the upper left hand corner of the window. According to the wiki this should be automatic. I use both the bigger event and the bigger interface mods.

What else determines the (not) appearing of the letter. Something I do wrong in the localization file?

When I don't get the letter, the space where it should be remains empty so it looks really ugly.

Link to comment
2 hours ago, joemann said:

When I use narrative_event, I sometimes do and sometimes don't get the decorative capital letter in the upper left hand corner of the window. According to the wiki this should be automatic. I use both the bigger event and the bigger interface mods.

What else determines the (not) appearing of the letter. Something I do wrong in the localization file?

When I don't get the letter, the space where it should be remains empty so it looks really ugly.

I believe the initial decorative cap comes from the "title" entry not the "desc" so make sure you have that.

Link to comment
2 hours ago, joemann said:

When I use narrative_event, I sometimes do and sometimes don't get the decorative capital letter in the upper left hand corner of the window. According to the wiki this should be automatic. I use both the bigger event and the bigger interface mods.

What else determines the (not) appearing of the letter. Something I do wrong in the localization file?

When I don't get the letter, the space where it should be remains empty so it looks really ugly.

 

43 minutes ago, NoxBestia said:

I believe the initial decorative cap comes from the "title" entry not the "desc" so make sure you have that.

The initial letter appears even if there is no title in which case it's just a capital "A".

If it does not appear at all, I would say that either the graphic files themselves are missing/overwritten, or you need to check the spriteTypes somewhere in the interface folder - perhaps they are referencing a wrong file. But that's just my guess.

Link to comment
17 hours ago, monkeycid said:

What do CK do mods exactly?

 

Never played the game and coming from a (naughty) Bethesda game background. Do these mods add animations, images, naughty bits to the story and dialog?

 

Just wanting to know before I buy the game and its DLC.

You would do well to read up on what CK2 actually is first. Then just look through some of the popular mods to see what they do. Some mods have pictures, so you can actually see the things they add.

And if you're looking for something like SexLab, then no, you won't find anything like that here. If you're fine with static images and text, then this game might be up your alley.

Link to comment

I have a weird question actually. Is it possible that sometimes the game does not run all the checks for an event and the event fires for characters it shouldn't fire for?

Something akin to your wife accusing you of having an affair when your only lover is your wife. There are conditions in place to prevent this from happening, but the event still fires because reasons.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use