emplacement.fsm 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. /*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Emplacement">*/
  2. /*%FSM<HEAD>*/
  3. /*
  4. item0[] = {"Initialise_Empla",0,250,300.000000,425.000000,400.000000,475.000000,0.000000,"Initialise" \n "Emplacement"};
  5. item1[] = {"No_type_given",4,218,425.000000,425.000000,525.000000,475.000000,1.000000,"No type given"};
  6. item2[] = {"Type_given",8,218,175.000000,425.000000,275.000000,475.000000,0.000000,"Type given"};
  7. item3[] = {"Check_ammo",2,250,175.000000,850.000000,275.000000,900.000000,0.000000,"Check ammo"};
  8. item4[] = {"No_ammo_",4,218,50.000000,850.000000,150.000000,900.000000,1.000000,"No ammo!"};
  9. item5[] = {"Build_emplacement",2,4346,300.000000,500.000000,400.000000,550.000000,0.000000,"Build" \n "emplacement" \n "type"};
  10. item6[] = {"Time_to_check",4,218,300.000000,850.000000,400.000000,900.000000,0.000000,"Time to check"};
  11. item7[] = {"Have___awaiting",8,218,175.000000,725.000000,275.000000,775.000000,0.000000,"Have /" \n "awaiting" \n "ammo"};
  12. item8[] = {"Wait_for_the_che",8,218,675.000000,725.000000,775.000000,775.000000,0.000000,"Wait for the" \n "checks"};
  13. item9[] = {"Attack_",4,218,425.000000,725.000000,525.000000,775.000000,1.000000,"Attack!"};
  14. item10[] = {"Spawn_attacking",2,250,550.000000,725.000000,650.000000,775.000000,0.000000,"Spawn attacking" \n "enemies"};
  15. item11[] = {"No_players_remai",4,218,800.000000,950.000000,900.000000,1000.000000,0.000000,"No players" \n "remaining"};
  16. item12[] = {"Enemy_defeated",4,218,800.000000,875.000000,900.000000,925.000000,0.000000,"Enemy" \n "defeated"};
  17. item13[] = {"Right_then___",8,218,300.000000,575.000000,400.000000,625.000000,0.000000,"Right then..."};
  18. item14[] = {"Let_s_wait_here",2,250,300.000000,650.000000,400.000000,700.000000,0.000000,"Let's wait here"};
  19. item15[] = {"Wait___",2,250,675.000000,800.000000,775.000000,850.000000,0.000000,"Wait..."};
  20. item16[] = {"Do_the_checks",4,218,675.000000,875.000000,775.000000,925.000000,0.000000,"Do the checks"};
  21. item17[] = {"Check",2,250,675.000000,950.000000,775.000000,1000.000000,0.000000,"Check"};
  22. item18[] = {"Nothing_yet",8,218,550.000000,875.000000,650.000000,925.000000,0.000000,"Nothing yet"};
  23. item19[] = {"That_s_it__The_End",1,250,925.000000,950.000000,1025.000000,1000.000000,0.000000,"That's it." \n "The End."};
  24. item20[] = {"Ammo_truck_died",4,218,50.000000,925.000000,150.000000,975.000000,3.000000,"Ammo truck" \n "died!"};
  25. item21[] = {"Ammo_truck_s_there",4,218,175.000000,925.000000,275.000000,975.000000,2.000000,"Ammo truck's" \n "there!"};
  26. item22[] = {"",7,210,221.000000,1021.000000,229.000000,1029.000000,0.000000,""};
  27. item23[] = {"",7,210,-154.000015,1021.000000,-146.000000,1029.000000,0.000000,""};
  28. item24[] = {"Create_Ammo_Truc",2,250,-75.000000,850.000000,25.000000,900.000000,0.000000,"Create" \n "Ammo Truck"};
  29. item25[] = {"",7,210,-29.000000,946.000000,-21.000000,954.000000,0.000000,""};
  30. item26[] = {"",7,210,-154.000000,671.000000,-146.000000,679.000000,0.000000,""};
  31. item27[] = {"",7,210,-29.000000,671.000000,-21.000000,679.000000,0.000000,""};
  32. item28[] = {"Show_notificatio",4,218,-75.000000,725.000000,25.000000,775.000000,0.000000,"Show" \n "notification"};
  33. item29[] = {"Truck_failed_to",4,218,50.000000,725.000000,150.000000,775.000000,1.000000,"Truck" \n "failed to" \n "spawn"};
  34. item30[] = {"",7,210,96.000000,671.000000,104.000000,679.000000,0.000000,""};
  35. item31[] = {"Weapons_dead",4,218,300.000000,925.000000,400.000000,975.000000,5.000000,"Weapons" \n "dead"};
  36. item32[] = {"",7,210,471.000000,946.000000,479.000000,954.000000,0.000000,""};
  37. item33[] = {"",7,210,471.000000,821.000000,479.000000,829.000000,0.000000,""};
  38. item34[] = {"",7,210,846.000000,671.000000,854.000000,679.000000,0.000000,""};
  39. link0[] = {0,1};
  40. link1[] = {0,2};
  41. link2[] = {1,5};
  42. link3[] = {2,5};
  43. link4[] = {3,4};
  44. link5[] = {3,7};
  45. link6[] = {3,20};
  46. link7[] = {3,21};
  47. link8[] = {3,31};
  48. link9[] = {4,24};
  49. link10[] = {5,13};
  50. link11[] = {6,3};
  51. link12[] = {7,14};
  52. link13[] = {8,15};
  53. link14[] = {9,10};
  54. link15[] = {10,8};
  55. link16[] = {11,19};
  56. link17[] = {12,34};
  57. link18[] = {13,14};
  58. link19[] = {14,6};
  59. link20[] = {14,9};
  60. link21[] = {15,16};
  61. link22[] = {16,17};
  62. link23[] = {17,11};
  63. link24[] = {17,12};
  64. link25[] = {17,18};
  65. link26[] = {18,15};
  66. link27[] = {20,25};
  67. link28[] = {21,22};
  68. link29[] = {22,23};
  69. link30[] = {23,26};
  70. link31[] = {24,28};
  71. link32[] = {24,29};
  72. link33[] = {25,24};
  73. link34[] = {26,27};
  74. link35[] = {27,30};
  75. link36[] = {28,27};
  76. link37[] = {29,30};
  77. link38[] = {30,14};
  78. link39[] = {31,32};
  79. link40[] = {32,33};
  80. link41[] = {33,14};
  81. link42[] = {34,14};
  82. globals[] = {25.000000,1,0,0,0,640,480,1,52,6316128,1,-57.666420,839.645508,1264.746216,421.511383,979,920,1};
  83. window[] = {2,-1,-1,-1,-1,995,-1842,-402,235,3,997};
  84. *//*%FSM</HEAD>*/
  85. class FSM
  86. {
  87. fsmName = "Emplacement";
  88. class States
  89. {
  90. /*%FSM<STATE "Initialise_Empla">*/
  91. class Initialise_Empla
  92. {
  93. name = "Initialise_Empla";
  94. init = /*%FSM<STATEINIT""">*/"_name = """";" \n
  95. "_marker = """";" \n
  96. "_pos = [];" \n
  97. "_type = """";" \n
  98. "_truck = objNull;" \n
  99. "" \n
  100. "//Set attack timer" \n
  101. "_attackTimeout = time + (3600 + random(10800));" \n
  102. "" \n
  103. "{" \n
  104. " switch (_x select 0) do" \n
  105. " {" \n
  106. " case ""name"": { _name = _x select 1; };" \n
  107. " case ""marker"": { _marker = _x select 1; _pos = markerPos _marker; };" \n
  108. " case ""type"": { _type = _x select 1; };" \n
  109. " };" \n
  110. "} forEach _this;" \n
  111. "" \n
  112. "_awaitingAmmo = false;" \n
  113. "_hasAmmo = true;" \n
  114. "_weapons = [];" \n
  115. "_respawnHandles = [];"/*%FSM</STATEINIT""">*/;
  116. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  117. class Links
  118. {
  119. /*%FSM<LINK "No_type_given">*/
  120. class No_type_given
  121. {
  122. priority = 1.000000;
  123. to="Build_emplacement";
  124. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  125. condition=/*%FSM<CONDITION""">*/"_type == """""/*%FSM</CONDITION""">*/;
  126. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  127. };
  128. /*%FSM</LINK>*/
  129. /*%FSM<LINK "Type_given">*/
  130. class Type_given
  131. {
  132. priority = 0.000000;
  133. to="Build_emplacement";
  134. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  135. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  136. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  137. };
  138. /*%FSM</LINK>*/
  139. };
  140. };
  141. /*%FSM</STATE>*/
  142. /*%FSM<STATE "Check_ammo">*/
  143. class Check_ammo
  144. {
  145. name = "Check_ammo";
  146. init = /*%FSM<STATEINIT""">*/"_hasAmmo = false;" \n
  147. "" \n
  148. "_tmp = _weapons;" \n
  149. "_weapons = [];" \n
  150. "_counter = 1;" \n
  151. "" \n
  152. "{" \n
  153. " call compile format[""_weapons = _weapons + [%1_weapon_%2];"", _marker, _counter];" \n
  154. " _counter = _counter + 1;" \n
  155. "} forEach _tmp;" \n
  156. "" \n
  157. "{" \n
  158. " if (someAmmo _x) exitWith { _hasAmmo = true; };" \n
  159. "} forEach _weapons;"/*%FSM</STATEINIT""">*/;
  160. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  161. class Links
  162. {
  163. /*%FSM<LINK "Weapons_dead">*/
  164. class Weapons_dead
  165. {
  166. priority = 5.000000;
  167. to="Let_s_wait_here";
  168. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  169. condition=/*%FSM<CONDITION""">*/"({ alive _x } count _weapons) < 1"/*%FSM</CONDITION""">*/;
  170. action=/*%FSM<ACTION""">*/"_awaitingAmmo = false;" \n
  171. "_hasAmmo = true;" \n
  172. "" \n
  173. "[""emplacement"", _marker, _pos, _name] call AW_fnc_createJIPstateMarker;"/*%FSM</ACTION""">*/;
  174. };
  175. /*%FSM</LINK>*/
  176. /*%FSM<LINK "Ammo_truck_died">*/
  177. class Ammo_truck_died
  178. {
  179. priority = 3.000000;
  180. to="Create_Ammo_Truc";
  181. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  182. condition=/*%FSM<CONDITION""">*/"_awaitingAmmo && !_hasAmmo && !isNull _truck && !alive _truck"/*%FSM</CONDITION""">*/;
  183. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  184. };
  185. /*%FSM</LINK>*/
  186. /*%FSM<LINK "Ammo_truck_s_there">*/
  187. class Ammo_truck_s_there
  188. {
  189. priority = 2.000000;
  190. to="Let_s_wait_here";
  191. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  192. condition=/*%FSM<CONDITION""">*/"_awaitingAmmo && !_hasAmmo && !isNull _truck && (_truck distance _pos) < 50"/*%FSM</CONDITION""">*/;
  193. action=/*%FSM<ACTION""">*/"//The important bit..." \n
  194. "{ _x setVehicleAmmoDef 1; } forEach _weapons;" \n
  195. "" \n
  196. "[""emplacement"", _marker, _pos, _name] call AW_fnc_createJIPstateMarker;" \n
  197. "[[""type"", ""emplacement_resupplied""], [""message"", _name], [""global"", true]] call AW_fnc_showNotification;" \n
  198. "" \n
  199. "//Dish out points to driver, passengers and anyone in vehicles nearby that may've ""escorted"" (but not in the emplacement guns)" \n
  200. "{" \n
  201. " if ((_x distance _truck) < 200 && !(_x in _weapons)) then" \n
  202. " {" \n
  203. " {" \n
  204. " [_x, 5, ""Completed an emplacement resupply operation""] call AW_fnc_givePoints;" \n
  205. " } forEach (crew _x);" \n
  206. " };" \n
  207. "} forEach vehicles;" \n
  208. "" \n
  209. "_driver = driver _truck;" \n
  210. "if (!(isNull _driver)) then" \n
  211. "{" \n
  212. " [_driver, 5, ""Drove a resupply truck to its destination""] call AW_fnc_givePoints;" \n
  213. "};" \n
  214. "" \n
  215. "_awaitingAmmo = false;" \n
  216. "_hasAmmo = true;" \n
  217. ""/*%FSM</ACTION""">*/;
  218. };
  219. /*%FSM</LINK>*/
  220. /*%FSM<LINK "No_ammo_">*/
  221. class No_ammo_
  222. {
  223. priority = 1.000000;
  224. to="Create_Ammo_Truc";
  225. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  226. condition=/*%FSM<CONDITION""">*/"!_hasAmmo && !_awaitingAmmo && ({ alive _x } count _weapons) > 0"/*%FSM</CONDITION""">*/;
  227. action=/*%FSM<ACTION""">*/"[[""emplacement"", ""ammo""], _marker, _pos, _name] call AW_fnc_createJIPstateMarker;" \n
  228. "" \n
  229. "_awaitingAmmo = true;"/*%FSM</ACTION""">*/;
  230. };
  231. /*%FSM</LINK>*/
  232. /*%FSM<LINK "Have___awaiting">*/
  233. class Have___awaiting
  234. {
  235. priority = 0.000000;
  236. to="Let_s_wait_here";
  237. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  238. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  239. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  240. };
  241. /*%FSM</LINK>*/
  242. };
  243. };
  244. /*%FSM</STATE>*/
  245. /*%FSM<STATE "Build_emplacement">*/
  246. class Build_emplacement
  247. {
  248. name = "Build_emplacement";
  249. init = /*%FSM<STATEINIT""">*/"_weapons = [];" \n
  250. "_objs = [];" \n
  251. "" \n
  252. "switch (_type) do" \n
  253. "{" \n
  254. " case ""scorcher"":" \n
  255. " {" \n
  256. " _weapon = [""B_MBT_01_arty_F"", _pos] call AW_fnc_createVehicle; _weapons = _weapons + [_weapon];" \n
  257. "" \n
  258. " _weapon lockDriver true;" \n
  259. "" \n
  260. " _dir = 45;" \n
  261. " for [{_c = 0}, {_c < 4}, {_c = _c + 1}] do" \n
  262. " {" \n
  263. " " \n
  264. " _relPos = [_pos, 5, _dir] call BIS_fnc_relPos;" \n
  265. " _obj = [""Land_BagFence_Round_F"", _relPos, (_dir - 180)] call AW_fnc_createVehicle;" \n
  266. " _objs = _objs + [_obj];" \n
  267. "" \n
  268. " _dir = _dir + 90;" \n
  269. " };" \n
  270. " };" \n
  271. "" \n
  272. " case ""mlrs"":" \n
  273. " {" \n
  274. " _weapon = [""B_MBT_01_mlrs_F"", _pos] call AW_fnc_createVehicle; _weapons = _weapons + [_weapon];" \n
  275. "" \n
  276. " _weapon lockDriver true;" \n
  277. "" \n
  278. " _dir = 45;" \n
  279. " for [{_c = 0}, {_c < 4}, {_c = _c + 1}] do" \n
  280. " {" \n
  281. " " \n
  282. " _relPos = [_pos, 5, _dir] call BIS_fnc_relPos;" \n
  283. " _obj = [""Land_BagFence_Round_F"", _relPos, (_dir - 180)] call AW_fnc_createVehicle;" \n
  284. " _objs = _objs + [_obj];" \n
  285. "" \n
  286. " _dir = _dir + 90;" \n
  287. " };" \n
  288. " };" \n
  289. "" \n
  290. " default" \n
  291. " {" \n
  292. " _weapon = [""B_Mortar_01_F"", [(_pos select 0) - 1, _pos select 1, _pos select 2]] call AW_fnc_createVehicle; _weapons = _weapons + [_weapon];" \n
  293. " _weapon = [""B_Mortar_01_F"", [(_pos select 0) + 1, _pos select 1, _pos select 2], 180] call AW_fnc_createVehicle; _weapons = _weapons + [_weapon];" \n
  294. " { _x setVehicleAmmo 0.1; } forEach _weapons;" \n
  295. "" \n
  296. " _dir = 45;" \n
  297. " for [{_c = 0}, {_c < 4}, {_c = _c + 1}] do" \n
  298. " {" \n
  299. " " \n
  300. " _relPos = [_pos, 3, _dir] call BIS_fnc_relPos;" \n
  301. " _obj = [""Land_BagFence_Round_F"", _relPos, (_dir - 180)] call AW_fnc_createVehicle;" \n
  302. " _objs = _objs + [_obj];" \n
  303. "" \n
  304. " _dir = _dir + 90;" \n
  305. " };" \n
  306. " };" \n
  307. "};" \n
  308. "" \n
  309. "_counter = 1;" \n
  310. "" \n
  311. "_tmp = _weapons;" \n
  312. "" \n
  313. "{" \n
  314. " _weapons = _weapons - [_x];" \n
  315. "" \n
  316. " _varName = format[""%1_weapon_%2"", _marker, _counter];" \n
  317. " _x setVehicleVarName _varName;" \n
  318. " _x call compile format" \n
  319. " [" \n
  320. " """ \n
  321. " %1=_This;" \n
  322. " publicVariable """"%1"""";" \n
  323. "" \n
  324. " _weapons = _weapons + [%1];" \n
  325. " ""," \n
  326. " _varName" \n
  327. " ];" \n
  328. "" \n
  329. " call compile format" \n
  330. " [" \n
  331. " """ \n
  332. " %1_weapon_respawn_%2 = [_x] execVM """"external\vehicle.sqf"""";" \n
  333. " _respawnHandles = _respawnHandles + [%1_weapon_respawn_%2];" \n
  334. " ""," \n
  335. " _marker," \n
  336. " _counter" \n
  337. " ];" \n
  338. "" \n
  339. " _counter = _counter + 1;" \n
  340. "} forEach _tmp;" \n
  341. "" \n
  342. "_markers = [""emplacement"", _marker, _pos, _name] call AW_fnc_createJIPstateMarker;" \n
  343. "[[""type"", ""emplacement_created""], [""message"", _name], [""global"", true]] call AW_fnc_showNotification;"/*%FSM</STATEINIT""">*/;
  344. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  345. class Links
  346. {
  347. /*%FSM<LINK "Right_then___">*/
  348. class Right_then___
  349. {
  350. priority = 0.000000;
  351. to="Let_s_wait_here";
  352. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  353. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  354. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  355. };
  356. /*%FSM</LINK>*/
  357. };
  358. };
  359. /*%FSM</STATE>*/
  360. /*%FSM<STATE "Spawn_attacking">*/
  361. class Spawn_attacking
  362. {
  363. name = "Spawn_attacking";
  364. init = /*%FSM<STATEINIT""">*/"_attackers = [EAST, round(1 + random(2)), _pos, [500, 1500]] call AW_fnc_spawnEnemy;" \n
  365. "[_attackers, [[""attack"", _pos, 50]]] call AW_fnc_setBehaviour;" \n
  366. "" \n
  367. "[[""emplacement"", ""defending""], _marker, _pos, _name] call AW_fnc_createJIPstateMarker;" \n
  368. "[[""type"", ""emplacement_underattack""], [""message"", _name], [""global"", true]] call AW_fnc_showNotification;"/*%FSM</STATEINIT""">*/;
  369. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  370. class Links
  371. {
  372. /*%FSM<LINK "Wait_for_the_che">*/
  373. class Wait_for_the_che
  374. {
  375. priority = 0.000000;
  376. to="Wait___";
  377. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  378. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  379. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  380. };
  381. /*%FSM</LINK>*/
  382. };
  383. };
  384. /*%FSM</STATE>*/
  385. /*%FSM<STATE "Let_s_wait_here">*/
  386. class Let_s_wait_here
  387. {
  388. name = "Let_s_wait_here";
  389. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  390. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  391. class Links
  392. {
  393. /*%FSM<LINK "Attack_">*/
  394. class Attack_
  395. {
  396. priority = 1.000000;
  397. to="Spawn_attacking";
  398. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  399. condition=/*%FSM<CONDITION""">*/"time >= _attackTimeout"/*%FSM</CONDITION""">*/;
  400. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  401. };
  402. /*%FSM</LINK>*/
  403. /*%FSM<LINK "Time_to_check">*/
  404. class Time_to_check
  405. {
  406. priority = 0.000000;
  407. to="Check_ammo";
  408. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  409. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  410. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  411. };
  412. /*%FSM</LINK>*/
  413. };
  414. };
  415. /*%FSM</STATE>*/
  416. /*%FSM<STATE "Wait___">*/
  417. class Wait___
  418. {
  419. name = "Wait___";
  420. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  421. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  422. class Links
  423. {
  424. /*%FSM<LINK "Do_the_checks">*/
  425. class Do_the_checks
  426. {
  427. priority = 0.000000;
  428. to="Check";
  429. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  430. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  431. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  432. };
  433. /*%FSM</LINK>*/
  434. };
  435. };
  436. /*%FSM</STATE>*/
  437. /*%FSM<STATE "Check">*/
  438. class Check
  439. {
  440. name = "Check";
  441. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  442. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  443. class Links
  444. {
  445. /*%FSM<LINK "Enemy_defeated">*/
  446. class Enemy_defeated
  447. {
  448. priority = 0.000000;
  449. to="Let_s_wait_here";
  450. precondition = /*%FSM<CONDPRECONDITION""">*/"private[""_enemiesDead""];" \n
  451. "" \n
  452. "_enemiesDead = true;" \n
  453. "{" \n
  454. " if (typeName _x == ""GROUP"") then" \n
  455. " {" \n
  456. " {" \n
  457. " if (alive _x) exitWith { _enemiesDead = false; };" \n
  458. " } forEach (units _x);" \n
  459. " };" \n
  460. "" \n
  461. " if (!_enemiesDead) exitWith {};" \n
  462. "} forEach _attackers;"/*%FSM</CONDPRECONDITION""">*/;
  463. condition=/*%FSM<CONDITION""">*/"_enemiesDead"/*%FSM</CONDITION""">*/;
  464. action=/*%FSM<ACTION""">*/"_attackTimeout = time + (3600 + random(10800));" \n
  465. "" \n
  466. "[[""emplacement"", ""friendly""], _marker, _pos, _name] call AW_fnc_createJIPstateMarker;" \n
  467. "[[""type"", ""emplacement_defended""], [""message"", _name], [""global"", true]] call AW_fnc_showNotification;"/*%FSM</ACTION""">*/;
  468. };
  469. /*%FSM</LINK>*/
  470. /*%FSM<LINK "Nothing_yet">*/
  471. class Nothing_yet
  472. {
  473. priority = 0.000000;
  474. to="Wait___";
  475. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  476. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  477. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  478. };
  479. /*%FSM</LINK>*/
  480. /*%FSM<LINK "No_players_remai">*/
  481. class No_players_remai
  482. {
  483. priority = 0.000000;
  484. to="That_s_it__The_End";
  485. precondition = /*%FSM<CONDPRECONDITION""">*/"_friendliesAbsent = true;" \n
  486. "_emplacementTaken = false;" \n
  487. "" \n
  488. "{" \n
  489. " if (alive _x && (_x distance _pos) < 100) exitWith { _friendliesAbsent = false; };" \n
  490. "} forEach playableUnits;" \n
  491. "" \n
  492. "if (_friendliesAbsent) then" \n
  493. "{" \n
  494. " {" \n
  495. " if (typeName _x == ""GROUP"") then" \n
  496. " {" \n
  497. " {" \n
  498. " if (alive _x && (_x distance _pos) < 50) exitWith { _emplacementTaken = true; };" \n
  499. " } forEach (units _x);" \n
  500. " };" \n
  501. " } forEach _attackers;" \n
  502. "};"/*%FSM</CONDPRECONDITION""">*/;
  503. condition=/*%FSM<CONDITION""">*/"_emplacementTaken"/*%FSM</CONDITION""">*/;
  504. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  505. };
  506. /*%FSM</LINK>*/
  507. };
  508. };
  509. /*%FSM</STATE>*/
  510. /*%FSM<STATE "That_s_it__The_End">*/
  511. class That_s_it__The_End
  512. {
  513. name = "That_s_it__The_End";
  514. init = /*%FSM<STATEINIT""">*/"[_markers] call AW_fnc_deleteMarker;" \n
  515. "[[""type"", ""emplacement_lost""], [""message"", _name], [""global"", true]] call AW_fnc_showNotification;" \n
  516. "" \n
  517. "if ((count _respawnHandles) > 0) then" \n
  518. "{" \n
  519. " {" \n
  520. " terminate _x;" \n
  521. " } forEach _respawnHandles;" \n
  522. "};" \n
  523. "" \n
  524. "(_weapons + _objs + _attackers) call AW_fnc_collectGarbage;"/*%FSM</STATEINIT""">*/;
  525. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  526. class Links
  527. {
  528. };
  529. };
  530. /*%FSM</STATE>*/
  531. /*%FSM<STATE "Create_Ammo_Truc">*/
  532. class Create_Ammo_Truc
  533. {
  534. name = "Create_Ammo_Truc";
  535. init = /*%FSM<STATEINIT""">*/"_truck = [""B_Truck_01_box_F"", _pos] call AW_fnc_baseSpawn;" \n
  536. "_awaitingAmmo = true;"/*%FSM</STATEINIT""">*/;
  537. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  538. class Links
  539. {
  540. /*%FSM<LINK "Truck_failed_to">*/
  541. class Truck_failed_to
  542. {
  543. priority = 1.000000;
  544. to="Let_s_wait_here";
  545. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  546. condition=/*%FSM<CONDITION""">*/"isNull _truck"/*%FSM</CONDITION""">*/;
  547. action=/*%FSM<ACTION""">*/"_truck = objNull;" \n
  548. "_awaitingAmmo = false;"/*%FSM</ACTION""">*/;
  549. };
  550. /*%FSM</LINK>*/
  551. /*%FSM<LINK "Show_notificatio">*/
  552. class Show_notificatio
  553. {
  554. priority = 0.000000;
  555. to="Let_s_wait_here";
  556. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  557. condition=/*%FSM<CONDITION""">*/"alive _truck"/*%FSM</CONDITION""">*/;
  558. action=/*%FSM<ACTION""">*/"[" \n
  559. " [""type"", ""emplacement_ammo""]," \n
  560. " [""message"", _name]," \n
  561. " [""detail"", ([_truck] call AW_fnc_findNearestBase)]," \n
  562. " [""global"", true]" \n
  563. "] call AW_fnc_showNotification;" \n
  564. "" \n
  565. "[_truck, [""emplacement"", ""truck""]] call AW_fnc_attachMarker;"/*%FSM</ACTION""">*/;
  566. };
  567. /*%FSM</LINK>*/
  568. };
  569. };
  570. /*%FSM</STATE>*/
  571. };
  572. initState="Initialise_Empla";
  573. finalStates[] =
  574. {
  575. "That_s_it__The_End",
  576. };
  577. };
  578. /*%FSM</COMPILE>*/