mmmyum

zombie_agent2

May 9th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.01 KB | None | 0 0
  1. /*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Zombie Agent">*/
  2. /*%FSM<HEAD>*/
  3. /*
  4. item0[] = {"init",0,250,-150.000000,-250.000000,-50.000000,-200.000000,0.000000,"init"};
  5. item1[] = {"End",1,250,200.000000,-250.000000,300.000000,-200.000000,0.000000,"End"};
  6. item2[] = {"wait",4,218,-150.000000,0.000000,-50.000000,50.000000,0.000000,"wait"};
  7. item3[] = {"Target_Player_or",2,4346,-150.000000,75.000000,-50.000000,125.000000,0.000000,"Target Player or" \n "Sleep"};
  8. item4[] = {"Not_Alive",4,218,125.000000,0.000000,225.000000,50.000000,5.000000,"Not" \n "Alive"};
  9. item5[] = {"Nobody_Near",4,218,275.000000,0.000000,375.000000,50.000000,4.000000,"Nobody" \n "Near"};
  10. item6[] = {"true",8,218,-150.000000,-175.000000,-50.000000,-125.000000,0.000000,"true"};
  11. item7[] = {"Begin",2,250,-150.000000,-100.000000,-50.000000,-50.000000,0.000000,"Begin"};
  12. item8[] = {"",7,210,-104.000008,-16.500004,-95.999992,-8.499997,0.000000,""};
  13. item9[] = {"Has_Target",4,218,-150.000000,175.000000,-50.000000,225.000000,3.000000,"Has" \n "Target"};
  14. item10[] = {"Chase",2,250,-150.000000,275.000000,-50.000000,325.000000,0.000000,"Chase"};
  15. item11[] = {"Time_Check",4,218,-25.000000,25.000000,75.000000,75.000000,0.000000,"Time" \n "Check"};
  16. item12[] = {"Time_Check",4,218,-275.000000,275.000000,-175.000000,325.000000,0.000000,"Time" \n "Check"};
  17. item13[] = {"is_Dedicated",4,218,50.000000,-250.000000,150.000000,-200.000000,5.000000,"is" \n "Dedicated"};
  18. item14[] = {"target_check",4,218,-25.000000,275.000000,75.000000,325.000000,1.000000,"target" \n "check"};
  19. item15[] = {"waitclean",2,250,275.000000,-75.000000,375.000000,-25.000000,0.000000,"waitclean"};
  20. item16[] = {"waitdead",2,250,125.000000,-75.000000,225.000000,-25.000000,0.000000,"waitdead"};
  21. item17[] = {"waitdead_timeup",4,218,125.000000,-150.000000,225.000000,-100.000000,5.000000,"waitdead timeup"};
  22. item18[] = {"waitdead_timeup",4,218,275.000000,-150.000000,375.000000,-100.000000,5.000000,"waitdead timeup"};
  23. item19[] = {"",7,210,233.500000,146.000000,241.500000,153.999985,0.000000,""};
  24. link0[] = {0,6};
  25. link1[] = {0,13};
  26. link2[] = {2,3};
  27. link3[] = {3,9};
  28. link4[] = {3,11};
  29. link5[] = {3,19};
  30. link6[] = {4,16};
  31. link7[] = {5,15};
  32. link8[] = {6,7};
  33. link9[] = {7,8};
  34. link10[] = {8,2};
  35. link11[] = {9,10};
  36. link12[] = {10,12};
  37. link13[] = {10,14};
  38. link14[] = {10,19};
  39. link15[] = {11,3};
  40. link16[] = {12,10};
  41. link17[] = {13,1};
  42. link18[] = {14,10};
  43. link19[] = {15,18};
  44. link20[] = {16,17};
  45. link21[] = {17,1};
  46. link22[] = {18,1};
  47. link23[] = {19,4};
  48. link24[] = {19,5};
  49. globals[] = {25.000000,1,0,0,0,640,480,1,106,6316128,1,-533.898132,436.396240,557.002441,-317.154419,979,882,1};
  50. window[] = {2,-1,-1,-32000,-32000,810,30,1238,30,3,1001};
  51. *//*%FSM</HEAD>*/
  52. class FSM
  53. {
  54. fsmName = "DayZ Zombie Agent";
  55. class States
  56. {
  57. /*%FSM<STATE "init">*/
  58. class init
  59. {
  60. name = "init";
  61. init = /*%FSM<STATEINIT""">*/"_position = _this select 0;" \n
  62. "_agent = _this select 1;"/*%FSM</STATEINIT""">*/;
  63. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  64. class Links
  65. {
  66. /*%FSM<LINK "is_Dedicated">*/
  67. class is_Dedicated
  68. {
  69. priority = 5.000000;
  70. to="End";
  71. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  72. condition=/*%FSM<CONDITION""">*/"isDedicated"/*%FSM</CONDITION""">*/;
  73. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  74. };
  75. /*%FSM</LINK>*/
  76. /*%FSM<LINK "true">*/
  77. class true
  78. {
  79. priority = 0.000000;
  80. to="Begin";
  81. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  82. condition=/*%FSM<CONDITION""">*/"dayz_clientPreload and !(isNull _agent)"/*%FSM</CONDITION""">*/;
  83. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  84. };
  85. /*%FSM</LINK>*/
  86. };
  87. };
  88. /*%FSM</STATE>*/
  89. /*%FSM<STATE "End">*/
  90. class End
  91. {
  92. name = "End";
  93. init = /*%FSM<STATEINIT""">*/"if (!isDedicated) then {" \n
  94. " if (!isNull _agent) then {" \n
  95. " if (_isAlive) then {" \n
  96. " _mBuilding = nearestBuilding _agent;" \n
  97. " _numCleanup = _mBuilding getVariable [""despawnedZeds"", 0];" \n
  98. " if (_numCleanup < 50) then {" \n
  99. " _numCleanup = _numCleanup + 1;" \n
  100. " _mBuilding setVariable [""despawnedZeds"", _numCleanup, true];" \n
  101. " diag_log format [""CLEANUP YUM RESPAWN COUNT %1 | %2"",_numCleanup,_mBuilding];" \n
  102. " };" \n
  103. " };" \n
  104. " deleteVehicle _agent;" \n
  105. " };" \n
  106. "} else {" \n
  107. " [_agent] call zombie_findOwner;" \n
  108. "};"/*%FSM</STATEINIT""">*/;
  109. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  110. class Links
  111. {
  112. };
  113. };
  114. /*%FSM</STATE>*/
  115. /*%FSM<STATE "Target_Player_or">*/
  116. class Target_Player_or
  117. {
  118. name = "Target_Player_or";
  119. init = /*%FSM<STATEINIT""">*/"_isAlive = alive _agent;" \n
  120. "" \n
  121. "if ((_agent distance player) > 250) then {" \n
  122. "_isSomeone = false;" \n
  123. "} else {" \n
  124. "//if ((_agent distance player) < 250) then {" \n
  125. "_target = player;" \n
  126. "_targetSet = true;" \n
  127. "_newDest = getPosATL _target;" \n
  128. "_isSomeone = true;" \n
  129. "};" \n
  130. "_timeN = time;// + _rndYumT + _rndYum;" \n
  131. "" \n
  132. "//diag_log format [""ZEDSPAWN YUM AGENT TARGETSET | AGENT %1 | TARGET %2 | SET %3"",_agent,_target,_targetSet];"/*%FSM</STATEINIT""">*/;
  133. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  134. class Links
  135. {
  136. /*%FSM<LINK "Not_Alive">*/
  137. class Not_Alive
  138. {
  139. priority = 5.000000;
  140. to="waitdead";
  141. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  142. condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
  143. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  144. };
  145. /*%FSM</LINK>*/
  146. /*%FSM<LINK "Nobody_Near">*/
  147. class Nobody_Near
  148. {
  149. priority = 4.000000;
  150. to="waitclean";
  151. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  152. condition=/*%FSM<CONDITION""">*/"!_isSomeone"/*%FSM</CONDITION""">*/;
  153. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  154. };
  155. /*%FSM</LINK>*/
  156. /*%FSM<LINK "Has_Target">*/
  157. class Has_Target
  158. {
  159. priority = 3.000000;
  160. to="Chase";
  161. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  162. condition=/*%FSM<CONDITION""">*/"_targetSet"/*%FSM</CONDITION""">*/;
  163. action=/*%FSM<ACTION""">*/"//Leader cries out" \n
  164. "if (_isSomeone) then {" \n
  165. " [_agent,""spotted"",0,false] call dayz_zombieSpeak;" \n
  166. "};" \n
  167. "//_targetLast = getPosATL _target;"/*%FSM</ACTION""">*/;
  168. };
  169. /*%FSM</LINK>*/
  170. /*%FSM<LINK "Time_Check">*/
  171. class Time_Check
  172. {
  173. priority = 0.000000;
  174. to="Target_Player_or";
  175. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  176. condition=/*%FSM<CONDITION""">*/"(time - _timeN) > 30"/*%FSM</CONDITION""">*/;
  177. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  178. };
  179. /*%FSM</LINK>*/
  180. };
  181. };
  182. /*%FSM</STATE>*/
  183. /*%FSM<STATE "Begin">*/
  184. class Begin
  185. {
  186. name = "Begin";
  187. init = /*%FSM<STATEINIT""">*/"//_doLoiter = _agent getVariable[""doLoiter"",true];" \n
  188. "" \n
  189. "_myDest = _position;" \n
  190. "_newDest = _position;" \n
  191. "_array = [];" \n
  192. "" \n
  193. "_bodyStay = 60;" \n
  194. "" \n
  195. "_agent disableAI ""FSM"";" \n
  196. "_agent setBehaviour ""CARELESS"";" \n
  197. "_agent setCombatMode ""RED"";" \n
  198. "_agent setSkill 0;" \n
  199. "" \n
  200. "_newDest = getPosATL _agent;" \n
  201. "_timeN = time;" \n
  202. "" \n
  203. " _id = _agent addeventhandler [""HandleDamage"",{_this call local_zombieDamage}];" \n
  204. "" \n
  205. "//hint ""run local zombie"";" \n
  206. "_isSomeone = true;" \n
  207. "" \n
  208. "_target = objNull;" \n
  209. "_targetPos = [];" \n
  210. "_countr = 0;" \n
  211. "_targetSet = false;" \n
  212. "_rndYum = floor(random 2);" \n
  213. "_rndYumT = random 3;" \n
  214. "_rndYum = _rndYum + 1;" \n
  215. "//Spawn roaming script (individual to unit)" \n
  216. "_entityTime = time;" \n
  217. "_hasMoved = false;" \n
  218. "_timeN = time + _rndYumT - _rndYum;" \n
  219. "" \n
  220. ""/*%FSM</STATEINIT""">*/;
  221. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  222. class Links
  223. {
  224. /*%FSM<LINK "wait">*/
  225. class wait
  226. {
  227. priority = 0.000000;
  228. to="Target_Player_or";
  229. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  230. condition=/*%FSM<CONDITION""">*/"(time - _timeN) > 15"/*%FSM</CONDITION""">*/;
  231. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  232. };
  233. /*%FSM</LINK>*/
  234. };
  235. };
  236. /*%FSM</STATE>*/
  237. /*%FSM<STATE "Chase">*/
  238. class Chase
  239. {
  240. name = "Chase";
  241. init = /*%FSM<STATEINIT""">*/"_timeN = time + _rndYumT;" \n
  242. "" \n
  243. "_isAlive = alive _agent;" \n
  244. "" \n
  245. "" \n
  246. "//_myDest = getPosATL _agent;" \n
  247. "_newDest = getPosATL _target;" \n
  248. "if (!isNil ""_newDest"") then {" \n
  249. "// if (_newDest distance _targetLast > 0) then {" \n
  250. " //_myDest = _newDest;" \n
  251. " _agent moveTo _newDest;" \n
  252. " _agent forceSpeed 2;" \n
  253. "// };" \n
  254. "};" \n
  255. "if (!isNull _target) then {" \n
  256. " _agent setVariable [""myDest"",_newDest];" \n
  257. "};" \n
  258. "//_targetLast = _newDest;"/*%FSM</STATEINIT""">*/;
  259. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  260. class Links
  261. {
  262. /*%FSM<LINK "Not_Alive">*/
  263. class Not_Alive
  264. {
  265. priority = 5.000000;
  266. to="waitdead";
  267. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  268. condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
  269. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  270. };
  271. /*%FSM</LINK>*/
  272. /*%FSM<LINK "Nobody_Near">*/
  273. class Nobody_Near
  274. {
  275. priority = 4.000000;
  276. to="waitclean";
  277. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  278. condition=/*%FSM<CONDITION""">*/"!_isSomeone"/*%FSM</CONDITION""">*/;
  279. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  280. };
  281. /*%FSM</LINK>*/
  282. /*%FSM<LINK "target_check">*/
  283. class target_check
  284. {
  285. priority = 1.000000;
  286. to="Chase";
  287. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  288. condition=/*%FSM<CONDITION""">*/"(time - _entityTime) > 22"/*%FSM</CONDITION""">*/;
  289. action=/*%FSM<ACTION""">*/"_entityTime = time + _rndYum;" \n
  290. "" \n
  291. "if ((_agent distance player) > 250) then { " \n
  292. " _target = objNull;" \n
  293. "// _targetSet = false;" \n
  294. "// if ((_agent distance player) > 250) then {" \n
  295. " _isSomeone = false;" \n
  296. " diag_log format [""ZEDSPAWN YUM AGENT TOO FAR | %1 | TARGET %2 |"",_agent,_target];" \n
  297. "// };" \n
  298. "} else { " \n
  299. " _target = player;" \n
  300. " //diag_log format [""ZEDSPAWN YUM AGENT CHASE | %1 | TARGET %2 |"",_agent,_target];" \n
  301. "};"/*%FSM</ACTION""">*/;
  302. };
  303. /*%FSM</LINK>*/
  304. /*%FSM<LINK "Time_Check">*/
  305. class Time_Check
  306. {
  307. priority = 0.000000;
  308. to="Chase";
  309. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  310. condition=/*%FSM<CONDITION""">*/"(time - _timeN) > 3"/*%FSM</CONDITION""">*/;
  311. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  312. };
  313. /*%FSM</LINK>*/
  314. };
  315. };
  316. /*%FSM</STATE>*/
  317. /*%FSM<STATE "waitclean">*/
  318. class waitclean
  319. {
  320. name = "waitclean";
  321. init = /*%FSM<STATEINIT""">*/"_waitClean = time - _rndYum - _rndYumT;"/*%FSM</STATEINIT""">*/;
  322. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  323. class Links
  324. {
  325. /*%FSM<LINK "waitdead_timeup">*/
  326. class waitdead_timeup
  327. {
  328. priority = 5.000000;
  329. to="End";
  330. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  331. condition=/*%FSM<CONDITION""">*/"(time - _waitClean) > _rndYumT"/*%FSM</CONDITION""">*/;
  332. action=/*%FSM<ACTION""">*/"dayz_spawnZombies = dayz_spawnZombies - 1;" \n
  333. "_isAlive = alive _agent;"/*%FSM</ACTION""">*/;
  334. };
  335. /*%FSM</LINK>*/
  336. };
  337. };
  338. /*%FSM</STATE>*/
  339. /*%FSM<STATE "waitdead">*/
  340. class waitdead
  341. {
  342. name = "waitdead";
  343. init = /*%FSM<STATEINIT""">*/"_waitDead = time;"/*%FSM</STATEINIT""">*/;
  344. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  345. class Links
  346. {
  347. /*%FSM<LINK "waitdead_timeup">*/
  348. class waitdead_timeup
  349. {
  350. priority = 5.000000;
  351. to="End";
  352. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  353. condition=/*%FSM<CONDITION""">*/"(time - _waitDead) > _bodyStay"/*%FSM</CONDITION""">*/;
  354. action=/*%FSM<ACTION""">*/"dayz_spawnZombies = dayz_spawnZombies - 1;"/*%FSM</ACTION""">*/;
  355. };
  356. /*%FSM</LINK>*/
  357. };
  358. };
  359. /*%FSM</STATE>*/
  360. };
  361. initState="init";
  362. finalStates[] =
  363. {
  364. "End",
  365. };
  366. };
  367. /*%FSM</COMPILE>*/
Advertisement
Add Comment
Please, Sign In to add comment