ST NewHorizons/Events/Demons Crisis

Summary and Overview[编辑 | 编辑源代码]

(TODO)

Triggering the Event Chain[编辑 | 编辑源代码]

The "Terra Prime" event chain (Referred to as "Demons" in the mod files) is queued at the beginning of the game with the "on_game_start_country" on_action. The trigger for the chain consists of two events: "STH_united_earth_story.1020" (Demons Fired) and "STH_united_earth_story.1021" (Demons Queued).

Event 1020 (Demons Fired)[编辑 | 编辑源代码]

This event is triggered at the beginning of the game without an event window. The trigger condition is as follows:

  has_country_flag = united_earth
  enterprise_era = yes

These conditions ensure that only United Earth will have the Terra Prime chain queued. If this trigger is met, it runs the following "immediate" code:

  random_country = {
    limit = { has_country_flag = united_earth }
    country_event = { id = STH_united_earth_story.1021 days = 2050 random = 100 }
  }
  set_country_flag = demons_crisis_queued

This immediate code queues "Event 1021" for United Earth which will fire in 2050-2150 days (Approx. 67-71 Months). It also sets the flag "demons_crisis_queued" for United Earth, which is used to ensure that only United Earth will receive "Event 1021".

Event 1021 (Demons Queued)[编辑 | 编辑源代码]

After the timer of 2050-2150 days from "Event 1020" has ended, this event is fired, also with a hidden event window. The trigger conditions are:

  has_country_flag = united_earth
  NOT = { has_country_flag = united_ferderation_of_planets }

This ensures that only United Earth will receive this event, and only if United Earth has not formed the UFP. The immediate code is as follows:

  if = {
    limit = {
      has_country_flag = xindi_crisis_complete_win
      NOT = { has_country_flag = demons_crisis_started }
    }
    log = "Demons triggered"
    country_event = {id = STH_united_earth_story.1 }
  }
  else = {
    log = "Demons wait"
    country_event = { id = STH_united_earth_story.1021 days = 360 }
  }

This immediate code can be broken down into a "true" block and a "false" block, with the true block being in the "if" block, and false block being in the "else" block.

The "true" block only fires if the following conditions are met:

has_country_flag = xindi_crisis_complete_win
NOT = { has_country_flag = demons_crisis_started }

These two conditions mean that the event will fire if United Earth has gotten the "good" ending to the Xindi crisis (Earth is not destroyed) and the "Demons" crisis has not already been started. If both of these conditions are met, the line "Demons Triggered" is added to the log, and the first story event, "Demons", is triggered.

If the "true" block's conditions were not met, the "false" block is fired, which has the following code:

  log = "Demons wait"
  country_event = { id = STH_united_earth_story.1021 days = 360 }

This will add the line "Demons wait" to the log, and will trigger this event again in 360 days, effectively meaning that the game will check if it can fire the first story event every 360 days until it successfully does.