Advertisement
Guest User

Untitled

a guest
Nov 13th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.30 KB | None | 0 0
  1. --------------------------------------------------------------------------------------//** SERVER_CLEANUP **//
  2.  
  3. /*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
  4. /*%FSM<HEAD>*/
  5. /*
  6. item0[] = {"init",0,250,-75.000000,-400.000000,25.000000,-350.000000,0.000000,"init"};
  7. item1[] = {"true",8,218,-75.000000,-175.000000,25.000000,-125.000000,0.000000,"true"};
  8. item2[] = {"waiting",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"waiting"};
  9. item3[] = {"time_sync",4,218,-275.000000,-25.000000,-175.000000,25.000000,1.000000,"time" \n "sync"};
  10. item4[] = {"sync_the_time",2,4346,-275.000000,50.000000,-175.000000,100.000000,0.000000,"sync" \n "the time"};
  11. item5[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"};
  12. item6[] = {"general_cleanup",2,250,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup" \n "loop"};
  13. item7[] = {"",7,210,-304.000000,220.999985,-296.000000,229.000015,0.000000,""};
  14. item8[] = {"",7,210,-304.000000,-154.000000,-296.000000,-146.000000,0.000000,""};
  15. item9[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
  16. item10[] = {"",7,210,221.000000,146.000000,229.000000,154.000000,0.000000,""};
  17. item11[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"};
  18. item12[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"};
  19. item13[] = {"update_objects",2,250,100.000000,50.000000,200.000000,100.000000,0.000000,"update objects"};
  20. item14[] = {"need_update",4,218,100.000000,-25.000000,200.000000,25.000000,1.000000,"need update"};
  21. item15[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
  22. item16[] = {"cleanup_groups",4,218,-150.000000,-25.000000,-50.000000,25.000000,1.000000,"cleanup" \n "groups"};
  23. item17[] = {"group_cleanup",2,250,-150.000000,50.000000,-50.000000,100.000000,0.000000,"group" \n "cleanup"};
  24. item18[] = {"cleanup_vehicles",4,218,-25.000000,-25.000000,75.000000,25.000000,1.000000,"cleanup" \n "vehicles"};
  25. item19[] = {"vehicle_cleanup",2,250,-25.000000,50.000000,75.000000,100.000000,0.000000,"vehicle" \n "cleanup"};
  26. link0[] = {0,11};
  27. link1[] = {1,2};
  28. link2[] = {2,3};
  29. link3[] = {2,9};
  30. link4[] = {2,14};
  31. link5[] = {2,16};
  32. link6[] = {2,18};
  33. link7[] = {3,4};
  34. link8[] = {4,5};
  35. link9[] = {5,6};
  36. link10[] = {6,7};
  37. link11[] = {7,8};
  38. link12[] = {8,1};
  39. link13[] = {9,10};
  40. link14[] = {9,15};
  41. link15[] = {10,5};
  42. link16[] = {11,12};
  43. link17[] = {12,1};
  44. link18[] = {13,5};
  45. link19[] = {14,13};
  46. link20[] = {16,17};
  47. link21[] = {17,5};
  48. link22[] = {18,19};
  49. link23[] = {19,5};
  50. globals[] = {25.000000,1,0,0,0,640,480,1,30,6316128,1,-419.782135,377.473389,510.243530,-212.601486,675,612,1};
  51. window[] = {0,-1,-1,-1,-1,940,182,1460,182,1,693};
  52. *//*%FSM</HEAD>*/
  53. class FSM
  54. {
  55. fsmName = "DayZ Server Cleanup";
  56. class States
  57. {
  58. /*%FSM<STATE "init">*/
  59. class init
  60. {
  61. name = "init";
  62. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  63. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  64. class Links
  65. {
  66. /*%FSM<LINK "initialized">*/
  67. class initialized
  68. {
  69. priority = 0.000000;
  70. to="prepare";
  71. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  72. condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
  73. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  74. };
  75. /*%FSM</LINK>*/
  76. };
  77. };
  78. /*%FSM</STATE>*/
  79. /*%FSM<STATE "waiting">*/
  80. class waiting
  81. {
  82. name = "waiting";
  83. init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
  84. ""/*%FSM</STATEINIT""">*/;
  85. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  86. class Links
  87. {
  88. /*%FSM<LINK "need_update">*/
  89. class need_update
  90. {
  91. priority = 1.000000;
  92. to="update_objects";
  93. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  94. condition=/*%FSM<CONDITION""">*/"( (count needUpdate_objects) > 0 && (diag_tickTime -_lastNeedUpdate>40) )"/*%FSM</CONDITION""">*/;
  95. action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
  96. };
  97. /*%FSM</LINK>*/
  98. /*%FSM<LINK "cleanup_groups">*/
  99. class cleanup_groups
  100. {
  101. priority = 1.000000;
  102. to="group_cleanup";
  103. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  104. condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupGroups) > 10)"/*%FSM</CONDITION""">*/;
  105. action=/*%FSM<ACTION""">*/"_lastCleanupGroups = diag_tickTime;"/*%FSM</ACTION""">*/;
  106. };
  107. /*%FSM</LINK>*/
  108. /*%FSM<LINK "cleanup_vehicles">*/
  109. class cleanup_vehicles
  110. {
  111. priority = 1.000000;
  112. to="vehicle_cleanup";
  113. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  114. condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupVehicles) > 5)"/*%FSM</CONDITION""">*/;
  115. action=/*%FSM<ACTION""">*/"_lastCleanupVehicles = diag_tickTime;"/*%FSM</ACTION""">*/;
  116. };
  117. /*%FSM</LINK>*/
  118. /*%FSM<LINK "time_sync">*/
  119. class time_sync
  120. {
  121. priority = 1.000000;
  122. to="sync_the_time";
  123. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  124. condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
  125. action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
  126. };
  127. /*%FSM</LINK>*/
  128. /*%FSM<LINK "true">*/
  129. class true
  130. {
  131. priority = 0.000000;
  132. to="general_cleanup";
  133. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  134. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  135. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  136. };
  137. /*%FSM</LINK>*/
  138. };
  139. };
  140. /*%FSM</STATE>*/
  141. /*%FSM<STATE "sync_the_time">*/
  142. class sync_the_time
  143. {
  144. name = "sync_the_time";
  145. init = /*%FSM<STATEINIT""">*/"//Send request" \n
  146. "_key = ""CHILD:307:"";" \n
  147. "_result = _key call server_hiveReadWrite;" \n
  148. "_outcome = _result select 0;" \n
  149. "if(_outcome == ""PASS"") then {" \n
  150. " _date = _result select 1; " \n
  151. " " \n
  152. " if(dayz_fullMoonNights) then {" \n
  153. " //date setup" \n
  154. " _year = _date select 0;" \n
  155. " _month = _date select 1;" \n
  156. " _day = _date select 2;" \n
  157. " _hour = _date select 3;" \n
  158. " _minute = _date select 4;" \n
  159. " " \n
  160. " //Force full moon nights" \n
  161. " _date = [2013,6,12,_hour,_minute];" \n
  162. " };" \n
  163. "" \n
  164. " setDate _date;" \n
  165. " PVDZE_plr_SetDate = _date;" \n
  166. " publicVariable ""PVDZE_plr_SetDate"";" \n
  167. " diag_log (""TIME SYNC: Local Time set to "" + str(_date)); " \n
  168. "};" \n
  169. ""/*%FSM</STATEINIT""">*/;
  170. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  171. class Links
  172. {
  173. /*%FSM<LINK "true">*/
  174. class true
  175. {
  176. priority = 0.000000;
  177. to="general_cleanup";
  178. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  179. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  180. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  181. };
  182. /*%FSM</LINK>*/
  183. };
  184. };
  185. /*%FSM</STATE>*/
  186. /*%FSM<STATE "general_cleanup">*/
  187. class general_cleanup
  188. {
  189. name = "general_cleanup";
  190. init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Starting loop for next task"";"/*%FSM</STATEINIT""">*/;
  191. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  192. class Links
  193. {
  194. /*%FSM<LINK "true">*/
  195. class true
  196. {
  197. priority = 0.000000;
  198. to="waiting";
  199. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  200. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  201. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  202. };
  203. /*%FSM</LINK>*/
  204. };
  205. };
  206. /*%FSM</STATE>*/
  207. /*%FSM<STATE "prepare">*/
  208. class prepare
  209. {
  210. name = "prepare";
  211. init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
  212. "" \n
  213. "_safety = PVDZE_serverObjectMonitor;" \n
  214. "//_dateNow = (DateToNumber date);" \n
  215. "" \n
  216. "_lastUpdate = diag_tickTime;" \n
  217. "_lastNeedUpdate = diag_tickTime;" \n
  218. "_lastCleanupVehicles = diag_tickTime;" \n
  219. "_lastCleanupGroups = diag_tickTime;" \n
  220. ""/*%FSM</STATEINIT""">*/;
  221. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  222. class Links
  223. {
  224. /*%FSM<LINK "true">*/
  225. class true
  226. {
  227. priority = 0.000000;
  228. to="waiting";
  229. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  230. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  231. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  232. };
  233. /*%FSM</LINK>*/
  234. };
  235. };
  236. /*%FSM</STATE>*/
  237. /*%FSM<STATE "update_objects">*/
  238. class update_objects
  239. {
  240. name = "update_objects";
  241. init = /*%FSM<STATEINIT""">*/"//diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
  242. "{" \n
  243. " needUpdate_objects = needUpdate_objects - [_x];" \n
  244. " [_x,""all""] call server_updateObject;" \n
  245. "" \n
  246. "} forEach needUpdate_objects;"/*%FSM</STATEINIT""">*/;
  247. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  248. class Links
  249. {
  250. /*%FSM<LINK "true">*/
  251. class true
  252. {
  253. priority = 0.000000;
  254. to="general_cleanup";
  255. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  256. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  257. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  258. };
  259. /*%FSM</LINK>*/
  260. };
  261. };
  262. /*%FSM</STATE>*/
  263. /*%FSM<STATE "group_cleanup">*/
  264. class group_cleanup
  265. {
  266. name = "group_cleanup";
  267. init = /*%FSM<STATEINIT""">*/"//Clean groups" \n
  268. "{" \n
  269. " // diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n
  270. " if (count units _x==0) then {" \nif ((count units _x==0) && !(_x getVariable[""SAR_protect"",false])) then {" \n
  271. " deleteGroup _x;" \n
  272. " // diag_log (""CLEANUP: DELETING A GROUP"");" \n
  273. " };" \n
  274. "} forEach allGroups;" \n
  275. ""/*%FSM</STATEINIT""">*/;
  276. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  277. class Links
  278. {
  279. /*%FSM<LINK "true">*/
  280. class true
  281. {
  282. priority = 0.000000;
  283. to="general_cleanup";
  284. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  285. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  286. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  287. };
  288. /*%FSM</LINK>*/
  289. };
  290. };
  291. /*%FSM</STATE>*/
  292. /*%FSM<STATE "vehicle_cleanup">*/
  293. class vehicle_cleanup
  294. {
  295. name = "vehicle_cleanup";
  296. init = /*%FSM<STATEINIT""">*/"_safety = PVDZE_serverObjectMonitor;" \n
  297. "" \n
  298. "//Check for hackers" \n
  299. " {" \n
  300. " if(vehicle _x != _x && (vehicle _x getVariable [""Sarge"",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n //**MISSIONS**
  301. " // diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n // ** COMMENTED OUT FOR SARGE **
  302. " (vehicle _x) setDamage 1;" \n
  303. " _x setDamage 1;" \n
  304. " };" \n
  305. " } forEach allUnits;" \n
  306. "" \n
  307. "PVDZE_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/;
  308. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  309. class Links
  310. {
  311. /*%FSM<LINK "true">*/
  312. class true
  313. {
  314. priority = 0.000000;
  315. to="general_cleanup";
  316. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  317. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  318. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  319. };
  320. /*%FSM</LINK>*/
  321. };
  322. };
  323. /*%FSM</STATE>*/
  324. };
  325. initState="init";
  326. finalStates[] =
  327. {
  328. };
  329. };
  330. /*%FSM</COMPILE>*/
  331.  
  332. --------------------------------------------------------------------------//** SAR_cfg_grps_chernarus.sqf **//
  333.  
  334. // =========================================================================================================
  335. // SAR_AI - DayZ AI library
  336. // Version: 1.0.0
  337. // Author: Sarge ([email protected])
  338. //
  339. // Wiki: to come
  340. // Forum: to come
  341. //
  342. // ---------------------------------------------------------------------------------------------------------
  343. // Required:
  344. // UPSMon
  345. // SHK_pos
  346. //
  347. // ---------------------------------------------------------------------------------------------------------
  348. // area, group & spawn cfg file for Chernarus
  349. // last modified: 5.3.2013
  350. // ---------------------------------------------------------------------------------------------------------
  351.  
  352. /* reconfiguring the properties of the grid (keep in mind the grid has default settings, but these you should overwrite where needed.
  353.  
  354. IMPORTANT: The grid squares are named like : SAR_area_0_0
  355.  
  356. where the first 0 is the x counter, and the second 0 the y counter.
  357.  
  358. So to adress the bottom left square in the grid, you use SAR_area_0_0.
  359. The square above that one would be: SAR_area_0_1
  360. the square one to the right of the bottom left square is SAR_area_1_0
  361.  
  362. You want to change the number arrays in the below lines:
  363.  
  364. The order for these numbers is always [BANDIT, SURVIVOR, SOLDIER]
  365.  
  366. Lets take an example for Chernarus
  367.  
  368. // Kamenka, 0 bandit groups, 1 soldier groups, 2 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  369. _check = [["max_grps","rnd_grps","max_p_grp"],[[0,1,2],[0,75,100],[0,4,3]],"SAR_area_0_0"] call SAR_AI_mon_upd;
  370.  
  371. [[0,1,2],[0,75,100],[0,4,3]]
  372.  
  373. the first set of numbers : 0,1,2
  374. stands for
  375. 0 bandit groups
  376. 1 soldier group
  377. 2 surivors groups
  378. thats the max that can spawn in this grid
  379.  
  380. the second set of numbers : 0,75,100
  381. that means:
  382. 0% probability to spawn bandit groups
  383. 75% for soldiers
  384. 100% for survivors
  385.  
  386. the last set of numbers : 0,4,3
  387. thats the maximum number of ppl in the group (including the leader)
  388. 0 bandits
  389. max 4 soldiers
  390. max 3 survivors
  391. this number is randomized
  392.  
  393.  
  394. */
  395. //
  396. // grid definition for the automatic spawn system
  397. //
  398.  
  399. // Kamenka, 0 bandit groups, 1 soldier groups, 2 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  400. _check = [["max_grps","rnd_grps","max_p_grp"],[[4,1,2],[0,100,100],[0,2,1]],"SAR_area_0_0"] call SAR_AI_mon_upd;
  401.  
  402. // Balota, 1 bandit groups, 0 soldier groups, 2 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  403. _check = [["max_grps","rnd_grps","max_p_grp"],[[5,0,2],[80,0,80],[2,0,3]],"SAR_area_1_0"] call SAR_AI_mon_upd;
  404.  
  405. // Cherno, 2 bandit groups, 0 soldier groups, 3 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  406. _check = [["max_grps","rnd_grps","max_p_grp"],[[2,0,3],[75,0,75],[4,0,4]],"SAR_area_2_0"] call SAR_AI_mon_upd;
  407.  
  408. // Prido, 1 bandit groups, 0 soldier groups, 3 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  409. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,0,3],[50,0,50],[4,0,2]],"SAR_area_3_0"] call SAR_AI_mon_upd;
  410.  
  411. // Elektro, 2 bandit groups, 0 soldier groups, 3 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  412. _check = [["max_grps","rnd_grps","max_p_grp"],[[2,0,3],[50,0,50],[4,0,4]],"SAR_area_4_0"] call SAR_AI_mon_upd;
  413.  
  414. // Kamyshovo, 0 bandit groups, 0 soldier groups, 1 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  415. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,0,1],[0,0,80],[0,0,3]],"SAR_area_5_0"] call SAR_AI_mon_upd;
  416.  
  417. // Tulga, 0 bandit groups, 0 soldier groups, 1 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  418. _check = [["max_grps","rnd_grps","max_p_grp"],[[4,0,1],[0,0,80],[0,0,3]],"SAR_area_5_1"] call SAR_AI_mon_upd;
  419.  
  420. // Solni, 1 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  421. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,0,0],[80,0,0],[2,0,0]],"SAR_area_5_2"] call SAR_AI_mon_upd;
  422.  
  423. // Berezino, 0 bandit groups, 0 soldier groups, 3 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  424. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,0,3],[1,0,75],[0,0,3]],"SAR_area_5_3"] call SAR_AI_mon_upd;
  425.  
  426. // Khelm, 1 bandit groups, 0 soldier groups, 1 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  427. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,0,1],[75,0,75],[3,0,3]],"SAR_area_5_4"] call SAR_AI_mon_upd;
  428.  
  429. // NEAF, 0 bandit groups, 3 soldier groups, 1 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  430. _check = [["max_grps","rnd_grps","max_p_grp"],[[0,3,1],[0,50,75],[0,2,4]],"SAR_area_5_5"] call SAR_AI_mon_upd;
  431.  
  432. // NWAF, 0 bandit groups, 2 soldier groups, 1 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  433. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,2,1],[0,50,75],[0,2,4]],"SAR_area_1_4"] call SAR_AI_mon_upd;
  434.  
  435. // Stary, 3 bandit groups, 0 soldier groups, 3 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  436. _check = [["max_grps","rnd_grps","max_p_grp"],[[3,0,3],[50,0,50],[3,0,3]],"SAR_area_2_2"] call SAR_AI_mon_upd;
  437.  
  438. // Devils Castle, 2 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  439. _check = [["max_grps","rnd_grps","max_p_grp"],[[2,0,0],[75,0,0],[3,0,0]],"SAR_area_2_4"] call SAR_AI_mon_upd;
  440.  
  441. // Skalka, 1 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  442. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,0,0],[75,0,0],[3,0,0]],"SAR_area_0_5"] call SAR_AI_mon_upd;
  443.  
  444. // Petrovka1, 2 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  445. _check = [["max_grps","rnd_grps","max_p_grp"],[[2,0,0],[75,0,0],[3,0,0]],"SAR_area_1_5"] call SAR_AI_mon_upd;
  446.  
  447. // Petrovka2, 2 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  448. _check = [["max_grps","rnd_grps","max_p_grp"],[[2,0,0],[75,0,0],[3,0,0]],"SAR_area_2_5"] call SAR_AI_mon_upd;
  449.  
  450. // Pobeda, 2 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  451. _check = [["max_grps","rnd_grps","max_p_grp"],[[2,0,0],[75,0,0],[3,0,0]],"SAR_area_3_5"] call SAR_AI_mon_upd;
  452.  
  453. // Krasno, 0 bandit groups, 1 soldier groups, 1 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  454. _check = [["max_grps","rnd_grps","max_p_grp"],[[0,1,1],[0,75,75],[0,4,2]],"SAR_area_4_5"] call SAR_AI_mon_upd;
  455.  
  456. // test south of lopatino, 1 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
  457. _check = [["max_grps","rnd_grps","max_p_grp"],[[1,0,0],[100,0,0],[6,0,0]],"SAR_area_0_3"] call SAR_AI_mon_upd;
  458.  
  459.  
  460.  
  461.  
  462. //
  463. // Definition of area markers for static spawns
  464. //
  465.  
  466. // soutcoast, heli patrol area
  467. _this = createMarker ["SAR_patrol_soutcoast", [7997.2837, 2687.6707]];
  468. _this setMarkerShape "RECTANGLE";
  469. _this setMarkeralpha 0;
  470. _this setMarkerType "Flag";
  471. _this setMarkerBrush "Solid";
  472. _this setMarkerSize [6500, 1200];
  473. SAR_marker_helipatrol_southcoast = _this;
  474.  
  475. // eastcoast, heli patrol area
  476. _this = createMarker ["SAR_patrol_eastcoast", [13304.196, 8220.9795]];
  477. _this setMarkerShape "RECTANGLE";
  478. _this setMarkeralpha 0;
  479. _this setMarkerType "Flag";
  480. _this setMarkerBrush "Solid";
  481. _this setMarkerSize [1200, 6000];
  482. SAR_marker_helipatrol_eastcoast = _this;
  483.  
  484. // NWAF, heli patrol area
  485. _this = createMarker ["SAR_patrol_NWAF", [4525.3335, 10292.299]];
  486. _this setMarkerShape "RECTANGLE";
  487. _this setMarkeralpha 0;
  488. _this setMarkerType "Flag";
  489. _this setMarkerBrush "Solid";
  490. _this setMarkerSize [1500, 500];
  491. _this setMarkerDir 59.354115;
  492. SAR_marker_helipatrol_nwaf = _this;
  493.  
  494. // NEAF, heli patrol area
  495. _this = createMarker ["SAR_patrol_NEAF", [12034.16, 12725.376, 0]];
  496. _this setMarkerShape "RECTANGLE";
  497. _this setMarkeralpha 0;
  498. _this setMarkerType "Flag";
  499. _this setMarkerBrush "Solid";
  500. _this setMarkerSize [1000, 600];
  501. SAR_marker_helipatrol_neaf = _this;
  502.  
  503.  
  504. // SAR DEBUG AREA - at NWAF
  505. _this = createMarker ["SAR_marker_DEBUG", [4600.3335, 10240.299]];
  506. _this setMarkerShape "RECTANGLE";
  507. _this setMarkeralpha 1;
  508. _this setMarkerType "Flag";
  509. _this setMarkerBrush "Solid";
  510. _this setMarkerSize [100, 100];
  511. _this setMarkerDir 59.354115;
  512. SAR_marker_DEBUG = _this;
  513.  
  514. // SAR DEBUG AREA - at Skaly
  515. _this = createMarker ["SAR_marker_DEBUG1", [2519.3335, 13140.299]];
  516. _this setMarkerShape "RECTANGLE";
  517. _this setMarkeralpha 1;
  518. _this setMarkerType "Flag";
  519. _this setMarkerBrush "Solid";
  520. _this setMarkerSize [100, 100];
  521. SAR_marker_DEBUG1 = _this;
  522.  
  523. // ----------------------------------------------------------------------------------------
  524. // End of area marker definition section
  525. // ----------------------------------------------------------------------------------------
  526.  
  527. diag_log format["SAR_AI: Area & Trigger definition finalized"];
  528. diag_log format["SAR_AI: Static Spawning for Helicopter patrols started"];
  529.  
  530. //
  531. // Static, predefined heli patrol areas with configurable units
  532. //
  533. // Parameters used:
  534. // Areaname
  535. // 1,2,3 = soldier, survivors, bandits
  536. //
  537. // respawn
  538. // true or false
  539.  
  540. //Heli Patrol NWAF
  541. [SAR_marker_helipatrol_nwaf,1,true] call SAR_AI_heli;
  542.  
  543. //Heli Patrol NEAF
  544. [SAR_marker_helipatrol_neaf,1,true] call SAR_AI_heli;
  545.  
  546. // Heli patrol south coast
  547. [SAR_marker_helipatrol_southcoast,1,true] call SAR_AI_heli;
  548. [SAR_marker_helipatrol_southcoast,1,true] call SAR_AI_heli;
  549.  
  550. // heli patrol east coast
  551. [SAR_marker_helipatrol_eastcoast,1,true] call SAR_AI_heli;
  552. [SAR_marker_helipatrol_eastcoast,1,true] call SAR_AI_heli;
  553.  
  554. diag_log format["SAR_AI: Static Spawning for Helicopter patrols finished"];
  555.  
  556. //---------------------------------------------------------------------------------
  557. // Static, predefined infantry patrols in defined areas with configurable units
  558. //---------------------------------------------------------------------------------
  559. // Example: [SAR_marker_DEBUG,1,0,1,"",true] call SAR_AI;
  560. //
  561. // SAR_marker_DEBUG = areaname (must have been defined further up, and MUST NOT BE similar to SAR_area_ ! THIS IS IMPORTANT!
  562. // 1 = type of group (1 = soldiers, 2 = survivors, 3 = bandits)
  563. // 0 = amount of snipers in the group
  564. // 1 = amount of rifleman in the group
  565. // "" = action, possible values: "noupsmon","fortify","ambush","patrol"
  566. // true = respawning group, true or false
  567.  
  568. // Example entries:
  569. // SARGE DEBUG - Debug group
  570. // military, 0 snipers, 1 riflemen, patrol
  571. //[SAR_marker_DEBUG,1,0,1,"fortify",true] call SAR_AI;
  572.  
  573. //[SAR_marker_DEBUG1,1,0,2,"patrol",false] call SAR_AI;
  574. //[SAR_marker_DEBUG1,2,0,2,"patrol",false] call SAR_AI;
  575.  
  576. //---------------------------------------------------------------------------------
  577.  
  578. // add here if needed
  579.  
  580.  
  581.  
  582.  
  583. // ---- end of configuration area ----
  584.  
  585. diag_log format["SAR_AI: Static Spawning for infantry and heli patrols finished"];
  586.  
  587.  
  588. --------------------------------------------------------------------------------------//** SAR_AI_init.sqf**//
  589.  
  590. // =========================================================================================================
  591. // SAR_AI - DayZ AI library
  592. // Version: 1.1.0
  593. // Author: Sarge ([email protected])
  594. //
  595. // Wiki: to come
  596. // Forum: http://opendayz.net/index.php?threads/sarge-ai-framework-public-release.8391/
  597. //
  598. // ---------------------------------------------------------------------------------------------------------
  599. // Required:
  600. // UPSMon
  601. // SHK_pos
  602. //
  603. // ---------------------------------------------------------------------------------------------------------
  604. // SAR_AI_init.sqf - main init and control file of the framework
  605. // last modified: 1.4.2013
  606. // ---------------------------------------------------------------------------------------------------------
  607.  
  608. private ["_worldname","_startx","_starty","_gridsize_x","_gridsize_y","_gridwidth","_i","_ii","_markername","_triggername","_trig_act_stmnt","_trig_deact_stmnt","_trig_cond","_check","_grp","_script_handler"];
  609.  
  610. SAR_version = "1.1.0";
  611.  
  612. // establish PvEH on all clients
  613.  
  614. if (!isServer) then { // only run this on the connected clients
  615.  
  616. "adjustrating" addPublicVariableEventHandler {((_this select 1) select 0) addRating ((_this select 1) select 1); };
  617.  
  618. };
  619.  
  620.  
  621. if (!isServer) exitWith {}; // only run this on the server
  622.  
  623. diag_log "----------------------------------------";
  624. diag_log format["Starting SAR_AI version %1",SAR_version];
  625. diag_log "----------------------------------------";
  626.  
  627. // preprocessing relevant scripts
  628.  
  629. SAR_AI_heli = compile preprocessFileLineNumbers "addons\SARGE\SAR_setup_AI_patrol_heli.sqf";
  630. SAR_AI = compile preprocessFileLineNumbers "addons\SARGE\SAR_setup_AI_patrol.sqf";
  631.  
  632. // activate functions library
  633.  
  634. call compile preprocessFileLineNumbers "addons\SARGE\SAR_functions.sqf";
  635.  
  636. // Public Eventhandlers
  637.  
  638. "doMedicAnim" addPublicVariableEventHandler {((_this select 1) select 0) playActionNow ((_this select 1) select 1); };
  639.  
  640. //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  641.  
  642. //
  643. // include user config values
  644. //
  645.  
  646. #include "SAR_config.sqf"
  647.  
  648. //
  649. // make some config variables public
  650. //
  651.  
  652. publicvariable "SAR_surv_kill_value";
  653. publicvariable "SAR_band_kill_value";
  654. publicvariable "SAR_DEBUG";
  655. publicvariable "SAR_EXTREME_DEBUG";
  656. publicvariable "SAR_DETECT_HOSTILE";
  657. publicvariable "SAR_DETECT_INTERVAL";
  658. publicvariable "SAR_HUMANITY_HOSTILE_LIMIT";
  659.  
  660. //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  661.  
  662. // side definitions
  663. createCenter east;
  664. createCenter resistance;
  665.  
  666. // unfriendly AI bandits
  667. EAST setFriend [WEST, 0];
  668. EAST setFriend [RESISTANCE, 0];
  669.  
  670. // Players
  671. WEST setFriend [EAST, 0];
  672. WEST setFriend [RESISTANCE, 1];
  673.  
  674. // friendly AI
  675. RESISTANCE setFriend [EAST, 0];
  676. RESISTANCE setFriend [WEST, 1];
  677.  
  678. SAR_AI_friendly_side = resistance;
  679. SAR_AI_unfriendly_side = east;
  680.  
  681. SAR_leader_number = 0;
  682.  
  683.  
  684. diag_log format["SAR_AI: Area & Trigger definition Started"];
  685.  
  686. // Declaring AI monitor array
  687.  
  688. SAR_AI_monitor = [];
  689.  
  690. _worldname= toLower format["%1",worldName];
  691.  
  692. diag_log format["Setting up SAR_AI for : %1",_worldname];
  693.  
  694. //
  695. // Setup aremarker & trigger grid - DO NOT CHANGE
  696. //
  697.  
  698. // default gridvalues
  699. _startx=2500;
  700. _starty=2800;
  701. _gridsize_x=6;
  702. _gridsize_y=6;
  703. _gridwidth = 1000;
  704.  
  705. //
  706. // get grid configuration for the different maps
  707. //
  708.  
  709. switch (_worldname) do {
  710. case "chernarus":
  711. {
  712. #include "map_config\SAR_cfg_grid_chernarus.sqf"
  713. };
  714. case "tavi":
  715. {
  716. #include "map_config\SAR_cfg_grid_tavi.sqf"
  717. };
  718. case "namalsk":
  719. {
  720. #include "map_config\SAR_cfg_grid_namalsk.sqf"
  721. };
  722. case "lingor":
  723. {
  724. #include "map_config\SAR_cfg_grid_lingor.sqf"
  725. };
  726. case "mbg_celle2":
  727. {
  728. #include "map_config\SAR_cfg_grid_mbg_celle2.sqf"
  729. };
  730. case "takistan":
  731. {
  732. #include "map_config\SAR_cfg_grid_takistan.sqf"
  733. };
  734. case "fallujah":
  735. {
  736. #include "map_config\SAR_cfg_grid_fallujah.sqf"
  737. };
  738. case "panthera2":
  739. {
  740. #include "map_config\SAR_cfg_grid_panthera.sqf"
  741. };
  742.  
  743. };
  744.  
  745. //
  746. // Generate marker & trigger grid & activate it
  747. //
  748.  
  749. SAR_area_ = text format ["SAR_area_%1","x"];
  750.  
  751. for [{_i=0}, {_i < _gridsize_y}, {_i=_i+1}] do
  752. {
  753. for [{_ii=0}, {_ii < _gridsize_x}, {_ii=_ii+1}] do
  754. {
  755.  
  756. //
  757. // Define marker area
  758. //
  759.  
  760. _markername = format["SAR_area_%1_%2",_ii,_i];
  761.  
  762. _this = createMarker[_markername,[_startx + (_ii * _gridwidth * 2),_starty + (_i * _gridwidth * 2)]];
  763. if(SAR_DEBUG || SAR_EXTREME_DEBUG) then {
  764. _this setMarkerAlpha 1;
  765. } else {
  766. _this setMarkerAlpha 0;
  767. };
  768. _this setMarkerShape "RECTANGLE";
  769. _this setMarkerType "Flag";
  770. _this setMarkerBrush "BORDER";
  771. _this setMarkerSize [_gridwidth, _gridwidth];
  772.  
  773. Call Compile Format ["SAR_area_%1_%2 = _this",_ii,_i];
  774.  
  775. if (SAR_dynamic_spawning) then {
  776.  
  777. //
  778. // Define trigger area & conditions & actions
  779. //
  780.  
  781. _triggername = format["SAR_trig_%1_%2",_ii,_i];
  782.  
  783. _this = createTrigger ["EmptyDetector", [_startx + (_ii * _gridwidth * 2),_starty + (_i * _gridwidth * 2)]];
  784. _this setTriggerArea [_gridwidth, _gridwidth, 0, true];
  785. _this setTriggerActivation ["ANY", "PRESENT", true];
  786.  
  787. Call Compile Format ["SAR_trig_%1_%2 = _this",_ii,_i];
  788.  
  789. _trig_act_stmnt = format["if (SAR_DEBUG) then {diag_log 'SAR DEBUG: trigger on in %1';};[thislist,'%1'] execVM'addons\SARGE\SAR_AI_spawn.sqf';",_triggername];
  790. _trig_deact_stmnt = format["if (SAR_DEBUG) then {diag_log 'SAR DEBUG: trigger off in %1';};[thislist,thisTrigger,'%1'] execVM'addons\SARGE\SAR_AI_despawn.sqf';",_triggername];
  791.  
  792. _trig_cond = "{isPlayer _x} count thisList > 0;";
  793.  
  794. Call Compile Format ["SAR_trig_%1_%2 ",_ii,_i] setTriggerStatements [_trig_cond,_trig_act_stmnt , _trig_deact_stmnt];
  795.  
  796. };
  797.  
  798. // standard grid definition - maxgroups (ba,so,su) - probability (ba,so,su) - max group members (ba,so,su)
  799. SAR_AI_monitor set[count SAR_AI_monitor, [_markername,[SAR_max_grps_bandits,SAR_max_grps_soldiers,SAR_max_grps_survivors],[SAR_chance_bandits,SAR_chance_soldiers,SAR_chance_survivors],[SAR_max_grpsize_bandits,SAR_max_grpsize_soldiers,SAR_max_grpsize_survivors],[],[],[]]];
  800.  
  801. };
  802. };
  803.  
  804. // ----------------------------------------------------------------------------
  805. // end of Setup aremarker & trigger grid
  806. // ----------------------------------------------------------------------------
  807.  
  808. //
  809. // Enable the SAR garbage collector & watchdog
  810. //
  811.  
  812.  
  813. [] execVM "addons\SARGE\SAR_group_monitor.sqf";
  814.  
  815.  
  816. //
  817. // include group & spawn definitions for automatic & static vehicle and infantry spawns
  818. //
  819.  
  820. switch (_worldname) do {
  821. case "chernarus":
  822. {
  823. #include "map_config\SAR_cfg_grps_chernarus.sqf"
  824. };
  825. case "tavi":
  826. {
  827. #include "map_config\SAR_cfg_grps_tavi.sqf"
  828. };
  829. case "namalsk":
  830. {
  831. #include "map_config\SAR_cfg_grps_namalsk.sqf"
  832. };
  833. case "lingor":
  834. {
  835. #include "map_config\SAR_cfg_grps_lingor.sqf"
  836. };
  837. case "mbg_celle2":
  838. {
  839. #include "map_config\SAR_cfg_grps_mbg_celle2.sqf"
  840. };
  841. case "takistan":
  842. {
  843. #include "map_config\SAR_cfg_grps_takistan.sqf"
  844. };
  845. case "fallujah":
  846. {
  847. #include "map_config\SAR_cfg_grps_fallujah.sqf"
  848. };
  849. case "panthera2":
  850. {
  851. #include "map_config\SAR_cfg_grps_panthera.sqf"
  852. };
  853.  
  854. };
  855.  
  856. //
  857. // initialize the fix for sharing vehicles between survivors and bandits
  858. //
  859.  
  860. if(SAR_FIX_VEHICLE_ISSUE) then {
  861.  
  862. _script_handler = [] execVM "addons\SARGE\SAR_vehicle_fix.sqf";
  863. waitUntil {scriptDone _script_handler};
  864. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement