• 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.

jette123

Corporal
1 Badges
Jul 10, 2019
27
0
  • Crusader Kings II
I'm trying to write an event where the ruler meets a new (spawned) female character and asks her something.
I basically set up a starting event, where one option leads to the (hidden) creation of a character, who gets (randomly) a certain character flag that decides later, when the ruler asks her to become his lover, if she accepts or not (good_reply/bad_reply).
However, after the first event nothing happens.

Code:
namespace = grape

###########################################################
#starting point
###########################################################
character_event = {
    id = grape.1
    desc = EVTDESCgrape.1
    picture = "GFX_Spot_girl_village_2"
  
    trigger = {
        NOT = { trait = kind }
        NOT = { trait = chaste }
        NOT = { trait = celibate }
        NOT = { trait = homosexual }
        min_age = 16
        only_men = yes
        has_lover = no
        prisoner = no
        in_command = no
      
    }
    mean_time_to_happen = {
        months = 3  #change to 12
        modifier = {
            factor = 0.5 # Increases chances by half
            trait = cruel
            }
        modifier = {
            factor = 0.5 # Increases chances by half
            trait = lustful
            }
        modifier = {
            factor = 0.5 # Increases chances by half
            trait = hedonsit
            }
        modifier = {
            factor = 0.25 # Increases chances by half
            trait = cruel
            trait = lustful
            }
        modifier = {
            factor = 0.15 # Increases chances by half
            trait = hedonsit
            trait = cruel
            trait = lustful
            }
    }
    option = {
        name = "EVTOPTAgrape.1"    #looking after the girl
        character_event = {
            id = grape.2
        }
        random_list = {
            50 = {
                add_trait = lustful
            }
            50 = {}
        }
    }
    option = {
        name = "EVTOPTBgrape.1"    #you are minding your own buisness
        random_list = {
            75 = {}
            10 = {
                add_trait = shy
            }
            10 = {
                add_trait = chaste
            }
            5 = {
                add_trait = humble
            }
        }
    }
}

###########################################################
#character gets created hidden
###########################################################
character_event = {
    id = grape.2
    desc = EVTDESCgrape.2
    hide_window = yes
  
    is_triggered_only = yes
  
    immediate = {
        random_list = {
            50 = {                                            # 16 yo unimportant girl, dislikes you
                create_character = {
                    dynasty = none
                    age = 16
                    random_traits = no
                    female = yes
                    attributes = {
                        martial = 1
                        learning = 5
                        stewardship = 4
                        diplomacy = 4
                        intrigue = 2
                    }
                    health = 10.0
                    trait = kind
                    trait = humble
                    trait = fair
                }
              
                new_character = {
                    set_character_flag = bad_reply
                    save_event_target_as = target_lover
                    character_event = { id = grape.3 }  
            }
            50 = {                                            # 18 yo unimportant girl, likes you
                create_character = {
                    dynasty = none
                    age = 18
                    random_traits = no
                    female = yes
                    attributes = {
                        martial = 1
                        learning = 5
                        stewardship = 4
                        diplomacy = 4
                        intrigue = 2
                    }
                    health = 10.0
                    trait = kind
                    trait = humble
                    trait = fair
                }
                new_character = {
                    set_character_flag = good_reply
                    save_event_target_as = target_lover
                    character_event = { id = grape.3 }  
            }
        }
    }
}
###########################################################
#ping event
###########################################################
character_event = {
    id = grape.3
    desc = EVTDESCgrape.3
    hide_window = yes
    hide_new = yes
  
    is_triggered_only = yes  

    immediate = {
        FROM = {
            character_event = {
                id = grape.4
            }
        }
    }
}
###########################################################
#ask girl
###########################################################
character_event = {
    id = grape.4
    desc = EVTDESCgrape.4
    picture = "Ask_girl_village"
  
    is_triggered_only = yes  
  
    portrait = event_target:target_lover
  
    option = {
        name = "EVTOPTAgrape.4"    #ask girl to become your lover
        FROM = {
            character_event = {
            id = grape.5
            }
        }
    }
}
###########################################################
#girl answers based on set character flags
###########################################################
character_event = {
    id = grape.5
    desc = EVTDESCgrape.5
    picture = "GFX_ask_girl_village"
  
    is_triggered_only = yes  
  
    option = {
        name = "EVTOPTAgrape.5"
        trigger = {
            event_target:target_lover = {
            has_character_flag = good_reply
            }
        }
        hidden_tooltip = {
            character_event = {
                id = grape.24
                days = 7
            }
        }
        opinion = {
            who = FROM
            years = 10
        }
        event_target:target_lover = { add_lover }
    }
    option = {
        name = "EVTOPTBgrape.5"
        trigger = {
            event_target:target_lover = {
                has_character_flag = bad_reply
            }
        }
        prestige = -10
        opinion = {
            modifier = opinion_dislike
            who = FROM
            years = 5
        }
        hidden_tooltip = {
            character_event = {
                id = grape.8
                days = 3
            }
        }
    }
}

What am I doing wrong?
Thanks for all help.
 
Code:
new_character = {
                    set_character_flag = bad_reply
                    save_event_target_as = target_lover
                    character_event = { id = grape.3 }
You don't close the new_character scope -> your game only has the first event in its database. You should consider using an editor that allows you to spot missing brackets easily.
Oh, and hedonsit is a typo. Also, are you sure that you want to make the MTTH decrease that much? When someone is lustful + cruel, the MTTH gets multiplied by 0.5*0.5*0.25 = 0.0625. With all three traits it will fire pretty much every day.
Furthermore, in your first event you use pretriggers in the trigger scope.
 
You don't close the new_character scope -> your game only has the first event in its database. You should consider using an editor that allows you to spot missing brackets easily.
Yes thanks. I have notepadd ++ with CK2lang. If a bracket is missing the clause will not show up in red. But I still have to check all clauses manually to see the missing red (...). Maybe there is a better way?

Also, are you sure that you want to make the MTTH decrease that much? When someone is lustful + cruel, the MTTH gets multiplied by 0.5*0.5*0.25 = 0.0625. With all three traits it will fire pretty much every day.
I know, I have to rethink about when the events should fire. For now I have to understand the interactive part of multiple events.

Furthermore, in your first event you use pretriggers in the trigger scope.
Yes I know. Is that slowing the game?

I have fixed the event chain yesterday by spawning the character in the event when I want to use a condition on the spawned character.
Like: event a (which is triggered by the starting event) spawns hidden via immediate = {create_ character and new_character} the character, I make the character an event target and then in the same event I can use the event target as special scope to use a condition on them like impregnate/kill/banish/add_lover. But in the next events I loose the event_target...

BUT. What if lets say a character gets spawned 2 or three events before. How can I tell the game that I 'want to do something' to them?
Like can I set up a special character_flag while spawning and then, events later I can use any_child or any_courtier where I define that the char has to have a special character flag and then use kill/banish/whatever on them? Im confused how to do that.
Or do I have to run hidden character events for the event_target (like event_target:target_lover = { character_event ...}) and have to use like add_lover = fromfromfrom in later events?

Im new to this but Im trying to learn. Im reading some duell and physician events right now.