main.fsm 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. /*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Main AO">*/
  2. /*%FSM<HEAD>*/
  3. /*
  4. item0[] = {"Create_Main_AO",0,250,50.000000,100.000000,150.000000,150.000000,0.000000,"Create" \n "Main AO"};
  5. item1[] = {"true",8,218,175.000000,100.000000,275.000000,150.000000,0.000000,"true"};
  6. item2[] = {"Find_Random_Loca",2,250,175.000000,175.000000,275.000000,225.000000,0.000000,"Find" \n "Random" \n "Location"};
  7. item3[] = {"In_last_5_targets",4,218,300.000000,175.000000,400.000000,225.000000,3.000000,"In last 5" \n "targets?"};
  8. item4[] = {"Players_within_1km",4,218,175.000000,250.000000,275.000000,300.000000,2.000000,"Players within" \n "1km?"};
  9. item5[] = {"Location_found",8,218,50.000000,175.000000,150.000000,225.000000,1.000000,"Location" \n "found"};
  10. item6[] = {"Create_Enemies",2,250,50.000000,250.000000,150.000000,300.000000,0.000000,"Create" \n "Enemies"};
  11. item7[] = {"Is_coastal_town",4,218,-75.000000,250.000000,25.000000,300.000000,2.000000,"Is" \n "coastal" \n "town?"};
  12. item8[] = {"Create_Enemy_Boat",2,250,-75.000000,325.000000,25.000000,375.000000,0.000000,"Create" \n "Enemy" \n "Boat Patrols"};
  13. item9[] = {"Finished_creatin",8,218,-75.000000,400.000000,25.000000,450.000000,0.000000,"Finished" \n "creating"};
  14. item10[] = {"Finished_creatin",8,218,50.000000,325.000000,150.000000,375.000000,0.000000,"Finished" \n "creating"};
  15. item11[] = {"Create_Task___Ma",2,250,50.000000,400.000000,150.000000,450.000000,0.000000,"Create" \n "Task &" \n "Marker"};
  16. item12[] = {"Task_sent_to_all",8,218,175.000000,400.000000,275.000000,450.000000,0.000000,"Task" \n "sent to all" \n "players"};
  17. item13[] = {"Choose_Sub_objec",2,250,300.000000,400.000000,400.000000,450.000000,0.000000,"Choose" \n "Sub-objective"};
  18. item14[] = {"sub__objective_c",8,218,425.000000,400.000000,525.000000,450.000000,0.000000,"sub-" \n "objective" \n "chosen"};
  19. item15[] = {"Trigger_clean_up",2,250,425.000000,100.000000,525.000000,150.000000,0.000000,"Trigger" \n "clean-up" \n "scripts"};
  20. item16[] = {"Wait_random_time",4,218,300.000000,100.000000,400.000000,150.000000,0.000000,"Wait" \n "random" \n "time"};
  21. item17[] = {"Wait_for_complet",2,250,425.000000,325.000000,525.000000,375.000000,0.000000,"Wait" \n "for" \n "completion"};
  22. item18[] = {"Next_check_",4,218,425.000000,250.000000,525.000000,300.000000,0.000000,"Next" \n "check?"};
  23. item19[] = {"Do_the_checks",2,250,425.000000,175.000000,525.000000,225.000000,0.000000,"Do" \n "the" \n "checks"};
  24. item20[] = {"Sub__objective_not",4,218,300.000000,250.000000,400.000000,300.000000,5.000000,"Sub-" \n "objective not" \n "complete?"};
  25. item21[] = {"Mission_over",8,4314,550.000000,100.000000,650.000000,150.000000,0.000000,"Mission" \n "over"};
  26. item22[] = {"Enemy_not_below",4,218,550.000000,250.000000,650.000000,300.000000,4.000000,"Enemy" \n "not below" \n "threshold?"};
  27. link0[] = {0,1};
  28. link1[] = {1,2};
  29. link2[] = {2,3};
  30. link3[] = {2,4};
  31. link4[] = {2,5};
  32. link5[] = {3,2};
  33. link6[] = {4,2};
  34. link7[] = {5,6};
  35. link8[] = {6,7};
  36. link9[] = {6,10};
  37. link10[] = {7,8};
  38. link11[] = {8,9};
  39. link12[] = {9,11};
  40. link13[] = {10,11};
  41. link14[] = {11,12};
  42. link15[] = {12,13};
  43. link16[] = {13,14};
  44. link17[] = {14,17};
  45. link18[] = {15,16};
  46. link19[] = {16,2};
  47. link20[] = {17,18};
  48. link21[] = {18,19};
  49. link22[] = {19,20};
  50. link23[] = {19,21};
  51. link24[] = {19,22};
  52. link25[] = {20,17};
  53. link26[] = {21,15};
  54. link27[] = {22,17};
  55. globals[] = {25.000000,1,0,0,0,640,480,1,57,6316128,1,-230.966644,703.784546,635.231201,-7.530579,970,667,1};
  56. window[] = {0,-1,-1,-1,-1,885,2751,4368,72,1,988};
  57. *//*%FSM</HEAD>*/
  58. class FSM
  59. {
  60. fsmName = "Main AO";
  61. class States
  62. {
  63. /*%FSM<STATE "Create_Main_AO">*/
  64. class Create_Main_AO
  65. {
  66. name = "Create_Main_AO";
  67. init = /*%FSM<STATEINIT""">*/"_previousLocations = [];" \n
  68. "_locations = _this select 0;" \n
  69. "_number = 0;" \n
  70. "_sub_number = 0;" \n
  71. "_priority = 10;" \n
  72. "" \n
  73. "_sub_missions = [""AW_sub""] call BIS_fnc_getCfgSubClasses;"/*%FSM</STATEINIT""">*/;
  74. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  75. class Links
  76. {
  77. /*%FSM<LINK "true">*/
  78. class true
  79. {
  80. priority = 0.000000;
  81. to="Find_Random_Loca";
  82. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  83. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  84. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  85. };
  86. /*%FSM</LINK>*/
  87. };
  88. };
  89. /*%FSM</STATE>*/
  90. /*%FSM<STATE "Find_Random_Loca">*/
  91. class Find_Random_Loca
  92. {
  93. name = "Find_Random_Loca";
  94. init = /*%FSM<STATEINIT""">*/"//find location here" \n
  95. "_location = _locations call bis_fnc_selectRandom;"/*%FSM</STATEINIT""">*/;
  96. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  97. class Links
  98. {
  99. /*%FSM<LINK "In_last_5_targets">*/
  100. class In_last_5_targets
  101. {
  102. priority = 3.000000;
  103. to="Find_Random_Loca";
  104. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  105. condition=/*%FSM<CONDITION""">*/"_location in _previousLocations"/*%FSM</CONDITION""">*/;
  106. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  107. };
  108. /*%FSM</LINK>*/
  109. /*%FSM<LINK "Players_within_1km">*/
  110. class Players_within_1km
  111. {
  112. priority = 2.000000;
  113. to="Find_Random_Loca";
  114. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  115. condition=/*%FSM<CONDITION""">*/"({(_x distance (getMarkerPos _location)) < 1000} count playableUnits) > 0"/*%FSM</CONDITION""">*/;
  116. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  117. };
  118. /*%FSM</LINK>*/
  119. /*%FSM<LINK "Location_found">*/
  120. class Location_found
  121. {
  122. priority = 1.000000;
  123. to="Create_Enemies";
  124. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  125. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  126. action=/*%FSM<ACTION""">*/"_previousLocations = _previousLocations + [_location];" \n
  127. "" \n
  128. "if ((count _previousLocations) > 5) then" \n
  129. "{" \n
  130. " _previousLocations = _previousLocations - [_previousLocations select 0];" \n
  131. "};" \n
  132. "" \n
  133. "_pos = getMarkerPos _location;" \n
  134. "_number = _number + 1;"/*%FSM</ACTION""">*/;
  135. };
  136. /*%FSM</LINK>*/
  137. };
  138. };
  139. /*%FSM</STATE>*/
  140. /*%FSM<STATE "Create_Enemies">*/
  141. class Create_Enemies
  142. {
  143. name = "Create_Enemies";
  144. init = /*%FSM<STATEINIT""">*/"_spawnedUnits = [EAST, 25, _pos, 600] call AW_fnc_spawnEnemy;" \n
  145. "[_spawnedUnits, [[""patrol"", true, 200]]] call AW_fnc_setBehaviour;"/*%FSM</STATEINIT""">*/;
  146. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  147. class Links
  148. {
  149. /*%FSM<LINK "Is_coastal_town">*/
  150. class Is_coastal_town
  151. {
  152. priority = 2.000000;
  153. to="Create_Enemy_Boat";
  154. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  155. condition=/*%FSM<CONDITION""">*/"false"/*%FSM</CONDITION""">*/;
  156. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  157. };
  158. /*%FSM</LINK>*/
  159. /*%FSM<LINK "Finished_creatin">*/
  160. class Finished_creatin
  161. {
  162. priority = 0.000000;
  163. to="Create_Task___Ma";
  164. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  165. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  166. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  167. };
  168. /*%FSM</LINK>*/
  169. };
  170. };
  171. /*%FSM</STATE>*/
  172. /*%FSM<STATE "Create_Enemy_Boat">*/
  173. class Create_Enemy_Boat
  174. {
  175. name = "Create_Enemy_Boat";
  176. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  177. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  178. class Links
  179. {
  180. /*%FSM<LINK "Finished_creatin">*/
  181. class Finished_creatin
  182. {
  183. priority = 0.000000;
  184. to="Create_Task___Ma";
  185. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  186. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  187. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  188. };
  189. /*%FSM</LINK>*/
  190. };
  191. };
  192. /*%FSM</STATE>*/
  193. /*%FSM<STATE "Create_Task___Ma">*/
  194. class Create_Task___Ma
  195. {
  196. name = "Create_Task___Ma";
  197. init = /*%FSM<STATEINIT""">*/"//DEBUG - Remove BIS_fnc_setTask notification setting!" \n
  198. "//[""main"", true, [format[""Take and hold %1, eliminating forces in the area and completing any objectives HQ sees fit along the way."", _location], format[""Invade %1"", _location], _location], _pos, ""CREATED"", _priority, false, true] call BIS_fnc_setTask;" \n
  199. "" \n
  200. "_name = getText (missionConfigFile >> ""AW_main"" >> _location >> ""title"");" \n
  201. "" \n
  202. "[[""type"", ""main_created""], [""message"", _name], [""global"", true]] call AW_fnc_showNotification;" \n
  203. "_markers = [""main"", format[""main_%1"", _number], _pos, _name] call AW_fnc_createJIPstateMarker;"/*%FSM</STATEINIT""">*/;
  204. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  205. class Links
  206. {
  207. /*%FSM<LINK "Task_sent_to_all">*/
  208. class Task_sent_to_all
  209. {
  210. priority = 0.000000;
  211. to="Choose_Sub_objec";
  212. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  213. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  214. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  215. };
  216. /*%FSM</LINK>*/
  217. };
  218. };
  219. /*%FSM</STATE>*/
  220. /*%FSM<STATE "Choose_Sub_objec">*/
  221. class Choose_Sub_objec
  222. {
  223. name = "Choose_Sub_objec";
  224. init = /*%FSM<STATEINIT""">*/"_reverse = (PARAMS_main_minSubObjectivesToSpawn > PARAMS_main_maxSubObjectivesToSpawn);" \n
  225. "" \n
  226. "_sub_count = if (_reverse) then" \n
  227. "{" \n
  228. " (floor (PARAMS_main_maxSubObjectivesToSpawn + (random (PARAMS_main_minSubObjectivesToSpawn - PARAMS_main_maxSubObjectivesToSpawn))))" \n
  229. "} else {" \n
  230. " (floor (PARAMS_main_minSubObjectivesToSpawn + (random (PARAMS_main_maxSubObjectivesToSpawn - PARAMS_main_minSubObjectivesToSpawn))))" \n
  231. "};" \n
  232. "" \n
  233. "_subs = [];" \n
  234. "" \n
  235. "for ""_i"" from 1 to _sub_count do" \n
  236. "{" \n
  237. " _sub_mission = _sub_missions call BIS_fnc_selectRandom;" \n
  238. " _sub = [""sub"", [_sub_mission]] execFSM ""machines\mission.fsm"";" \n
  239. "" \n
  240. " _subs = _subs + [_sub];" \n
  241. "};"/*%FSM</STATEINIT""">*/;
  242. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  243. class Links
  244. {
  245. /*%FSM<LINK "sub__objective_c">*/
  246. class sub__objective_c
  247. {
  248. priority = 0.000000;
  249. to="Wait_for_complet";
  250. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  251. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  252. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  253. };
  254. /*%FSM</LINK>*/
  255. };
  256. };
  257. /*%FSM</STATE>*/
  258. /*%FSM<STATE "Trigger_clean_up">*/
  259. class Trigger_clean_up
  260. {
  261. name = "Trigger_clean_up";
  262. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (30 + (round (random 90))));" \n
  263. "//DEBUG TIME"/*%FSM</STATEINIT""">*/;
  264. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  265. class Links
  266. {
  267. /*%FSM<LINK "Wait_random_time">*/
  268. class Wait_random_time
  269. {
  270. priority = 0.000000;
  271. to="Find_Random_Loca";
  272. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  273. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  274. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  275. };
  276. /*%FSM</LINK>*/
  277. };
  278. };
  279. /*%FSM</STATE>*/
  280. /*%FSM<STATE "Wait_for_complet">*/
  281. class Wait_for_complet
  282. {
  283. name = "Wait_for_complet";
  284. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  285. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  286. class Links
  287. {
  288. /*%FSM<LINK "Next_check_">*/
  289. class Next_check_
  290. {
  291. priority = 0.000000;
  292. to="Do_the_checks";
  293. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  294. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  295. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  296. };
  297. /*%FSM</LINK>*/
  298. };
  299. };
  300. /*%FSM</STATE>*/
  301. /*%FSM<STATE "Do_the_checks">*/
  302. class Do_the_checks
  303. {
  304. name = "Do_the_checks";
  305. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  306. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  307. class Links
  308. {
  309. /*%FSM<LINK "Sub__objective_not">*/
  310. class Sub__objective_not
  311. {
  312. priority = 5.000000;
  313. to="Wait_for_complet";
  314. precondition = /*%FSM<CONDPRECONDITION""">*/"_subs_done = true;" \n
  315. "" \n
  316. "{" \n
  317. " if (!(CompletedFSM _x)) exitWith" \n
  318. " {" \n
  319. " _subs_done = false;" \n
  320. " };" \n
  321. "} forEach _subs;"/*%FSM</CONDPRECONDITION""">*/;
  322. condition=/*%FSM<CONDITION""">*/"!_subs_done"/*%FSM</CONDITION""">*/;
  323. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  324. };
  325. /*%FSM</LINK>*/
  326. /*%FSM<LINK "Enemy_not_below">*/
  327. class Enemy_not_below
  328. {
  329. priority = 4.000000;
  330. to="Wait_for_complet";
  331. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  332. condition=/*%FSM<CONDITION""">*/"({ side _x == EAST && (_x distance _pos) < 600 } count allUnits) > 5"/*%FSM</CONDITION""">*/;
  333. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  334. };
  335. /*%FSM</LINK>*/
  336. /*%FSM<LINK "Mission_over">*/
  337. class Mission_over
  338. {
  339. priority = 0.000000;
  340. to="Trigger_clean_up";
  341. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  342. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  343. action=/*%FSM<ACTION""">*/"//DEBUG - Don't show taskSetState notification!" \n
  344. "//[""main"", ""SUCCEEDED"", false] call BIS_fnc_taskSetState;" \n
  345. "[[""type"", ""main_completed""], [""message"", _name], [""global"", true]] call AW_fnc_showNotification;" \n
  346. "[_markers] call AW_fnc_deleteMarker;" \n
  347. "" \n
  348. "_priority = _priority + 10;"/*%FSM</ACTION""">*/;
  349. };
  350. /*%FSM</LINK>*/
  351. };
  352. };
  353. /*%FSM</STATE>*/
  354. };
  355. initState="Create_Main_AO";
  356. finalStates[] =
  357. {
  358. };
  359. };
  360. /*%FSM</COMPILE>*/