summaryrefslogtreecommitdiffstats
path: root/Server/Functions/Server_SelectResTeam.sqf
blob: 63e12181e68957a7fa37f717b4b7f1b536b33bc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Private ['_difficulty','_factor','_infAssign','_minInfSpawnRatio','_minVehSpawnRatio','_poolInf','_poolVeh','_ratioInfantry','_ranArr','_ratioVehicle','_teams','_try','_vehAssign'];

_difficulty = _this select 0;

_ratioVehicle = 0;
_ratioInfantry = 0;

_teams = [];
_poolInf = [];
_poolVeh = [];

_vehAssign = 0;
_infAssign = 0;
_minInfSpawnRatio = 0;
_minVehSpawnRatio = 0;
_try = 0;

switch (_difficulty) do {
	case 'light1': {
		_ratioVehicle = 10;
		_ratioInfantry = 90;
		_try = 3;
		_minInfSpawnRatio = 15;
		_minVehSpawnRatio = 35;
		
		_poolInf = ['Group','Patrol1','Patrol2','Militia'];
		_poolVeh = ['MotorizedGroup'];
	};
	case 'light2': {
		_ratioVehicle = 20;
		_ratioInfantry = 80;
		_try = 4;
		_minInfSpawnRatio = 20;
		_minVehSpawnRatio = 40;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','Patrol2','Militia'];
		_poolVeh = ['Technical'];
	};
	case 'medium1': {
		_ratioVehicle = 20;
		_ratioInfantry = 80;
		_try = 5;
		_minInfSpawnRatio = 18;
		_minVehSpawnRatio = 35;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','GroupAssault','SniperTeam'];
		_poolVeh = ['Technical'];
	};
	case 'medium2': {
		_ratioVehicle = 40;
		_ratioInfantry = 60;
		_try = 5;
		_minInfSpawnRatio = 22;
		_minVehSpawnRatio = 39;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','GroupAssault','AATeam'];
		_poolVeh = ['MechanizedGroup','MechanizedPatrol','LightArmor','Technical','MotorizedGroup'];
	};
	case 'medium3': {
		_ratioVehicle = 30;
		_ratioInfantry = 70;
		_try = 5;
		_minInfSpawnRatio = 26;
		_minVehSpawnRatio = 32;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','GroupAssault'];
		_poolVeh = ['MechanizedGroup','MechanizedPatrol','MotorizedAATeam','LightArmor','Technical','MotorizedGroup'];
	};
	case 'medium4': {
		_ratioVehicle = 35;
		_ratioInfantry = 65;
		_try = 5;
		_minInfSpawnRatio = 28;
		_minVehSpawnRatio = 32;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','GroupAssault','AATeam'];
		_poolVeh = ['MechanizedGroup','MechanizedPatrol','MotorizedAATeam','LightArmor','Technical','HeavyArmor'];
	};
	case 'large1': {
		_ratioVehicle = 30;
		_ratioInfantry = 70;
		_try = 5;
		_minInfSpawnRatio = 25;
		_minVehSpawnRatio = 35;
		
		_poolInf = ['GroupWeapons','ATTeam','GroupAssault','SniperTeam'];
		_poolVeh = ['MechanizedGroup','MechanizedPatrol','LightArmor','LightArmor','HeavyArmor','Technical'];
	};
	case 'large2': {
		_ratioVehicle = 45;
		_ratioInfantry = 55;
		_try = 6;
		_minInfSpawnRatio = 25;
		_minVehSpawnRatio = 32;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','GroupAssault','AATeam','SniperTeam'];
		_poolVeh = ['MechanizedGroup','MechanizedPatrol','MotorizedAATeam','LightArmor','HeavyArmor','HeavyArmor','Technical'];
	};
	case 'huge1': {
		_ratioVehicle = 50;
		_ratioInfantry = 50;
		_try = 6;
		_minInfSpawnRatio = 30;
		_minVehSpawnRatio = 35;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','GroupAssault','AATeam','SniperTeam'];
		_poolVeh = ['MechanizedGroup','MechanizedPatrol','MotorizedAATeam','LightArmor','LightArmor','HeavyArmor','HeavyArmor','Technical'];
	};
	case 'huge2': {
		_ratioVehicle = 50;
		_ratioInfantry = 50;
		_try = 7;
		_minInfSpawnRatio = 35;
		_minVehSpawnRatio = 35;
		
		_poolInf = ['Group','GroupWeapons','ATTeam','GroupAssault','AATeam','SniperTeam'];
		_poolVeh = ['MechanizedGroup','MechanizedPatrol','MotorizedAATeam','LightArmor','LightArmor','HeavyArmor','HeavyArmor','Technical'];
	};
};

_try = _try * ('WFBE_TOWNRESISTANCEDIFFICULTY' Call GetNamespace);
_vehAssign = round(_try * (_ratioVehicle / 100));
_infAssign = round(_try * (_ratioInfantry / 100));

for [{_z = 0},{_z < _try},{_z = _z + 1}] do {
	if (_vehAssign > 0) then {
		_vehAssign = _vehAssign - 1;
		if (random 100 > _minVehSpawnRatio) then {
			_ranArr = round(random((count _poolVeh)-1));
			_teams = _teams + [_poolVeh select _ranArr];
		};
	};
	if (_infAssign > 0) then {
		_infAssign = _infAssign - 1;
		if (random 100 > _minInfSpawnRatio) then {
			_ranArr = round(random((count _poolInf)-1));
			_teams = _teams + [_poolInf select _ranArr];
		};
	};
};

if (count _teams < 1) then {_teams = ['Group']};

_teams