Debian Codegraph @

res/editor_examples/example_events_xml.xml

raw
1 <?xml version="1.0"?>
2 <!DOCTYPE events>
3 <events version="1">
4 <!-- This event is setup to repeat randomly every 1 to 4 months.
5 How many months it takes before repeating is randomly chosen between min and max each time it triggers. -->
6 <event repeat_months_min="1" repeat_months_max="4">
7 <!-- Even though the event can repeat 1 to 4 months, we also have a time check here.
8 This is checking that the months passed since the start of the game is equal or greater than a random number between 4 and 6.
9 Once the scenario starts, this number will be determined (say it picks 5), and it will then start checking if that number of months have passed.
10 Once met, this event can trigger and start repeating.
11
12 So in total, this basically means: This event start after 4 to 6 months, and repeats every 1 to 4 months after that. -->
13 <conditions>
14 <time check="gte" min="4" max="6"/>
15 </conditions>
16 <actions>
17 <!-- Give the player 1000 money -->
18 <money_add amount="1000"/>
19 <!-- Give the player 1 favor -->
20 <favor_add amount="1"/>
21 </actions>
22 </event>
23 <!-- This event is not setup to repeat, so it will only ever execute its actions once. -->
24 <event>
25 <conditions>
26 <!-- For the 'time' condition, we can do diffirent types of checks.
27 Here we say that the months must exactly equal 0 (start of the game).
28 We do this by using amount instead of a min and max.
29 Using amount="0" is the same as saying min="0" and max="0" -->
30 <time check="eq" amount="0"/>
31 <!-- We also only want this to fire if the player is playing on very easy -->
32 <difficulty check="eq" value="very_easy"/>
33 </conditions>
34 <actions>
35 <!-- We give the player an extra 10 favor -->
36 <favor_add amount="10"/>
37 <!-- Here we give the player a random amount of money between 10000 and 15000. -->
38 <money_add min="10000" max="15000"/>
39 </actions>
40 </event>
41 <event>
42 <!-- On hard and very hard, we want to take some money and favour from the player at
43 the start of the scenario. -->
44 <conditions>
45 <time check="eq" amount="0"/>
46 <difficulty check="gte" value="hard"/>
47 </conditions>
48 <actions>
49 <favor_add amount="-7"/>
50 <money_add min="-2735" max="-2735"/>
51 </actions>
52 </event>
53 <event>
54 <!-- If after a month you still do not have personal savings, then assume the player has their salary on 0.
55 Secretly give them some personal savings to mess with them. -->
56 <conditions>
57 <time check="eq" amount="1"/>
58 <savings check="eq" value="0"/>
59 </conditions>
60 <actions>
61 <savings_add min="77" max="77"/>
62 </actions>
63 </event>
64 <!-- Every month, if the player's city has less than 2000 money in its coffers, give money but reduce favour. -->
65 <event repeat_months_min="1" repeat_months_max="1" max_number_of_repeats="2">
66 <conditions>
67 <money check="lte" value="0"/>
68 </conditions>
69 <actions>
70 <money_add amount="500"/>
71 <favor_add amount="-5"/>
72 </actions>
73 </event>
74 <!-- We want to wheat to start off expensive but slowly have its price return to normal to encourage the player to export wheat early on.
75 So we do one event that runs at the start of the map to 'silently' increase the price, and then ... -->
76 <event>
77 <conditions>
78 <time check="eq" amount="0"/>
79 </conditions>
80 <actions>
81 <trade_price_adjust resource="wheat" amount="40" show_message="false"/>
82 </actions>
83 </event>
84 <!-- ... this second event runs randomly every (4 to 7) months while the wheat price is above 28, decreasing it by 2 each time. -->
85 <event repeat_months_min="4" repeat_months_max="7">
86 <conditions>
87 <trade_sell_price resource="wheat" check="gte" value="28"/>
88 </conditions>
89 <actions>
90 <trade_price_adjust resource="wheat" amount="-2" show_message="true"/>
91 </actions>
92 </event>
93 <!-- While Caesar loves us, and the trade price of wine is below 270, slowly increase it silently (no message shown) -->
94 <event repeat_months_min="1" repeat_months_max="6">
95 <conditions>
96 <stats_favor check="gte" value="80"/>
97 </conditions>
98 <actions>
99 <trade_sell_price resource="wine" check="lte" value="270"/>
100 <trade_price_adjust resource="wine" amount="2" show_message="false"/>
101 </actions>
102 </event>
103 <!-- The first time we have more than 10% unemployed people, we get land and sea trade problems that last 2 months each -->
104 <event>
105 <conditions>
106 <population_unemployed percentage="true" check="gte" value="10"/>
107 </conditions>
108 <actions>
109 <trade_problems_land duration="32"/>
110 <trade_problems_sea duration="32"/>
111 </actions>
112 </event>
113 <!-- Once favour is greater or equal (gte) to 80, increase wheat demand for Heliopolis to 200.
114 Notes for this to work:
115 Heliopolis must exist as a city on the empire map. (Custom empires are your friend.)
116 Heliopolis must be trade-able. This trigger cannot change a city type between trade-able or not. Just adjust amounts.
117 Heliopolis must buy wheat (if it sold it instead, then the amount would change how much it sells, not change it to buying.)
118 In short, this works the same as demand changes that the editor can do,
119 you can just now have as many as you want, and have conditions on them
120 -->
121 <event>
122 <conditions>
123 <stats_favor check="gte" value="80"/>
124 </conditions>
125 <actions>
126 <trade_route_amount target_city="Heliopolis" resource="wheat" amount="200" show_message="true"/>
127 </actions>
128 </event>
129 <!-- For the first two years Rome lowers wages consistently until it gets as low as 15. -->
130 <event repeat_months_min="1" repeat_months_max="1">
131 <conditions>
132 <time check="lte" amount="24"/>
133 <rome_wages check="gte" value="15"/>
134 </conditions>
135 <actions>
136 <change_rome_wages min="-1" max="-1" set_to_value="false"/>
137 </actions>
138 </event>
139 <!-- After two years, Rome's wages rises until it hits about 37. -->
140 <event repeat_months_min="1" repeat_months_max="5">
141 <conditions>
142 <time check="gte" amount="24"/>
143 <rome_wages check="lte" value="37"/>
144 </conditions>
145 <actions>
146 <change_rome_wages min="1" max="5" set_to_value="false"/>
147 </actions>
148 </event>
149 <!-- Once we have more than 1000 patricians, then we get start receiving some personal gifts. Totally legit. -->
150 <event repeat_months_min="7" repeat_months_max="12">
151 <conditions>
152 <city_population check="gte" value="1000" class="patrician"/>
153 </conditions>
154 <actions>
155 <savings_add min="250" max="350"/>
156 </actions>
157 </event>
158 <!-- Start a gladiator revolt after 36 months. -->
159 <event>
160 <conditions>
161 <time check="eq" amount="36"/>
162 </conditions>
163 <actions>
164 <gladiator_revolt/>
165 </actions>
166 </event>
167 <!-- At start of map, enable gold resource -->
168 <event>
169 <conditions>
170 <time check="eq" amount="0"/>
171 </conditions>
172 <actions>
173 <change_resource_produced resource="gold" produced="true"/>
174 </actions>
175 </event>
176 <!-- Disable plaza at the start of the game. Only enable it once the player has at least 4 working small temples -->
177 <event>
178 <conditions>
179 <time check="eq" amount="0"/>
180 </conditions>
181 <actions>
182 <change_allowed_buildings building="plaza" allowed="false"/>
183 </actions>
184 </event>
185 <event>
186 <conditions>
187 <building_count_active check="gte" value="4" building="all_small_temples"/>
188 </conditions>
189 <actions>
190 <change_allowed_buildings building="plaza" allowed="true"/>
191 </actions>
192 </event>
193 <!-- If at least 4 months have passed, and you have no active small temples, then you get a 'gods are angry' message -->
194 <event>
195 <conditions>
196 <time check="gte" amount="4"/>
197 <building_count_active check="lte" value="0" building="all_small_temples"/>
198 </conditions>
199 <actions>
200 <send_standard_message text_id="gods_wrathful"/>
201 </actions>
202 </event>
203 <!-- After 12 to 16 months, start a plague -->
204 <event>
205 <conditions>
206 <time check="gte" min="12" max="16"/>
207 </conditions>
208 <actions>
209 <city_health min="0" max="2" set_to_value="true"/>
210 </actions>
211 </event>
212 <!-- The first time health drops below 10, send a message about pestilence -->
213 <event>
214 <conditions>
215 <stats_health check="lte" value="10"/>
216 </conditions>
217 <actions>
218 <send_standard_message text_id="health_pestilence"/>
219 </actions>
220 </event>
221 <!-- Somewhere after 3 to 7 months, set the sell price of pottery to 177. Normally sells for 140. Buy price will be automatically adjusted accordingly. -->
222 <event>
223 <conditions>
224 <time check="eq" min="3" max="7"/>
225 </conditions>
226 <actions>
227 <trade_price_set resource="pottery" amount="177" set_buy_price="false" show_message="true"/>
228 </actions>
229 </event>
230 <!-- Once the player has at least 10 soldiers, increase the price of weapons by 12 -->
231 <event>
232 <conditions>
233 <count_own_troops check="gte" value="10" in_city_only="true"/>
234 </conditions>
235 <actions>
236 <trade_price_adjust resource="weapons" amount="12" show_message="true"/>
237 </actions>
238 </event>
239 <!-- After 8 months a new trade route becomes available. -->
240 <event>
241 <conditions>
242 <time check="eq" amount="8"/>
243 </conditions>
244 <actions>
245 <empire_map_convert_future_trade_city target_city="Ephesus" show_message="true"/>
246 </actions>
247 </event>
248 <!-- After 2 months, force start the first request (which we will use as a repeating request).
249 And about every 9 months, try and start the request again (will do nothing if already active.) -->
250 <event repeat_months_min="7" repeat_months_max="11">
251 <conditions>
252 <time check="gte" amount="2"/>
253 </conditions>
254 <actions>
255 <request_immediately_start request_id="0"/>
256 </actions>
257 </event>
258 <!-- For the second request, we want it to repeat immediately once it is completed,
259 but only do so 4 times in total. So we run this event every month, and limit it to 4,
260 but also only let it action if the request is not ongoing (otherwise it would count even the times
261 it cannot properly start the request.)
262
263 Note: For an request like this that repeat quickly, you probably want the request itself to have
264 a long leeway in its deadline, so that the player can leave it be for a bit and not get constant
265 request spam. -->
266 <event repeat_months_min="1" repeat_months_max="1" max_number_of_repeats="4">
267 <conditions>
268 <request_is_ongoing request_id="1" check_for_ongoing="false"/>
269 </conditions>
270 <actions>
271 <request_immediately_start request_id="1"/>
272 </actions>
273 </event>
274 </events>