模板:Event/doc

这是Template:Event的模板文档
当直接浏览时,使用变量可能会失效,请不要使用硬编码来代替页面名或地址。


Event can be used to diplay description, trigger, trigger condition and options of an event in a compact infobox.

Parameter

Parameter Description Default Status
version To specify the major patch for which the event was written or updated. empty required
event_id Event identification code as it appears in the file to serve as an anchor empty optional
event_name Title of the event. empty required
cond_event_text Set to "yes" if the event has multiple descriptions available for use. empty optional
event_text In-game description text of the event. If multiple descriptions exist then use only the default or the first one. empty optional, but desired
fire_only_once As in the script code - set to "yes" if the event happens only once during a campaign. empty optional
mtth For the base weight and its modifiers of MTTH-events. empty One of theses two is required.
triggered only To specify the trigger of 'triggered only'-events. empty
trigger Trigger conditions of the event.
  • None
optional
immediate The immediate effects of the event. empty optional
option conditions If set to ‘yes’ the section heading 'Option conditions' for events with conditional options is displayed. empty optional
options The possible effects of the event. Please use {{option}}. empty required
after Effects that happen after selecting any option. empty optional
collapse Whether to collapse the event. If set to ‘yes’ the content will be collapsed.

(Please use collapsed content on country pages.)

empty optional

Usage

{{Event
|version = 
|event_id = 
|event_name = 
|event_text = <!-- optional, but desired -->
|trigger = 
|mtth    = <!-- for Mtth events -->
|triggered only = <!-- for triggered only events -->
|immediate = <!-- optional for immediate effects -->
|options = <!-- options use {{option}} template -->
}}

Note: Please use either “mtth”-parameter or “triggered only”-parameter.

Examples

MTTH event

The following code

{{Event
| version = 1.0
| event_id = news.67
| event_name = The Games of the XII Olympiad
| event_text = The twelfth Olympic Games were recently held in Tokyo, Japan. In light of rising international tensions, many feared the Games would be canceled, but this has proven not to be the case. <br/><br/>Tokyo is the first non-Western city to host the Olympics, and a special purpose-built Me 261 long-range aircraft carried the Olympic Flame there from Germany without refueling.<br/><br/>Japanese athletes did well, and their 14 gold medals earned them a third place in the medal count, after Germany and the United States.
| trigger =
* Date is after 1940.10.5
* Global flag ''olympics_1936'' is set
* Global flag ''olympics_fin_1940'' is not set
* Global flag ''olympics_jap_1940'' is not set
* The following nations exist ''and'' at peace:
** {{flag|Germany}}
** {{flag|Japan}}
** {{flag|United States}}
* {{flag|France}} at peace
* {{flag|United Kingdom}} at peace
| mtth = * 2 days
| immediate = * Set global flag ''olympics_jap_1940''
| options = 
{{Option
| option_text = The Games are concluded.
}}
| collapse = no
}}

will display:

id

The Games of the XII Olympiad


The twelfth Olympic Games were recently held in Tokyo, Japan. In light of rising international tensions, many feared the Games would be canceled, but this has proven not to be the case.

Tokyo is the first non-Western city to host the Olympics, and a special purpose-built Me 261 long-range aircraft carried the Olympic Flame there from Germany without refueling.

Japanese athletes did well, and their 14 gold medals earned them a third place in the medal count, after Germany and the United States.


 
Trigger conditions
  • Date is after 1940.10.5
  • Global flag olympics_1936 is set
  • Global flag olympics_fin_1940 is not set
  • Global flag olympics_jap_1940 is not set
  • The following nations exist and at peace:
    • 请检查模板名和国家代码{{Countries|flag/core|Germany}}
    • 请检查模板名和国家代码{{Countries|flag/core|Japan}}
    • 请检查模板名和国家代码{{Countries|flag/core|United States}}
  • 请检查模板名和国家代码{{Countries|flag/core|France}} at peace
  • 请检查模板名和国家代码{{Countries|flag/core|United Kingdom}} at peace
Mean time to happen
  • 2 days

Immediate effects
  • Set global flag olympics_jap_1940

Event button.png
The Games are concluded.
  • None

Triggered only event

The following code

{{Event
| version = 1.3
| event_id = bulgaria.1
| event_name = Treaty of Craiova - Romania Agrees
| event_text = The Romanian government has accepted German Arbitration in our dispute. Southern Dobrudja has been reunited with Bulgaria!
| triggered only = * Romanian event [[Romanian events#romania.5|''"Treaty of Craiova"'']]
| options = 
{{Option
| option_text = At last!
| effect =
* {{flag|Bulgaria}} gains ownership of the state Dobrudja (77)
* Trigger news event [[News events 1#news.21|''"Treaty of Craiova"'']] in 1 days
}}
}}

will display:

id

Treaty of Craiova - Romania Agrees


The Romanian government has accepted German Arbitration in our dispute. Southern Dobrudja has been reunited with Bulgaria!


 
Trigger conditions
  • None
Is triggered only by

Event button.png
At last!
  • 请检查模板名和国家代码{{Countries|flag/core|Bulgaria}} gains ownership of the state Dobrudja (77)
  • Trigger news event "Treaty of Craiova" in 1 days

Event with conditional options

The following code

{{Event
| version = 1.0
| event_id = news.61
| event_name = The Fate of Czechoslovakia
| cond_event_text = * Global flag ''end_of_czechoslovakia'' is set
| event_text = German troops crossed into Bohemia and Moravia recently, ostensibly to restore order to the regions in the wake of the collapsing Czechoslovakian government. <br/><br/>In Prague, the occupying forces announced the creation of an 'autonomous protectorate' within [GER.GetNameDef]. Hungarian forces, operating with the consent of Germany, have marched into Slovakia and annexed it into Hungary. <br/><br/>The nation of Czechoslovakia is no more.
| triggered only = * German event [[German events#germany.56|''"The Partition of Czechoslovakia"'']]
| option conditions = yes
| options = 
{{Option
| option_text = So much for peace.
| trigger = * Is ''not'':
** {{flag|France}}
** {{flag|Germany}}
** {{flag|Hungary}}
** {{flag|United Kingdom}}
}}
{{Option
| option_text = The Czechs must be protected from themselves.
| trigger = Is {{flag|Germany}}
}}
{{Option
| option_text = This isn't what we agreed on!
| trigger = Is {{flag|France}} ''or'' {{flag|United Kingdom}}
}}
{{Option
| option_text = Hungary will be restored to its former glory!
| trigger = Is {{flag|Hungary}}
| end
}}
| collapse = no
}}
id

The Fate of Czechoslovakia


German troops crossed into Bohemia and Moravia recently, ostensibly to restore order to the regions in the wake of the collapsing Czechoslovakian government.

In Prague, the occupying forces announced the creation of an 'autonomous protectorate' within [GER.GetNameDef]. Hungarian forces, operating with the consent of Germany, have marched into Slovakia and annexed it into Hungary.

The nation of Czechoslovakia is no more.


 
Trigger conditions
  • None
Is triggered only by

Option conditions

Event trigger.pngEnabled if:

  • Is not:
    • 请检查模板名和国家代码{{Countries|flag/core|France}}
    • 请检查模板名和国家代码{{Countries|flag/core|Germany}}
    • 请检查模板名和国家代码{{Countries|flag/core|Hungary}}
    • 请检查模板名和国家代码{{Countries|flag/core|United Kingdom}}
Event button.png
So much for peace.
  • None

Event trigger.pngEnabled if: Is 请检查模板名和国家代码{{Countries|flag/core|Germany}}

Event button.png
The Czechs must be protected from themselves.
  • None

Event trigger.pngEnabled if: Is 请检查模板名和国家代码{{Countries|flag/core|France}} or 请检查模板名和国家代码{{Countries|flag/core|United Kingdom}}

Event button.png
This isn't what we agreed on!
  • None

Event trigger.pngEnabled if: Is 请检查模板名和国家代码{{Countries|flag/core|Hungary}}

Event button.png
Hungary will be restored to its former glory!
  • None