Monday, August 21, 2017

Crusader Kings 2 - Society Modification - Targeting

Crusader Kings 2 - Society Modification - Trying to Steal Artifacts
In this post I have unfinished code of pictures for targeting.

  







 
 Another Updated Picture
 

Friday, August 18, 2017

Crusader Kings 2 - Society Modification - Decision & Background Imaging

This is another game coding installment for Crusader Kings 2
These are more place holders rather than pure botanical knowledge, but it does show how an interest can spawn into learning through other areas.

1. Create a society background.
2. Image for the decision icon.
Through interest, the leader in custom societies posted a "tutorial" template. This was of great help
Following the artifact example messed me up. The artifact requires a link for the images to work. The code for background and decision seem kind of built in.

#1. I created the background by just editing Maal's tutorial society and saving that file. So I think it is the correct size. society_bg_lion.dds



I placed it into the ...\Documents\Paradox Interactive\Crusader Kings II\mod\lion\gfx\interface\societies folder, the image holding folder.
In the ...\Documents\Paradox Interactive\Crusader Kings II\mod\lion\interface I added to my lion.gfx file the following code, this file is the sprite file.

############Society############

sprite Type = { #the background of the society menu
name = "GFX_society_main_background_lion"
texturefile = "gfx\\interface\\societies\\society_bg_lion.dds"
}
Now I am stuck and don't know what to do. I don't know where to use the name = "GFX_society_main_background_lion" statement or where I can recall it to work in game. So I thought. This is the link. In the sprite file, the "texturefile" points out the location. The name points out the link "lion" as the tag identifier. "main_background" is already understood as the need for the background of the society. "society" identifies this is for the society. "GFX" identifies this is for an image. All together, the name says this image, for a society, for a society background, is for the society known as lion within the code.



#2. Again for the decision icon, it is performed similarly.
I used an already made game image for the hermetic society.
Within the lion.gfx file I placed the following code:

############Decisions############       
        spriteType = {
        name = "GFX_lio_collect_a_plant"
        texturefile = "gfx\\interface\\decision_icon_aquire_ingredients.dds"
    }

The "link" for this code is already in the decision code, for my file, located at lion_decisions.txt:

#Collect a plant
    lio_collect_a_plant = {
        only_playable = yes
        potential = {
            society_member_of = lion
            #society_rank >= 1 #  Not needed because obviously you will be =>rank 1 when you join.
            is_playable = yes
            OR = {
                is_feudal = yes
                is_tribal = yes
                is_nomadic = yes
            }
            prisoner = no
   
        }
        allow = {
            war = no
            prisoner = no
            NOT = { is_inaccessible_trigger = yes }
            custom_tooltip = {
                text = is_not_busy_trigger_tooltip
                hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
            }
        }
        effect = {
            character_event = { id = LIO.200 }
        }
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 1
           
        }
    }

I made the link red between the two files.



The cursor doesn't show up, but I have it pointed at the "Collect a rare plant" so the tip pop-up says "Gather plant". The little rectangle icon to the left is what we accomplished. 6 hours for all that because I followed the artifact example. I was including and making up all sorts of code. Another Thank You to Maal for his help! Maal responded faster than many cable companies or government agencies I contact, and yeah I just posted not message him directly. The guy is on fire.

Today we accomplished putting an image in the decision of the intrigue tab for our event. We also added a society background. Through this we learned some images are linked sort of simpler than that of artifact files. I learned a lot about coding in the game, and a lot more about myself.

The society images for the background were taken from the Munich Golden Psalter available at https://www.wdl.org/en/item/8939/ from the World Digital Library. I guess, this psalter, is an "illuminated" work meaning it has images aka drawings or pictures. In this case gold leaf in some cases. Selected scenes from the Bible were used. The work has been dated between 1200 and 1225, well within CK2 time frame. Yes not the oldest, but I think acceptable.

Thank you for your interest and reading. Have a Great day!