• 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.
Ah, while you found an answer by yourself, to the problem of my code, and the possibilities it give (targeting any society) I meant to have another line of code in the spoiler but forgot to add it.
Code:
                society = {
                    random_society_member = {
                    }
                }

The "society = {" target your society, which would have suited your default purpose. I hadn't tried your method, it is interesting but I probably won't use it myself as I want my mod to be compatible even with overhaul that don't use any of the default societies.
 
Almost 2 years since my last post on this. I got back to work relearning modding for CK2.
I post this to help describe and review how to code a decision and message, with the ability to enter different actions. I named different parts after animals to see how each code relates to its functions in the game. I did think quick (still took hours) and is still more a a reference to myself. I hope to continue to place other bits of code and show what they do.

This will show how to create a decision, with a pop up message, and the associated tool tips.

ImagesCursors.jpg

Seems a simple message, but took some effort.
I used Notepad++ for the text files and Open Office for the csv file of the localisation.
The mod requires the decisions, events, interface, and localisation folders.
I named parts of the code to different animals to see what they reference.

Within the text file for decisions I placed the following:
Code:
############Decisions############
decisions = {

############Test Message############
   Test_Msg = {
       potential = {
           age = 16
       }
   
       allow = {
           war = no
           custom_tooltip = {
               text = TMC2_TOOLTIP_FOX
                   }       
       }
   
       effect = {
           character_event = {           
               id = testmsg.0000
               }
           custom_tooltip = {
                   text = TMC2_TOOLTIP_CAT
                   }
           wealth = 50
       }
   
       ai_will_do = {
           factor = 0.0
       }
   }
}

######################################
In the decisions folder, you can type stuff to make a decision appear in the intrigue menu of the game. In this case, Test_Msg. If you do not meet the requirements, the option will not show and you won't see it, no option for activation.
-The potential portion codes what is required for it to appear in the intrigue menu for you the player. In this case, you just have to be at least 16 years old. But this can be edited for all sort of requirements.
-The allow portion codes what is required to actually click and activate the option. Again, this can be edited for all sorts of requirements, for example must have 100 gold. If you don't have the requirements, the option will show, but will be greyed out, not available for activation.
-The effect portion codes what will happen if you activate the option in the intrigue menu when you have the requirements. In this case it activates id testmsg.0000 and makes that code happen. It also gives 50 gold through wealth. The custom_tooltip references what the tooltip will say if you hover your cursor over the option.
-The ai_will_do portion of the code determines if the ai will ever do the action. I put 0.0 so that is will never do the option.

Within the text file for events I placed the following:
Code:
namespace = TMC2
#Test Messsage
character_event = {
   id = testmsg.0000
   title = TMC2NAME0000
   desc = TMC2DESC0000
   picture = GFX_evt_battle

   mean_time_to_happen = {
       days = 1
   }
 
   option = {
       name = TMC2OPTA0
       prestige = 100
       custom_tooltip = {
               text = TMC2_TOOLTIP_FROG
               }
   }
}

Within the text file for interface I placed the following:
Code:
spriteTypes = {
   spriteType = {
       name = "GFX_Test_Msg"
       texturefile = "gfx\\interface\\decision_icon_aquire_ingredients.dds"
   }
}
Interface deals with images and what you can see in game (in short). GFX_Test_Msg references Test_Msg that is coded in the decisions file. By placing the GFX designation and referencing the .dds image, this makes the little image appear beside the decision Test Message Turtle, the plant image.

Within the csv file for localisation I placed the following:
Code:
TMC2NAME0000;Test Message Tiger;x
TMC2OPTA0;Test Message Lion;x
TMC2DESC0000;Test Message Zebra;x
Test_Msg;Test Message Turtle;x
Test_Msg_desc;Test Message Monkey;x
TMC2_TOOLTIP_FOX;Test Message Fox!;x
TMC2_TOOLTIP_CAT;Test Message Cat;x
TMC2_TOOLTIP_FROG; Test Message Frog;x

Maybe I'll type more explaination later.
 
Last edited:
Take gold from a target and gain gold. Gives the impression of: Steal Gold from a Character and give the Gold to you!

To better learn modding, specifically with an introduction to the FROM and ROOT scopes, this code is for a decision that allows you to right click on a character portrait for a decision to steal gold. If you select the option, then select to do it, it will remove 10 gold from the character you target and it will give you 10 gold.

This should only need a decisions.txt modification, yet a localization modification will help provide better descriptions.

For targetted_decisions FROM is you the player. Root is the person you are targeting.

Steal_Gold.png

Code:
############Targeting############
#TMC Coded 6/14/2019
targetted_decisions = {
       Steal_Gold = {
                   ai = no   #I don't know, maybe it makes the ai never do it. I never want the ai to do this.
   
               from_potential = {
                   #Conditions on the decision taker for the decision to appear
                       age = 16   #You as the player character must be 16 years old. Any younger, you are too innocent haha.
               }
               
               potential = {
                   #Conditions on the vassal or dynasty member for the decision to appear
                   trait = cruel   #This lets you steal from only people that are cruel.
                   #No custom tooltip for this item as it wouldn't show anyway.
               }
     
     allow = {
       #Conditions for the decision to be enabled
       #wealth = -10
       custom_tooltip = {
                   text = TMC3_TOOLTIP_PIG
               }
     }
     
     
     effect = {
     
           FROM = {   #FROM is you the player. ROOT is the target, in this example the cruel character you click on.
           #Commands executed when taking the decision.
           wealth = 10       #This adds 10 gold to you.
           custom_tooltip = {       #This bracket section adds the tool tip, I left it here.
               text = TMC3_TOOLTIP_CROW   #this is what you would replace in the localization file to say what you want.
               }   #Ends the custom tooltip section.
           #character_event = {       #This would trigger an event, but I don't care about an event. I neutralized it with # at the start.       
           #       id = TMC2.0008
           #   }   #This bracket ends the character event brackets.
           }   #This is the end of this FROM bracketed section.
           
           wealth = -5       #In effect, this auto targets who you are clicking on, the ROOT, and removes 5 gold from him/her.
                           #Note that in the game, it just states take 5 gold away.
                           
           ROOT = {   #I left this in here to show you can specify ROOT, but it isn't necessary as shown above.
           wealth = -5   #This removes another 5 gold from him/her.
           }   #Note that this references the name of the person who will lose 5 gold as well as him losing 5 gold.
           
     }   #This ends the effect, the actions that happen on clicking the option.
     
     ai_will_do = {
       #Factors for an AI character to take the decision (1 = 100% chance)
       0.0   #I used 0.0 to hope that the ai will never do this option.
     }
   }
}
#########################################################################

I see that can be hard to read with all the comments trying to explain what each line does. Here is is again without all the comments.
Code:
############Targeting############
#TMC Coded 6/14/2019
targetted_decisions = {
       Steal_Gold = {
                   ai = no   
   
               from_potential = {
                   #Conditions on the decision taker for the decision to appear
                       age = 16   
               }
               
               potential = {
                   #Conditions on the vassal or dynasty member for the decision to appear
                   trait = cruel   
                   #No custom tooltip for this item as it wouldn't show anyway.
               }
     
     allow = {
       
       
       custom_tooltip = {
                   text = TMC3_TOOLTIP_PIG
               }
     }
     
     
     effect = {
     
           FROM = {   
           
           wealth = 10       
           custom_tooltip = {       
               text = TMC3_TOOLTIP_CROW   
               }   
           #character_event = {       
           #       id = TMC2.0008
           #   }   
           }   
           
           wealth = -5       
                           
                           
           ROOT = {   
           wealth = -5   
           }   
           
     }   
     
     ai_will_do = {
       0.0
     }
   }
}
#########################################################################

From what I know at this time, scopes can get complicated. Yet if mastered, scopes can do some neat stuff.
Events can stem from such decisions, but this code doesn't use them.

This is just a short bit of code that might help other people. It helped me to better understand the process.
Thanks for looking, comment if you want, have a nice day!