Advertisement
Guest User

Untitled

a guest
Dec 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.65 KB | None | 0 0
  1.  
  2. private ["_min_groups", "_max_groups", "min_group_size", "_max_group_size", "_number_groups", "_man_type"];
  3.  
  4. private ["_this_speed","_speed","_this_formation","_formation","_formation_count","_this_group","_this_man_odds","skill_odds","_skill_index"];
  5.  
  6.  
  7.  
  8.  
  9. _group0 = Creategroup EAST;
  10. _group1 = Creategroup EAST;
  11. _group2 = Creategroup EAST;
  12. _group3 = Creategroup EAST;
  13. _group4 = Creategroup EAST;
  14. _group5 = Creategroup EAST;
  15. _group6 = Creategroup EAST;
  16. _group7 = Creategroup EAST;
  17.  
  18.  
  19. // ******************************************************************************************************************************************************************************
  20.  
  21. // SET UP STUFF IN HERE!!!!
  22.  
  23. _min_groups = 2; // The mimimum number of groups that will be created
  24. _max_groups = 8; // The maximum number of groups that will be created. This number CANNOT exceed 8
  25.  
  26. _min_group_size = 8; // The minimum number of people a group can contain
  27. _max_group_size = 12; // The maximum number of people a group can contain.
  28.  
  29. _start_distance = 300; // This is the minimum spawn distance for a group from the trigger point
  30. _max_distance = 400; // This is the maximum spawn distance for a group from the trigger point
  31.  
  32. _max_enemy_distance = 50; // This is the maximum distance a group can be from the player as the group follows the player around
  33.  
  34.  
  35. // ******************************************************************************************************************************************************************************
  36. //
  37. // This array contains the type of enemy soldiers that a group can contain.
  38.  
  39. _man_type=["DSF_TAL_Rifleman","DSF_TAL_Grenadier","DSF_TAL_RPG7Soldier","DSF_TAL_Marksman","DSF_TAL_MachineGunner"];
  40.  
  41. // The man odds give the chances of what type of soldiers the enemy group will contain. 100 is 100%
  42. //
  43. // For example, if _man_odds_group1=[100,70,60,10,5]; it means that the chances of O_Soldier_F being created are 100 - 70, which is 30%, for
  44. // O_officer_F, the chances are 70 - 60 which is 10% chance. And so on. Each group can have different odds.
  45.  
  46. _man_odds_group0=[100,50,30,15,10,0];
  47. _man_odds_group1=[100,50,30,15,10,0];
  48. _man_odds_group2=[100,50,30,15,10,0];
  49. _man_odds_group3=[100,50,30,15,10,0];
  50. _man_odds_group4=[100,50,30,15,10,0];
  51. _man_odds_group5=[100,50,30,15,10,0];
  52. _man_odds_group6=[100,50,30,15,10,0];
  53. _man_odds_group7=[100,50,30,15,10,0];
  54.  
  55.  
  56. // ******************************************************************************************************************************************************************************
  57. //
  58. // These numbers represent the time BEFORE each group will be spawned in. Times are in seconds.
  59. //
  60. // _group_spawn_delay_min=[30,45,30,60,60,30];
  61. // _group_spawn_delay_max=[40,60,60,80,65,40];
  62. //
  63. // The initial delay before any groups are spawned will be 30 seconds + random time of (40 - 30), so 30 seconds + random of 10 seconds.
  64. // The next group will spawn at 45 seconds + random time of (60 - 45), so 45 seconds + random of 15 seconds, and so on.
  65.  
  66. _group_spawn_delay_min=[5,5,5,5,5,5,5,5,5];
  67. _group_spawn_delay_max=[5,5,5,5,5,5,5,5,5];
  68. _sleep_delay = 2; // This MUST be at least two times less than any of the _group_spawn_delay numbers
  69.  
  70. // ******************************************************************************************************************************************************************************
  71. //
  72. // The _speed_type array contains the various types of speed the group can operate at.
  73.  
  74. _speed_type=["LIMITED","NORMAL","FULL"];
  75.  
  76. // The _speed_odds array uses the same chance principles as the man odds.
  77. // For example, _speed_odds = [100,60,30]; will give 100 - 60, which is 40% chance that the group will have LIMITED speed, and so on.
  78.  
  79. _speed_odds = [100,100,60];
  80.  
  81. // The _formation_type array contains all the types of formations that each group can move to a waypoint with.
  82.  
  83. _formation_type=["NO CHANGE","COLUMN","STAG COLUMN","WEDGE","ECH LEFT","ECH RIGHT","VEE","LINE","FILE","DIAMOND"];
  84.  
  85. // The _formation_odds array uses the same chance principles as the man odds.
  86.  
  87. _formation_odds = [100,90,80,70,60,50,40,30,20,10];
  88.  
  89.  
  90.  
  91. // ******************************************************************************************************************************************************************************
  92.  
  93. _group_skill=[0.2, 0.3, 0.4 ,0.5, 0.6, 0.7, 0.8, 0.9];
  94. _group_skill_level=["Novice","Rookie","Rookie","Recruit","Recruit","Veteran","Veteran","Expert"];
  95.  
  96. _skill_odds=[100, 95, 85, 70, 50, 30, 15, 5]; // Must contain the same number of entries as _group_skill
  97.  
  98. // ******************************************************************************************************************************************************************************
  99.  
  100. _all_groups = [_group0, _group1, _group2, _group3, _group4, _group5, _group6, _group7];
  101. _all_man_odds = [_man_odds_group0, _man_odds_group1, _man_odds_group2, _man_odds_group3, _man_odds_group4, _man_odds_group5];
  102.  
  103.  
  104. _number_groups = floor(random (_max_groups - _min_groups)) + _min_groups;
  105.  
  106. //hint format ["Groups %1", _number_groups];
  107.  
  108.  
  109.  
  110. _man_number = count _man_type;
  111.  
  112.  
  113.  
  114. _formation_count = count _formation_type;
  115.  
  116.  
  117.  
  118. private ["_i", "_j", "_k", "_odds", "_table_odds", "_this_man", "_skill_level"];
  119.  
  120. //hint format ["Position %1, %2",_spawn_position, _number_groups];
  121.  
  122. _skill_count = (count _group_skill) - 1;
  123.  
  124.  
  125.  
  126. // ******************************************************************************************************************************************************************************
  127.  
  128.  
  129.  
  130. _group_counter = 0;
  131.  
  132. _wait_time = 0;
  133.  
  134. _delay_min = _group_spawn_delay_min select _group_counter;
  135. _delay_max = _group_spawn_delay_max select _group_counter;
  136.  
  137. _delay_time = (random (_delay_max - _delay_min)) + _delay_min;
  138.  
  139. _wait_time = _wait_time + _delay_time;
  140.  
  141. _skill_index = 0;
  142.  
  143. // hint format ["Initial Delay: %1", _delay_time];
  144.  
  145. while {alive player} do
  146. {
  147.  
  148.  
  149. if ( time > _wait_time) then
  150. {
  151.  
  152.  
  153. if ( _group_counter < _number_groups) then
  154. {
  155.  
  156. _this_group = _all_groups select _group_counter;
  157. _this_man_odds = _all_man_odds select _group_counter;
  158.  
  159. _group_size = floor(random (_max_group_size - _min_group_size)) + _min_group_size;
  160.  
  161. _spawn_position = position player;
  162.  
  163. _xpos = _spawn_position select 0;
  164. _ypos = _spawn_position select 1;
  165. _zpos = _spawn_position select 2;
  166.  
  167. _distance = _start_distance + random (_max_distance - _start_distance);
  168. _angle = random 360;
  169.  
  170. _xxpos = (_distance * cos _angle);
  171. _yypos = (_distance * sin _angle);
  172.  
  173. _xpos = _xpos + _xxpos;
  174. _ypos = _ypos + _yypos;
  175.  
  176. _spawn_position set [0, _xpos];
  177. _spawn_position set [1, _ypos];
  178. _spawn_position set [2, _zpos];
  179.  
  180. _odds = random (100);
  181.  
  182. for "_i" from 0 to _skill_count do
  183. {
  184.  
  185. _table_odds = _skill_odds select _i;
  186.  
  187. if (_odds < _table_odds) then
  188. {
  189. _skill_index = _i;
  190.  
  191. };
  192.  
  193.  
  194. };
  195.  
  196.  
  197. // hint format ["_skill_index %1, _skill_count %2", _skill_index, _skill_count];
  198.  
  199.  
  200.  
  201. _skill_level = _group_skill select _skill_index;
  202. _skill_level_name = _group_skill_level select _skill_index;
  203.  
  204. for "_i" from 0 to (_group_size - 1) do
  205. {
  206.  
  207. _odds = random (100);
  208.  
  209. for "_j" from 0 to (_man_number - 1) do
  210. {
  211.  
  212. _table_odds = _this_man_odds select _j;
  213.  
  214.  
  215. if (_odds < _table_odds) then
  216. {
  217.  
  218. _this_man = _j;
  219. };
  220.  
  221. };
  222.  
  223. _man = _man_type select _this_man;
  224. _man createUnit [_spawn_position, _this_group,"this allowFleeing 0", _skill_level, "Private"];
  225.  
  226.  
  227. };
  228.  
  229.  
  230. // hint format ["ENEMY SPAWNED: Group size %1, Skill: %2", _group_size,_skill_level_name];
  231.  
  232.  
  233.  
  234.  
  235. _formation = _formation_type select floor random count _formation_type;
  236.  
  237. _wp1 = _this_group addWaypoint [position player, _max_enemy_distance];
  238. _wp2 = _this_group addWaypoint [position player, _max_enemy_distance];
  239. _wp3 = _this_group addWaypoint [position player, _max_enemy_distance];
  240.  
  241. _wp1 setWaypointBehaviour "AWARE";
  242. _wp1 setwaypointtype "MOVE";
  243. _wp1 setWaypointFormation _formation;
  244. _wp1 setWaypointSpeed "Normal";
  245. _wp1 setwaypointstatements ["True", ""];
  246.  
  247.  
  248. _wp2 setwaypointtype "MOVE";
  249.  
  250. _wp3 setWaypointType "Cycle";
  251.  
  252. _group_counter = _group_counter + 1;
  253.  
  254. _delay_min = _group_spawn_delay_min select _group_counter;
  255. _delay_max = _group_spawn_delay_max select _group_counter;
  256.  
  257. _delay_time = (random (_delay_max - _delay_min)) + _delay_min;
  258.  
  259. _wait_time = _wait_time + _delay_time;
  260.  
  261. // hint format ["Initial Delay: %1", _delay_time];
  262.  
  263. };
  264.  
  265.  
  266. };
  267.  
  268.  
  269.  
  270.  
  271.  
  272. for "_i" from 0 to (_group_counter - 1) do
  273. {
  274.  
  275. _this_group = _all_groups select _i;
  276.  
  277. _odds = random (100);
  278.  
  279. for "_j" from 0 to ((count _speed_odds) - 1) do
  280. {
  281.  
  282. _table_odds = _speed_odds select _j;
  283.  
  284. if (_odds < _table_odds) then
  285. {
  286. _this_speed = _j;
  287. };
  288.  
  289. };
  290.  
  291. _odds = random (100);
  292.  
  293. for [ {_j=0}, { _j < _formation_count}, { _j =_j+1 } ] do
  294. {
  295.  
  296. _table_odds = _formation_odds select _j;
  297.  
  298. if (_odds < _table_odds) then
  299. {
  300. _this_formation = _j;
  301. };
  302.  
  303. };
  304.  
  305. _speed = _speed_type select _this_speed;
  306. _formation = _formation_type select _this_formation;
  307.  
  308. // hint format ["Speed: %1, Formation: %2", _speed, _formation];
  309.  
  310.  
  311. [_this_group, 1] setWaypointSpeed _speed;
  312. [_this_group, 1] setWaypointFormation _formation;
  313.  
  314.  
  315. [_this_group, 1] setWaypointPosition [ getPosATL player, random (_max_enemy_distance) ];
  316. [_this_group, 2] setWaypointPosition [ getPosATL player, random (_max_enemy_distance) ];
  317.  
  318.  
  319. };
  320.  
  321.  
  322. sleep _sleep_delay;
  323.  
  324.  
  325. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement