1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
/*%FSM<COMPILE "D:\ArmA2\FSM Editor Personal Edition\scriptedFSM.cfg, updatecapture">*/
/*%FSM<HEAD>*/
/*
item0[] = {"Init",0,4346,64.981941,-136.945908,154.981949,-86.946060,0.000000,"Init"};
item1[] = {"Check_Towns",2,250,-66.836029,-56.267544,23.163887,-6.267582,0.000000,"Check Towns"};
item2[] = {"End",1,250,-218.006683,15.304325,-128.006653,65.304314,0.000000,"End"};
item3[] = {"Loop",4,218,65.605347,-56.267605,155.605377,-6.267574,0.000000,"Loop"};
item4[] = {"Gameover",4,218,-216.668854,-56.267559,-126.668869,-6.267574,0.000000,"Gameover"};
item5[] = {"Update_Capture",2,250,66.545486,22.916348,156.545471,72.916397,0.000000,"Update Capture"};
item6[] = {"In_Range",4,218,-66.545563,22.916351,23.454376,72.916374,0.000000,"In Range"};
item7[] = {"Not_in_Range",4,218,-167.954971,85.174767,-77.955025,135.174774,0.000000,"Not in Range"};
item8[] = {"Hide",2,250,215.453018,86.056137,305.453064,136.056137,0.000000,"Hide"};
link0[] = {0,3};
link1[] = {1,3};
link2[] = {1,4};
link3[] = {1,6};
link4[] = {1,7};
link5[] = {3,1};
link6[] = {4,2};
link7[] = {5,3};
link8[] = {6,5};
link9[] = {7,8};
link10[] = {8,3};
globals[] = {0.000000,0,0,0,0,640,480,1,25,6316128,1,-526.153625,526.153442,261.834167,-341.160065,1024,906,1};
window[] = {2,-1,-1,-1,-1,834,200,1460,200,3,1042};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "updatecapture";
class States
{
/*%FSM<STATE "Init">*/
class Init
{
name = "Init";
init = /*%FSM<STATEINIT""">*/"disableSerialization;" \n
"_delay = 4;" \n
"_lastCheck = """";" \n
"_lastSID = -1;" \n
"_lastUpdate = time;" \n
"" \n
"_tcarm = 'WFBE_TOWNCAPTUREASSISTRANGEMODIFIER' Call GetNamespace;" \n
"" \n
"_colorBlue = [0,0,0.7,0.7];" \n
"_colorGreen = [0,0.7,0,0.7];" \n
"_colorRed = [0.7,0,0,0.7];" \n
"" \n
"_colorFriendly = switch ('Friendly' Call GetMarkerColoration) do {" \n
" case ""ColorGreen"": {_colorGreen};" \n
" case ""ColorBlue"": {_colorBlue};" \n
" case ""ColorRed"": {_colorRed};" \n
" default {_colorGreen};" \n
"};" \n
"" \n
"_colorEnemy = switch ('Enemy' Call GetMarkerColoration) do {" \n
" case ""ColorGreen"": {_colorGreen};" \n
" case ""ColorBlue"": {_colorBlue};" \n
" case ""ColorRed"": {_colorRed};" \n
" default {_colorRed};" \n
"};" \n
"" \n
"_coloResistance = switch ('Resistance' Call GetMarkerColoration) do {" \n
" case ""ColorGreen"": {_colorGreen};" \n
" case ""ColorBlue"": {_colorBlue};" \n
" case ""ColorRed"": {_colorRed};" \n
" default {_colorBlue};" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Loop">*/
class Loop
{
priority = 0.000000;
to="Check_Towns";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > 2 && !gameOver"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Check_Towns">*/
class Check_Towns
{
name = "Check_Towns";
init = /*%FSM<STATEINIT""">*/"_sorted = [player,towns] Call SortByDistance;" \n
"_nearest = _sorted select 0;" \n
"_range = (_nearest getVariable ""range"") * _tcarm;" \n
"" \n
"_update = false;" \n
"if (player distance _nearest < _range && alive player) then {_update = true};" \n
"" \n
"_lastUpdate = time;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Gameover">*/
class Gameover
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"gameOver"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "In_Range">*/
class In_Range
{
priority = 0.000000;
to="Update_Capture";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_update && !gameOver"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Not_in_Range">*/
class Not_in_Range
{
priority = 0.000000;
to="Hide";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_update && !gameOver"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Loop">*/
class Loop
{
priority = 0.000000;
to="Check_Towns";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > 2 && !gameOver"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "End">*/
class End
{
name = "End";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Update_Capture">*/
class Update_Capture
{
name = "Update_Capture";
init = /*%FSM<STATEINIT""">*/"_sideID = _nearest getVariable ""sideID"";" \n
"if (isNil '_sideID') then {_sideID = -1};" \n
"_curSV = _nearest getVariable ""supplyValue"";" \n
"_maxSV = _nearest getVariable ""maxSupplyValue"";" \n
"_txt = """";" \n
"_nObjects = nearestObjects [player, WFCAMP, 10];" \n
"_nObject = if (count _nObjects > 0) then {_nObjects select 0} else {objNull};" \n
"if !(isNull _nObject) then {" \n
" _sideID = _nObject getVariable ""sideID"";" \n
" if !(isNil '_sideID') then {" \n
" _curSV = _nObject getVariable ""supplyValue"";" \n
" if (_lastCheck == ""Town"") then {_delay = 0};" \n
" _lastCheck = ""Camp"";" \n
" } else {" \n
" _sideID = -1;" \n
" };" \n
" if (player distance _nObject >= 10) then {" \n
" _lastCheck = ""Town"";" \n
" _sideID = _nearest getVariable ""sideID"";" \n
" _curSV = _nearest getVariable ""supplyValue"";" \n
" _txt = Format [""SV: %1/%2"",_curSV,_maxSV];" \n
" };" \n
"} else {" \n
" if (_lastCheck == ""Camp"") then {_delay = 0};" \n
" _lastCheck = ""Town"";" \n
" _txt = Format [""SV: %1/%2"",_curSV,_maxSV];" \n
"};" \n
"" \n
"_barColor = [];" \n
"if (_sideID == RESISTANCEID || _sideID == -1) then {_barColor = _coloResistance};" \n
"if ((_sideID == WESTID)&&(sideID == WESTID) || (_sideID == EASTID)&&(sideID == EASTID)) then {_barColor = _colorFriendly}; //--- Green" \n
"if ((_sideID == WESTID)&&(sideID == EASTID) || (_sideID == EASTID)&&(sideID == WESTID)) then {_barColor = _colorEnemy};" \n
"if (_sideID != _lastSID) then {_delay = 0};" \n
"if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0];_delay = 0};" \n
"if (!isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {" \n
" _control = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3800;" \n
" _control ctrlShow true;" \n
" _control CtrlSetBackgroundColor _barColor;" \n
" _backgroundControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3600;" \n
" _backgroundControl ctrlShow true;" \n
" _backgroundControl CtrlSetBackgroundColor [0.1882, 0.2588, 0.149, 0.76];" \n
" _textControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3900;" \n
" _textControl ctrlShow true;" \n
" _textControl ctrlSetText _txt;" \n
" _maxWidth = (CtrlPosition _backgroundControl Select 2) - 0.02;" \n
" _position = CtrlPosition _control;" \n
" _position Set[2,_maxWidth * _curSV / _maxSV];" \n
" _control CtrlSetPosition _position;" \n
" _control CtrlCommit _delay;" \n
" _delay = 4;" \n
" _lastSID = _sideID;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Loop">*/
class Loop
{
priority = 0.000000;
to="Check_Towns";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > 2 && !gameOver"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Hide">*/
class Hide
{
name = "Hide";
init = /*%FSM<STATEINIT""">*/"_delay = 0;" \n
"if (isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {12450 cutRsc[""OptionsAvailable"",""PLAIN"",0]};" \n
"if (!isNull ([""currentCutDisplay""] call BIS_FNC_GUIget)) then {" \n
" _control = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3800;" \n
" _backgroundControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3600;" \n
" _textControl = ([""currentCutDisplay""] call BIS_FNC_GUIget) DisplayCtrl 3900;" \n
" _control ctrlShow false;" \n
" _backgroundControl ctrlShow false;" \n
" _textControl ctrlShow false;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Loop">*/
class Loop
{
priority = 0.000000;
to="Check_Towns";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"time - _lastUpdate > 2 && !gameOver"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="Init";
finalStates[] =
{
"End"
};
};
/*%FSM</COMPILE>*/
|