Silent events

From EU3 Wiki

Jump to: navigation, search

Here is a method in which you can make events fire for a computer controlled country but still change things for the player so that the player does not get a event window.

Finding the player's country

Here is a event that will set set a player_controlled flag for the player's country so that you can use this flag later to control what events the player revieces or does not receive. This event will ensure that the game is able to keep the event silent for the player. You can also use this event for many other purposes.

Here is the example from the MM mod (with permission):

country_event = {
    id = 9500
    trigger = {
    NOT = { 
        has_country_flag = ai_controlled 
        has_country_flag = player_controlled 
        }
    }
    mean_time_to_happen = {
        months = 1
    }
    title = "EVTNAME9500"
    desc = "EVTDESC9500"
    option = {		
        name = "Player Controlled Nation"
        ai_chance = { factor = 0 }
        set_country_flag = player_controlled
    }
    option = {		
        name = "Computer Controlled"
        ai_chance = { factor = 100 }
        set_country_flag = ai_controlled
    }
}

The silent event

The scope must remain on the AI nation (you can do this by using has_country_flag = ai_controlled in the event trigger) that will get the event. To solve this you will have to use triggers like this: TAG = {} (with your code inbetween the {} and change TAG to the country tag you need) if a certain country needs to have certain conditions to be true in the trigger section. This will make it so a random AI will get this event. You may also need to set a flag on a country with TAG = {} in the event effect section so that the event does not fire again (this will also require a NOT = { has_country_flag = flag }. change flag to the correct flag name that you just set in the effects. when making effects in the options, be sure to use TAG = {} so that the effects go to the player and not the AI country getting the event.

Here is an example from the MM mod (with permission):

country_event = {
  id = 9501
  trigger = {
    year = 1484
    has_country_flag = ai_controlled
    OR = {
      tag = SPA
      tag = CAS
      tag = POR
      tag = ENG
      tag = GEN
      tag = VEN
    }
    NOT = { has_country_flag = columbus_decided }
  }
  mean_time_to_happen = {
    months = 12
  modifier = {
    factor = 0.1
    tag = ENG
  }
  modifier = {
    factor = 0.3
    tag = CAS
  }
  modifier = {
    factor = 0.6
    tag = POR
  }
  modifier = {
    factor = 0.9
    tag = GEN
  }
  }
  title = "Determine_Columbus"
  desc = "AI Event Determining who Gets Columbus"
  option = {		
    name = "SPA Columbus"
    ai_chance = { factor = 80 }
    SPA = { set_country_flag = SPA_columbus }
    CAS = { set_country_flag = SPA_columbus }
    SPA = { set_country_flag = columbus_decided }
    CAS = { set_country_flag = columbus_decided }
    POR = { set_country_flag = columbus_decided }
    ENG = { set_country_flag = columbus_decided }
    GEN = { set_country_flag = columbus_decided }
    VEN = { set_country_flag = columbus_decided }
  }
  option = {		
    name = "POR Columbus"
    ai_chance = { factor = 5 }
    POR = { set_country_flag = POR_columbus }
    SPA = { set_country_flag = columbus_decided }
    CAS = { set_country_flag = columbus_decided }
    POR = { set_country_flag = columbus_decided }
    ENG = { set_country_flag = columbus_decided }
    GEN = { set_country_flag = columbus_decided }
    VEN = { set_country_flag = columbus_decided }
  }
  option = {		
    name = "ENG Columbus"
    ai_chance = { factor = 5 }
    ENG = { set_country_flag = ENG_columbus }
  }
  option = {		
    name = "GEN Columbus"
    ai_chance = { factor = 5 }
    GEN = { set_country_flag = GEN_columbus }
    SPA = { set_country_flag = columbus_decided }
    CAS = { set_country_flag = columbus_decided }
    POR = { set_country_flag = columbus_decided }
    ENG = { set_country_flag = columbus_decided }
    GEN = { set_country_flag = columbus_decided }
    VEN = { set_country_flag = columbus_decided }
  }
  option = {		
    name = "VEN Columbus"
    ai_chance = { factor = 5 }
    VEN = { set_country_flag = VEN_columbus }
    SPA = { set_country_flag = columbus_decided }
    CAS = { set_country_flag = columbus_decided }
    POR = { set_country_flag = columbus_decided }
    ENG = { set_country_flag = columbus_decided }
    GEN = { set_country_flag = columbus_decided }
    VEN = { set_country_flag = columbus_decided }
  }
}

Testing the event

while testing the event, look in the log for your event to happen (set the MTTH to months = 3 or less while testing) or open the console and fire it manualy for a computer controlled country (after they get the AI/player event) using event 9999 TAG. Change TAG to the country tag you want, and change the id to the correct event id for the event you want.

Personal tools