In this tutorial, I will try to accomplish writing my own decision, as a way to learn how to do this for my Großdeutschland Mod.

(bear with me, I don't know yet in all its details)
I will use as an example one of the first decisions you encounter (as Japan), the summoned Daimyo Consultation after the Black Ships of Commodore Perry arrive in the Bay of Tokyo in 1853. In this event the player decides if he wants to take action against the Americans or yield.
Code: Select all
SelectFaction = $JAP
SelectRegion = $Kyoto
StartEvent = evt_nam_JAP_DaimyoConsultation1853_ON|1|1|NULL|NULL|$Kyoto|NULL
Conditions
EvalEvent = evt_nam_JAP_BlackShipsEdo1853;=;1
MinDate = 1852/03/01
MaxDate = 1865/04/18
Probability = 75
Actions
DescEvent = evt_desc_CMN_NewDipOption
ChangeActorPool = $gmaOptionGov;MaxUse;1;MaxChoices;2;ImageID;Contract_ON.png;Title;opt_title_JAP_DaimyoConsultation1853;MsgString;opt_desc_JAP_DaimyoConsultation1853;ToolString;opt_hint_JAP_DaimyoConsultation1853;SubType;JAP_DaimyoConsultation1853;SParam1;JAP;TextChoice1;opt_JAP_DaimyoConsultation1853_desc_Choice1;ToolChoice1;opt_JAP_DaimyoConsultation1853_hint_Choice1;TextChoice2;opt_JAP_DaimyoConsultation1853_desc_Choice2;ToolChoice2;opt_JAP_DaimyoConsultation1853_hint_Choice2;SParam2;Event-img_JAP_DaimyoConsultation1853.png
EndEvent
SelectFaction = $JAP
SelectRegion = $Kyoto
StartEvent = evt_nam_JAP_DaimyoConsultation1853_AIAcitvate|999|0|NULL|NULL|$Kyoto|NULL
Conditions
ActorEnabled = $gmaOptionGov;JAP_DaimyoConsultation1853
CheckAILevel = 1
Actions
DescEvent = evt_desc_CMN_NewDipOption
ChangeOption = $gmaOptionGov;JAP_DaimyoConsultation1853;1
EndEvent
SelectFaction = $JAP
StartEvent = evt_nam_JAP_DaimyoConsultation1853_Deprecate|1|1|NULL|NULL|NULL|NULL
Conditions
MinDate = 1865/04/18
ActorEnabled = $gmaOptionGov;JAP_DaimyoConsultation1853
Actions
DescEvent = evt_desc_CMN_DipOptionCancelled
ChangeActorPool = $gmaOptionGov;MaxUse;0;SubType;JAP_DaimyoConsultation1853
ChgVPCount = -100
ChangeFacMorale = -5
ChangeLoyaltyFac = $Theater_Japan;-25
SelectFaction = $REB
ChangeLoyaltyFac = $Theater_Japan;25
EndEvent
SelectFaction = $JAP
SelectFaction = $JAP
StartEvent = evt_nam_JAP_DaimyoConsultation1853_Choice1|1|0|NULL|NULL|NULL|NULL
Conditions
MinDate = 1852/03/01
MaxDate = 1865/04/18
ActorEnabled = $gmaOptionGov;JAP_DaimyoConsultation1853
CheckOption = $gmaOptionGov;JAP_DaimyoConsultation1853;=;1
Actions
GenTextMsg = opt_notify_JAP_DaimyoConsultation1853_Choice1;1;NULL;NULL;NULL
ChangeActorPool = $gmaOptionGov;MaxUse;0;SubType;JAP_DaimyoConsultation1853
EndEvent
SelectFaction = $JAP
StartEvent = evt_nam_JAP_DaimyoConsultation1853_Choice2|1|0|NULL|NULL|NULL|NULL
Conditions
MinDate = 1852/03/01
MaxDate = 1865/04/18
ActorEnabled = $gmaOptionGov;JAP_DaimyoConsultation1853
CheckOption = $gmaOptionGov;JAP_DaimyoConsultation1853;=;2
Actions
ChgFacRelationships = USA;-10
ChgFacRelationships = GBR;-10
ChgFacRelationships = FRA;-10
ChgFacRelationships = RUS;-10
ChgFacRelationships = HOL;-10
ChgVPCount = 100
SelectFaction = $FRA
GenTextMsg = opt_notify_JAP_DaimyoConsultation1853_Choice2;1;NULL;NULL;NULL
ChangeActorPool = $gmaOptionGov;MaxUse;0;SubType;JAP_DaimyoConsultation1853
EndEvent
SelectFaction = $JAP
SelectRegion = $Edo
SelectFaction = $JAP
SelectRegion = $Edo
StartEvent = evt_nam_JAP_DaimyoConsultation1853_A|1|2|evt_txt_JAP_DaimyoConsultation1853|Event-img_JAP_DaimyoConsultation1853|$Edo|NULL
Conditions
MinDate = 1852/03/01
MaxDate = 1863/08/01
EvalEvent = evt_nam_JAP_DaimyoConsultation1853_Choice1;=;1
Actions
DescEvent = evt_desc_JAP_DaimyoConsultation1853
ChangeFacMorale = -2
CreateStruc
SetType = $Fort
SetLevel = 1
SetName = Edo Fortifications
Apply
SelectFaction = $JAP
SelectRegion = $Edo
CreateGroup
Posture = $Defensive
SetKind = $Land
Entranch = 4
InCS = 1
FixType = 999
SetName = Edo Batteries
Apply
CreateUnit
SetType = $uni_JAP_Art_1840CA
NumCreate = 1
SUFlavorName = Edo Battery
SetLevel = 4
SetName = Edo Defenses
Apply
CreateUnit
SetType = $uni_JAP_Inf1840_Feudal
NumCreate = 1
SUFlavorName = Batteries Garrison
SetLevel = 4
SetName = Batteries Garrison
Apply
ChgFacRelationships = USA;10
ChgFacRelationships = GBR;10
ChgFacRelationships = FRA;10
ChgFacRelationships = RUS;10
ChgFacRelationships = HOL;10
SetEvtOccurs = evt_nam_JAP_DaimyoConsultation1853_B;MaxOccurs;0
EndEvent
SelectFaction = $JAP
SelectRegion = $Edo
StartEvent = evt_nam_JAP_DaimyoConsultation1853_B|1|2|evt_txt_JAP_DaimyoConsultation1853|Event-img_JAP_DaimyoConsultation1853|$Edo|NULL
Conditions
MinDate = 1852/03/01
MaxDate = 1863/08/01
EvalEvent = evt_nam_JAP_DaimyoConsultation1853_Choice2;=;1
Actions
DescEvent = evt_desc_JAP_DaimyoConsultation1853
ChangeFacMorale = 5
CreateStruc
SetType = $Fort
SetLevel = 1
SetName = Edo Fortifications
Apply
SelectFaction = $JAP
SelectRegion = $Edo
CreateGroup
Posture = $Defensive
SetKind = $Land
Entranch = 4
InCS = 1
FixType = 999
SetName = Edo Batteries
Apply
CreateUnit
SetType = $uni_JAP_Art_1840CA
NumCreate = 1
SUFlavorName = Edo Battery
SetLevel = 4
SetName = Edo Defenses
Apply
CreateUnit
SetType = $uni_JAP_Inf1840_Feudal
NumCreate = 1
SUFlavorName = Batteries Garrison
SetLevel = 4
SetName = Batteries Garrison
Apply
ChangeLoyaltyFac = $Theater_Japan;25
SelectFaction = $REB
ChangeLoyaltyFac = $Theater_Japan;-25
SelectFaction = $JAP
ChgFacRelationships = USA;-10
ChgFacRelationships = GBR;-10
ChgFacRelationships = FRA;-10
ChgFacRelationships = RUS;-10
ChgFacRelationships = HOL;-10
SetEvtOccurs = evt_nam_JAP_DaimyoConsultation1853_A;MaxOccurs;0
EndEvent