Debian Codegraph @

res/editor_examples/example_events_with_custom_variables.xml

raw
1 <?xml version="1.0"?>
2 <!DOCTYPE events>
3 <events version="2">
4 <variables>
5 <variable uid="ConsecutiveMonthsNotInDebt" initial_value="0"/>
6 <variable uid="TotalMonthsInDebt" initial_value="0"/>
7 </variables>
8 <!-- Repeats forever -->
9 <event repeat_months_min="1" repeat_months_max="1">
10 <conditions>
11 <money check="gte" min="0" max="0"/>
12 </conditions>
13 <actions>
14 <!-- Increase the custom variable that tracks how many months they are not in debt -->
15 <change_variable variable_uid="ConsecutiveMonthsNotInDebt" value="1" set_to_value="false"/>
16 </actions>
17 </event>
18 <!-- Repeats forever -->
19 <event repeat_months_min="1" repeat_months_max="1">
20 <conditions>
21 <money check="lt" min="0" max="0"/>
22 </conditions>
23 <actions>
24 <!-- We set the custom variable for consecutive months not in debt back to 0 and increase the total months in debt by 1 -->
25 <change_variable variable_uid="ConsecutiveMonthsNotInDebt" value="0" set_to_value="true"/>
26 <change_variable variable_uid="TotalMonthsInDebt" value="1" set_to_value="false"/>
27 </actions>
28 </event>
29 <!-- Repeats forever -->
30 <event repeat_months_min="1" repeat_months_max="1">
31 <conditions>
32 <!-- 5 years of no debt -->
33 <variable_check variable_uid="ConsecutiveMonthsNotInDebt" check="gte" value="60"/>
34 </conditions>
35 <actions>
36 <!-- Big favor bonus + message, and we start counting from 0 again -->
37 <change_variable variable_uid="ConsecutiveMonthsNotInDebt" value="0" set_to_value="true"/>
38 <favor_add amount="20"/>
39 <show_custom_message message_uid="caesarlovesyourmoney"/>
40 </actions>
41 </event>
42 <!-- Does not repeat. We only let this happen once. -->
43 <event>
44 <conditions>
45 <!-- A total of 18 months spent in debt, even if not consecutive -->
46 <variable_check variable_uid="TotalMonthsInDebt" check="gte" value="18"/>
47 </conditions>
48 <actions>
49 <!-- Big favor penalty and show a message to the player -->
50 <favor_add amount="-20"/>
51 <show_custom_message message_uid="caesarissickofyourdebt"/>
52 </actions>
53 </event>
54 </events>