Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

I have made all the changes but it still does not work.

I did not understand  what you did in your last quote where do the 19, 33 etc come from?

Looking at the code how does the machine know that it has to pick  frame 1 in the 27 frame template?

Is it enough to have the picture in the frame or must it also be stored  as a separate file?

 

 

Thanks for your step by step guide, this will save me hours of frustration!

Link to comment
19 minutes ago, joemann said:

I have made all the changes but it still does not work.

I did not understand  what you did in your last quote where do the 19, 33 etc come from?

 

The numbers are the portrait layers from /interface/portrait_properties/00_portrait_properties.txt file. This file determines what your character will look like at any given time. Layer 5 is the headgear layer (the layer remedy uses for the custom portraits), which is sometimes disabled by the other layers. That's why you need to set specific layers to off, so only your custom portrait will show.

19 minutes ago, joemann said:

Looking at the code how does the machine know that it has to pick  frame 1 in the 27 frame template?

Is it enough to have the picture in the frame or must it also be stored  as a separate file?

The number of frames is assigned in three ways: First is the spritetypes location of your .gfx file.

 

Quote

spriteType = {
    name = "GFX_portrait_blahblah" # Remember this name
    texturefile = "gfx/static_portraits/blahblahportraits.dds"
    noOfFrames = 27 # Total Number of 152x152 frames in the portrait file
    norefcount = yes
    can_be_lowres = yes
}

Second is the file itself. Each file is divided into 152x152 squares. These are the frames. The first 152x152 is frame 0, the second 152x152 is frame 1, and so on. If you incorrectly assign the number of frames in the spritetype, you're going to get some pretty messed up portraits.

 

Third is the layers in the .gfx file itself.

 

Quote

            5 = {
                0 = { always = no }
                1 = { portrait_has_trait = dwtw_others1 }
                2 = { portrait_has_trait = dwtw_others2 }
                3 = { portrait_has_trait = dwtw_others3 }
                4 = { portrait_has_trait = houseirae_others4 }
                5 = { portrait_has_trait = houseirae_others5 }
                6 = { always = no }
                7 = { always = no }
                8 = { always = no }
                9 = { always = no }
                10 = { always = no }
                11 = { always = no }
                12 = { always = no }
                13 = { always = no }
                14 = { always = no }
                15 = { always = no }
                16 = { always = no }
                17 = { always = no }
                18 = { always = no }
                19 = { always = no }
                20 = { always = no }
                21 = { always = no }
                22 = { always = no }
                23 = { always = no }
                24 = { always = no }
                25 = { always = no }
                26 = { always = no }
            }

 

This uses a standard remedy portrait with only five custom portraits. It goes from 0-26 (27 frames).

0 = { is the first 152x152 block of the portrait pictures. In a standard remedy portrait file, this block is blank. Why? I have no clue. It's inefficient.

1 = { is the second 152x152 block. This is where the standard remedy portraits start.

Link to comment

This is the portrait file:

 

image.thumb.png.8a9a59d4ef789b0914afbf6348c5bda7.png

 

As you can see, the first 152x152 is blank, so we ignore the 0 = { } frame. 3 = { } is assigned to dwtw_others3 (Red Sonja's portrait).

 

Here is the full code for them:

 

Spoiler

spriteTypes = {

# Misc characters
    spriteType = {
        name = "GFX_portrait_dwtw_others"
        texturefile = "gfx/static_portraits/dwtw_others.dds"
        noOfFrames = 27
        norefcount = yes
        can_be_lowres = yes
    }

    portraitType = {
        name = "PORTRAIT_dwtw_others_static"
        effectFile = "gfx/FX/portrait.lua"
        weight = {
            additive_modifier = {
                value = 100000
                portrait_clothing = yes
                    OR = {
                        portrait_has_trait = dwtw_others1 # Fleur-de-Lis
                        portrait_has_trait = dwtw_others2 # Lockesly L'Crit
                        portrait_has_trait = dwtw_others3 # Red Sonja
                        portrait_has_trait = houseirae_others4 # Broken Waterlily
                        portrait_has_trait = houseirae_others5 # Thicc Waterlily
                    }
             }
        }

        layer = {
            "GFX_empty:p0"
            "GFX_empty:c0"
            "GFX_empty:c2"
            "GFX_empty:c3"
            "GFX_empty:c1"
            "GFX_empty:c4"
            "GFX_empty:p1:h:y"
            "GFX_empty:p6"
            "GFX_portrait_dwtw_others:c5"
        }

        allow_property_values = {
            1 = {
                0  = { always = yes }
            }
            19 = {
                0  = { always = yes }
            }
            33 = {
                0  = { always = yes }
            }
            34 = {
                0  = { always = yes }
            }
            35 = {
                0  = { always = yes }
            }
            36 = {
                0  = { always = yes }
            }
            6 = {
                0  = { always = yes }
            }
            5 = {
                0 = { always = no }
                1 = { portrait_has_trait = dwtw_others1 }
                2 = { portrait_has_trait = dwtw_others2 }
                3 = { portrait_has_trait = dwtw_others3 }
                4 = { portrait_has_trait = houseirae_others4 }
                5 = { portrait_has_trait = houseirae_others5 }
                6 = { always = no }
                7 = { always = no }
                8 = { always = no }
                9 = { always = no }
                10 = { always = no }
                11 = { always = no }
                12 = { always = no }
                13 = { always = no }
                14 = { always = no }
                15 = { always = no }
                16 = { always = no }
                17 = { always = no }
                18 = { always = no }
                19 = { always = no }
                20 = { always = no }
                21 = { always = no }
                22 = { always = no }
                23 = { always = no }
                24 = { always = no }
                25 = { always = no }
                26 = { always = no }
            }
        }
    }

}

 

The portrait train must be assigned to both the layer frames (bottom section), and the weight = { (upper section) for the portrait to show up. As long as everything is set correctly, Red Sonja will have her portrait if she has the dwtw_others3 trait.

Link to comment

I think I am starting to see the logic. But it still doesn't work ?

 

I have renamed the gfx template: various_beast

the picture in frame 1 of the template remains: fighting_dog

 

The code is then:

 

Spoiler

spriteType = {
        name = "GFX_portrait_various_beast"
        texturefile = "gfx/static_portraits/various_beast.dds"
        noOfFrames = 27
        norefcount = yes
        can_be_lowres = yes
    }

 

the portrait file then is:

 

Spoiler

portraitType = {
        name = "PORTRAIT_various_beast_static"
        effectFile = "gfx/FX/portrait.lua"
        weight = {
            additive_modifier = {
                value = 1000000
                portrait_clothing = yes
                OR = {
                    portrait_has_trait = fighting_dog
                }
             }
        }

        layer = {
            "GFX_empty:c0"
            "GFX_empty:c2"
            "GFX_empty:c3"
            "GFX_empty:c1"
            "GFX_empty:c4"
            "GFX_empty:p1:h:y"
            "GFX_portrait_various_beast:c5"
        }

        allow_property_values = {
            1 = {
                0 = { always = yes }
            }
            5 = {
                0 = { always = no }
                1 = { portrait_has_trait = fighting_dog }
                2 = { portrait_has_trait = 0 }
                3 = { portrait_has_trait = 0 }
                4 = { portrait_has_trait = 0 }
                5 = { portrait_has_trait = 0 }
                6 = { portrait_has_trait = 0 }
                7 = { portrait_has_trait = 0 }
                8 = { portrait_has_trait = 0 }
                9 = { portrait_has_trait = 0 }
                10 = { portrait_has_trait = 0 }
                11 = { portrait_has_trait = 0 }
                12 = { portrait_has_trait = 0 }
                13 = { portrait_has_trait = 0 }
                14 = { portrait_has_trait = 0 }
                15 = { portrait_has_trait = 0 }
                16 = { portrait_has_trait = 0 }
                17 = { portrait_has_trait = 0 }
                18 = { portrait_has_trait = 0 }
                19 = { portrait_has_trait = 0 }
                20 = { portrait_has_trait = 0 }
                21 = { portrait_has_trait = 0 }
                22 = { portrait_has_trait = 0 }
                23 = { portrait_has_trait = 0 }
                24 = { portrait_has_trait = 0 }
                25 = { portrait_has_trait = 0 }
                26 = { portrait_has_trait = 0 }
            }
             19 = {
                0  = { always = yes }
            }
            33 = {
                0  = { always = yes }
            }
            34 = {
                0  = { always = yes }
            }
            35 = {
                0  = { always = yes }
            }
            36 = {
                0  = { always = yes }
            }
            6 = {
                0  = { always = yes }
            }
        }
    }
   

remedy_portrait_trait remains

 

Spoiler

fighting_dog = {       # not various_beast ?
    hidden = no
    random = no
    customizer = no
    opposites = {
        portrait2
        portrait3
        portrait4

 

the event still calls the trait fighting_dog

Spoiler

immediate = {
        host = {
             create_character = {
                name = "Wodan"
                has_nickname "nick_Whitefang"
                age = 17
                culture = dog_culture
                race = dog
                religion = pagan
                attributes = {
                            martial = 8
                            diplomacy = 2
                            stewardship = 3
                            intrigue = 5
                            learning = 4
                }
                trait = regular_balls_dog
                trait = regular_knot_dog
                trait = huge_dick_dog
                trait = regular_anus_dog
                trait = muscular_dog
                trait = shrewd
                trait = tough_soldier
                trait = gregarious
                trait = brave
                trait = cruel
                trait = wroth
                trait = stubborn
                trait = fighting_dog
                female = no
                random_traits = no
                historical = no
                fertility = 2
                health = 1
               

 

Using the same name for both the whole template and the separate pic was confusing, maybe this will help finding the error.

Link to comment
2 minutes ago, joemann said:

I think I am starting to see the logic. But it still doesn't work ?

 

I have renamed the gfx template: various_beast

the picture in frame 1 of the template remains: fighting_dog

 

The code is then:

 

  Hide contents

spriteType = {
        name = "GFX_portrait_various_beast"
        texturefile = "gfx/static_portraits/various_beast.dds"
        noOfFrames = 27
        norefcount = yes
        can_be_lowres = yes
    }

 

the portrait file then is:

 

  Hide contents

portraitType = {
        name = "PORTRAIT_various_beast_static"
        effectFile = "gfx/FX/portrait.lua"
        weight = {
            additive_modifier = {
                value = 1000000
                portrait_clothing = yes
                OR = {
                    portrait_has_trait = fighting_dog
                }
             }
        }

        layer = {
            "GFX_empty:c0"
            "GFX_empty:c2"
            "GFX_empty:c3"
            "GFX_empty:c1"
            "GFX_empty:c4"
            "GFX_empty:p1:h:y"
            "GFX_portrait_various_beast:c5"
        }

        allow_property_values = {
            1 = {
                0 = { always = yes }
            }
            5 = {
                0 = { always = no }
                1 = { portrait_has_trait = fighting_dog }
                2 = { portrait_has_trait = 0 }
                3 = { portrait_has_trait = 0 }
                4 = { portrait_has_trait = 0 }
                5 = { portrait_has_trait = 0 }
                6 = { portrait_has_trait = 0 }
                7 = { portrait_has_trait = 0 }
                8 = { portrait_has_trait = 0 }
                9 = { portrait_has_trait = 0 }
                10 = { portrait_has_trait = 0 }
                11 = { portrait_has_trait = 0 }
                12 = { portrait_has_trait = 0 }
                13 = { portrait_has_trait = 0 }
                14 = { portrait_has_trait = 0 }
                15 = { portrait_has_trait = 0 }
                16 = { portrait_has_trait = 0 }
                17 = { portrait_has_trait = 0 }
                18 = { portrait_has_trait = 0 }
                19 = { portrait_has_trait = 0 }
                20 = { portrait_has_trait = 0 }
                21 = { portrait_has_trait = 0 }
                22 = { portrait_has_trait = 0 }
                23 = { portrait_has_trait = 0 }
                24 = { portrait_has_trait = 0 }
                25 = { portrait_has_trait = 0 }
                26 = { portrait_has_trait = 0 }
            }
             19 = {
                0  = { always = yes }
            }
            33 = {
                0  = { always = yes }
            }
            34 = {
                0  = { always = yes }
            }
            35 = {
                0  = { always = yes }
            }
            36 = {
                0  = { always = yes }
            }
            6 = {
                0  = { always = yes }
            }
        }
    }
   

remedy_portrait_trait remains

 

  Hide contents

fighting_dog = {       # not various_beast ?
    hidden = no
    random = no
    customizer = no
    opposites = {
        portrait2
        portrait3
        portrait4

 

the event still calls the trait fighting_dog

  Hide contents

immediate = {
        host = {
             create_character = {
                name = "Wodan"
                has_nickname "nick_Whitefang"
                age = 17
                culture = dog_culture
                race = dog
                religion = pagan
                attributes = {
                            martial = 8
                            diplomacy = 2
                            stewardship = 3
                            intrigue = 5
                            learning = 4
                }
                trait = regular_balls_dog
                trait = regular_knot_dog
                trait = huge_dick_dog
                trait = regular_anus_dog
                trait = muscular_dog
                trait = shrewd
                trait = tough_soldier
                trait = gregarious
                trait = brave
                trait = cruel
                trait = wroth
                trait = stubborn
                trait = fighting_dog
                female = no
                random_traits = no
                historical = no
                fertility = 2
                health = 1
               

 

Using the same name for both the whole template and the separate pic was confusing, maybe this will help finding the error.

I'm gonna need to see your actual portrait file, the graphics file you made in GIMP or paint.net

Link to comment
21 minutes ago, joemann said:

The template file various_beast.

 

and the individual file fighting_dog

 

various_beast.dds

fighting_dog.dds

Use this file if you want to use just the single portrait: fighting_dog_single_portrait.zip

 

Use this file if you want to eventually expand your portrait file: fighting_dog_multiple_portraits.zip

 

You can check the gfx files and see where you went wrong by comparing them to your previous work. Just start up a new game and type add_trait fighting_dog in the console. Like most everything that involves portraits, a new game is required.

Link to comment
6 minutes ago, AlexWyrmin said:

I'm trying to recreate the semi-legendary war between Sigurd of Svitjod and Harald of Sjaelland and I've got just one question: do the files in the wars folder ensure a conflict starts automatically regardless of any other factor?

If you mean the /histories/wars/ folder, then yes.

 

name = "The Sons of Lodbrok Invasion of Northumberland"

casus_belli = {
	actor = 163112 # Halfdan Ragnarsson
	recipient = 163103 # Aella of Northumberland
	casus_belli=viking_invasion
	landed_title=k_england
	date=865.1.1
}

865.1.1 = {
	add_attacker = 163112 # Halfdan Ragnarsson
	add_attacker = 163108 # Björn Ironside
	add_defender = 163103
	add_defender = 163102 # Burghred of Mercia
	add_defender = 33358 # Aethelred of Wessex
}

867.3.21 = {
	rem_attacker = 163108
	rem_attacker = 163112
	rem_defender = 33358 # Aethelred of Wessex
	rem_defender = 163102 # Burghred of Mercia
	rem_defender = 163103
}

 

Link to comment
49 minutes ago, AlexWyrmin said:

Thank you. Now I just need to have the petty kingship of Sjaelland pass to Sigurd as soon as Harald dies in battle.

character_event = {
	id = whatever.1
	hide_window = yes
	is_triggered_only = yes # Triggered from on_death
	trigger = {
		has_character_flag = king_harald_sjaelland
		war_with = {
			any_independent_ruler = {
				has_character_flag = sigurd_svitjod
			}
		}
	}
	immediate = {
		any_independent_ruler = {
			limit = {
				has_character_flag = sigurd_svitjod
			}
			d_sjaelland = {
				usurp_title = PREV
			}
		}
	}
}

Edit as you see fit

Link to comment
15 minutes ago, AlexWyrmin said:

Wow, I wasn't expecting an answer to that one. Thank you again.

 

Since we are on topic, would modding the characters' personal history achieve the same result?

Yes, if the start date happens after that time. Histories are basically pre-programmed events that happened in game before you start it.

Link to comment
11 minutes ago, lockeslylcrit said:

Yes, if the start date happens after that time. Histories are basically pre-programmed events that happened in game before you start it.

So I got it partially right, meaning I thought that, unless other factors made them impossible to come to pass, the events in a character's personal history happened on schedule automatically even after taking control of them.

 

Link to comment
5 minutes ago, AlexWyrmin said:

So I got it partially right, meaning I thought that, unless other factors made them impossible to come to pass, the events in a character's personal history happened on schedule automatically even after taking control of them.

 

Nope. Histories are simply records of what happened before the game starts. After the game starts, all histories set in the future are ignored.

Link to comment
194060 = {
	name = "Sverker"
	dynasty = 1045023
	religion = norse_pagan
	culture = norse
	733.1.1 = {
		birth = yes
	}
	768.12.21 = {
		death = {
			death_reason = sacrificed
			killer = 194004
		}
	}
}
194061 = {
	name = "Tryggve"
	dynasty = 1045020
	religion = norse_pagan
	culture = norse
	733.1.1 = {
		birth = yes
	}
	768.12.21 = {
		death = {
			death_reason = sacrificed
			killer = 194004
		}
	}
}

With these two characters' personal history modded this way, can I expect their gold to get into my coffers by the earliest starting date?

 

P.S. they're wifeless and heirless without Generate Families on.

Link to comment
2 minutes ago, AlexWyrmin said:

You mean to say that unless they live to see the start of the game there's no profit in killing them?

Correct. Characters in histories are considered non-existent if they die before gameplay starts. The only exception is in looking them up in the in-game dynasty viewer. Even those with titles and heirs don't matter to the game unless you manually assign the title to someone else.

 

Character histories are literally just a way to record pre-existing characters. Nothing more, nothing less.

Link to comment
5 minutes ago, lockeslylcrit said:

Correct. Characters in histories are considered non-existent if they die before gameplay starts. The only exception is in looking them up in the in-game dynasty viewer. Even those with titles and heirs don't matter to the game unless you manually assign the title to someone else.

 

Character histories are literally just a way to record pre-existing characters. Nothing more, nothing less.

Ok, then. Guess I'll just fatten up Sigurd's bank account for troop maintenance like Paradox did for William the Conqueror.

Link to comment
30 minutes ago, lockeslylcrit said:

Alternatively: event spawned troops with 0 maintenance and disbands on peace.

Would it be possible to event spawn a tribal army? If not, I'm going to have look up the average composition of the norse tribal unit, since those spawned for William neither norse nor tribal.

Link to comment
27 minutes ago, AlexWyrmin said:

Would it be possible to event spawn a tribal army? If not, I'm going to have look up the average composition of the norse tribal unit, since those spawned for William neither norse nor tribal.

There are no "tribal armies". Only armies with different unit compositions, numbers, and modifiers.

If you mean units that are the same as the decision tribals get, then just look in the /decisions/unit_decisions.txt file and search for raise_tribal_units decision. You can copy and paste the effect into an event.

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