Skip to content

Commit 400132c

Browse files
committed
Trying to reduce spawning inside rocks or exploding on spawn
1 parent 26987ea commit 400132c

22 files changed

Lines changed: 191 additions & 176 deletions

addons/overthrow_main.pbo

787 Bytes
Binary file not shown.

addons/overthrow_main/functions/AI/NPC/fn_initMilitary.sqf

Lines changed: 99 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2,129 +2,133 @@ _unit = _this select 0;
22

33
_type = typeof _unit;
44

5-
//Re-Equip this soldier
5+
//Make silencers rare
66
_items = primaryWeaponItems _unit;
77
if !(_items#0 isEqualTo "") then {
88
if((random 100) < 99) then {
9-
//Make silencers rare
109
_unit removePrimaryWeaponItem (_items#0);
1110
}
1211
};
13-
//Primary Weapon
14-
_accessories = _unit weaponAccessories primaryWeapon _unit;
15-
_base = [primaryWeapon _unit] call BIS_fnc_baseWeapon;
16-
_unit removeWeapon (primaryWeapon _unit);
17-
_magazines = getArray (configFile / "CfgWeapons" / _base / "magazines");
18-
_stock = _unit call OT_fnc_unitStock;
19-
{
20-
_x params ["_cls","_num"];
21-
if(_cls in _magazines) then {
22-
private _count = 0;
23-
while {_count < _num} do {
24-
_unit removeMagazineGlobal _cls;
25-
_count = _count + 1;
12+
13+
//Re-Equip this soldier (75% of the time)
14+
if((random 100) > 25) then {
15+
//Primary Weapon
16+
_accessories = _unit weaponAccessories primaryWeapon _unit;
17+
_base = [primaryWeapon _unit] call BIS_fnc_baseWeapon;
18+
_unit removeWeapon (primaryWeapon _unit);
19+
_magazines = getArray (configFile / "CfgWeapons" / _base / "magazines");
20+
_stock = _unit call OT_fnc_unitStock;
21+
{
22+
_x params ["_cls","_num"];
23+
if(_cls in _magazines) then {
24+
private _count = 0;
25+
while {_count < _num} do {
26+
_unit removeMagazineGlobal _cls;
27+
_count = _count + 1;
28+
};
2629
};
30+
}foreach(_stock);
31+
32+
33+
_wpn = _base call {
34+
if(_this in OT_allBLUGLRifles) exitWith {selectRandom OT_allBLUGLRifles};
35+
if(_this in OT_allBLUSniperRifles) exitWith {_unit addItemToUniform "ACE_rangeCard";selectRandom OT_allBLUSniperRifles};
36+
if(_this in OT_allBLUMachineGuns) exitWith {selectRandom OT_allBLUMachineGuns};
37+
selectRandom OT_allBLURifles;
2738
};
28-
}foreach(_stock);
2939

40+
_unit addWeapon _wpn;
41+
//put accessories back (where possible)
42+
{
43+
_unit addWeaponItem [_wpn, _x];
44+
}foreach(_accessories);
3045

31-
_wpn = _base call {
32-
if(_this in OT_allBLUGLRifles) exitWith {selectRandom OT_allBLUGLRifles};
33-
if(_this in OT_allBLUSniperRifles) exitWith {_unit addItemToUniform "ACE_rangeCard";selectRandom OT_allBLUSniperRifles};
34-
if(_this in OT_allBLUMachineGuns) exitWith {selectRandom OT_allBLUMachineGuns};
35-
selectRandom OT_allBLURifles;
36-
};
46+
_magazines = getArray (configFile / "CfgWeapons" / _wpn / "magazines");
3747

38-
_unit addWeapon _wpn;
39-
//put accessories back (where possible)
40-
{
41-
_unit addWeaponItem [_wpn, _x];
42-
}foreach(_accessories);
43-
44-
_magazines = getArray (configFile / "CfgWeapons" / _wpn / "magazines");
45-
46-
_mag = selectRandom _magazines;
47-
_unit addWeaponItem [_wpn, _mag];
48-
_unit addMagazineGlobal _mag;
49-
_unit addMagazineGlobal _mag;
50-
_unit addMagazineGlobal _mag;
51-
_unit addMagazineGlobal _mag;
52-
_unit addMagazineGlobal _mag;
53-
_unit addMagazineGlobal _mag;
54-
55-
_secondmags = [];
56-
{
57-
if !(_x isEqualTo "this") then {
58-
_secondmags = _secondmags + getArray (configFile / "CfgWeapons" / _wpn / _x / "magazines")
59-
};
60-
}foreach(getArray (configFile / "CfgWeapons" / _wpn / "muzzles"));
61-
if((count _secondmags) > 0) then {
62-
_mag = _secondmags select 0;
48+
_mag = selectRandom _magazines;
6349
_unit addWeaponItem [_wpn, _mag];
6450
_unit addMagazineGlobal _mag;
6551
_unit addMagazineGlobal _mag;
6652
_unit addMagazineGlobal _mag;
6753
_unit addMagazineGlobal _mag;
6854
_unit addMagazineGlobal _mag;
6955
_unit addMagazineGlobal _mag;
70-
};
7156

72-
//Secondary Weapon
73-
if !((_type find "_AA_") > -1) then {
74-
if !(secondaryWeapon _unit isEqualTo "") then {
75-
_base = [secondaryWeapon _unit] call BIS_fnc_baseWeapon;
76-
_unit removeWeapon (secondaryWeapon _unit);
77-
_magazines = getArray (configFile / "CfgWeapons" / _base / "magazines");
78-
{
79-
_x params ["_cls","_num"];
80-
if(_cls in _magazines) then {
81-
private _count = 0;
82-
while {_count < _num} do {
83-
_unit removeMagazineGlobal _cls;
84-
_count = _count + 1;
57+
_secondmags = [];
58+
{
59+
if !(_x isEqualTo "this") then {
60+
_secondmags = _secondmags + getArray (configFile / "CfgWeapons" / _wpn / _x / "magazines")
61+
};
62+
}foreach(getArray (configFile / "CfgWeapons" / _wpn / "muzzles"));
63+
if((count _secondmags) > 0) then {
64+
_mag = _secondmags select 0;
65+
_unit addWeaponItem [_wpn, _mag];
66+
_unit addMagazineGlobal _mag;
67+
_unit addMagazineGlobal _mag;
68+
_unit addMagazineGlobal _mag;
69+
_unit addMagazineGlobal _mag;
70+
_unit addMagazineGlobal _mag;
71+
_unit addMagazineGlobal _mag;
72+
};
73+
74+
//Secondary Weapon
75+
if !((_type find "_AA_") > -1) then {
76+
if !(secondaryWeapon _unit isEqualTo "") then {
77+
_base = [secondaryWeapon _unit] call BIS_fnc_baseWeapon;
78+
_unit removeWeapon (secondaryWeapon _unit);
79+
_magazines = getArray (configFile / "CfgWeapons" / _base / "magazines");
80+
{
81+
_x params ["_cls","_num"];
82+
if(_cls in _magazines) then {
83+
private _count = 0;
84+
while {_count < _num} do {
85+
_unit removeMagazineGlobal _cls;
86+
_count = _count + 1;
87+
};
8588
};
89+
}foreach(_stock);
90+
_wpn = selectRandom OT_allBLULaunchers;
91+
_unit addWeapon _wpn;
92+
_magazines = getArray (configFile / "CfgWeapons" / _wpn / "magazines");
93+
94+
_mag = selectRandom _magazines;
95+
if !(_mag isEqualTo "ACE_PreloadedMissileDummy") then {
96+
_unit addWeaponItem [_wpn, _mag];
97+
_unit addMagazineGlobal _mag;
98+
_unit addMagazineGlobal _mag;
99+
}else{
100+
removeBackpack _unit;
86101
};
87-
}foreach(_stock);
88-
_wpn = selectRandom OT_allBLULaunchers;
89-
_unit addWeapon _wpn;
90-
_magazines = getArray (configFile / "CfgWeapons" / _wpn / "magazines");
91-
92-
_mag = selectRandom _magazines;
93-
if !(_mag isEqualTo "ACE_PreloadedMissileDummy") then {
94-
_unit addWeaponItem [_wpn, _mag];
95-
_unit addMagazineGlobal _mag;
96-
_unit addMagazineGlobal _mag;
97-
}else{
98-
removeBackpack _unit;
99102
};
100103
};
101-
};
102104

103-
//Pistol
104-
_base = [handgunWeapon _unit] call BIS_fnc_baseWeapon;
105-
_unit removeWeapon (handgunWeapon _unit);
106-
_magazines = getArray (configFile / "CfgWeapons" / _base / "magazines");
107-
{
108-
_x params ["_cls","_num"];
109-
if(_cls in _magazines) then {
110-
private _count = 0;
111-
while {_count < _num} do {
112-
_unit removeMagazineGlobal _cls;
113-
_count = _count + 1;
105+
//Pistol
106+
_base = [handgunWeapon _unit] call BIS_fnc_baseWeapon;
107+
_unit removeWeapon (handgunWeapon _unit);
108+
_magazines = getArray (configFile / "CfgWeapons" / _base / "magazines");
109+
{
110+
_x params ["_cls","_num"];
111+
if(_cls in _magazines) then {
112+
private _count = 0;
113+
while {_count < _num} do {
114+
_unit removeMagazineGlobal _cls;
115+
_count = _count + 1;
116+
};
114117
};
115-
};
116-
}foreach(_stock);
118+
}foreach(_stock);
117119

118-
_wpn = selectRandom OT_allBLUPistols;
119-
_unit addWeapon _wpn;
120-
_magazines = getArray (configFile / "CfgWeapons" / _wpn / "magazines");
120+
_wpn = selectRandom OT_allBLUPistols;
121+
_unit addWeapon _wpn;
122+
_magazines = getArray (configFile / "CfgWeapons" / _wpn / "magazines");
121123

122-
_mag = selectRandom _magazines;
123-
_unit addWeaponItem [_wpn, _mag];
124-
_unit addMagazineGlobal _mag;
125-
_unit addMagazineGlobal _mag;
124+
_mag = selectRandom _magazines;
125+
_unit addWeaponItem [_wpn, _mag];
126+
_unit addMagazineGlobal _mag;
127+
_unit addMagazineGlobal _mag;
126128

127-
_unit selectWeapon (primaryWeapon _unit);
129+
_unit selectWeapon (primaryWeapon _unit);
130+
131+
};
128132

129133
_unit addEventHandler ["HandleDamage", {
130134
_me = _this select 0;

addons/overthrow_main/functions/actions/fn_buyBusiness.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if((_b select 1) isEqualTo "Business") then {
4141

4242
private _veh = OT_factoryPos nearestObject OT_item_CargoContainer;
4343
if(_veh isEqualTo objNull) then {
44-
private _p = OT_factoryPos findEmptyPosition [0,100,OT_item_CargoContainer];
44+
private _p = OT_factoryPos findEmptyPosition [5,100,OT_item_CargoContainer];
4545
private _veh = OT_item_CargoContainer createVehicle _p;
4646
[_veh,(server getVariable ["generals",[]]) select 0] call OT_fnc_setOwner;
4747
clearWeaponCargoGlobal _veh;

addons/overthrow_main/functions/actions/fn_dumpIntoWarehouse.sqf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ if(handgunWeapon _unit != "") then {
8484

8585
if((!isplayer _unit) || _linkedItems) then {
8686
{
87-
if (([(configFile >> "CfgWeapons" >> _x),"useAsBinocular",0] call BIS_fnc_returnConfigEntry) > 0) then {
88-
_unit unassignItem _x;
89-
_unit removeWeapon _x;
90-
}else{
91-
_unit unlinkItem _x;
87+
if !(_x isEqualTo "ItemMap") then {
88+
if (([(configFile >> "CfgWeapons" >> _x),"useAsBinocular",0] call BIS_fnc_returnConfigEntry) > 0) then {
89+
_unit unassignItem _x;
90+
_unit removeWeapon _x;
91+
}else{
92+
_unit unlinkItem _x;
93+
};
94+
[_x,1] call OT_fnc_addToWarehouse;
9295
};
93-
[_x,1] call OT_fnc_addToWarehouse;
9496
}foreach(assignedItems _unit);
9597
};
9698

addons/overthrow_main/functions/actions/fn_fastTravel.sqf

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
private _ft = server getVariable ["OT_fastTravelType",1];
2+
private _diff = server getVariable ["OT_difficulty",1];
3+
private _ftrules = server getVariable ["OT_fastTravelRules",_diff];
24
if(!OT_adminMode && _ft > 1) exitWith {hint "Fast Travel is disabled"};
35

46
if !(captive player) exitWith {hint "You cannot fast travel while wanted"};
57
if !("ItemMap" in assignedItems player) exitWith {hint "You need a map to fast travel"};
68

7-
private _diff = server getVariable ["OT_difficulty",1];
8-
if(_diff > 0 && !((primaryWeapon player) isEqualTo "" && (secondaryWeapon player) isEqualTo "" && (handgunWeapon player) isEqualTo "")) exitWith {hint "You cannot fast travel holding a weapon"};
9+
if(_ftrules > 0 && !((primaryWeapon player) isEqualTo "" && (secondaryWeapon player) isEqualTo "" && (handgunWeapon player) isEqualTo "")) exitWith {hint "You cannot fast travel holding a weapon"};
910

1011
_foundweapon = false;
1112
{
@@ -26,10 +27,10 @@ if((vehicle player) != player) then {
2627
if(_x in OT_allDrugs) exitWith {_hasdrugs = true};
2728
}foreach(itemCargo vehicle player);
2829

29-
if(_hasdrugs) exitWith {hint "You cannot fast travel while carrying drugs";_exit=true};
30+
if(_hasdrugs && _ftrules > 0) exitWith {hint "You cannot fast travel while carrying drugs";_exit=true};
3031
if (driver (vehicle player) != player) exitWith {hint "You are not the driver of this vehicle";_exit=true};
31-
if({!captive _x} count (crew vehicle player) != 0) exitWith {hint "There are wanted people in this vehicle";_exit=true};
32-
if(_diff > 1 && ((vehicle player) in (OT_allVehicleThreats + OT_allHeliThreats + OT_allPlaneThreats))) exitWith {hint "You cannot fast travel in an offensive vehicle";_exit=true};
32+
if({!captive _x && alive _x} count (crew vehicle player) != 0) exitWith {hint "There are wanted people in this vehicle";_exit=true};
33+
if(_ftrules > 1 && ((vehicle player) in (OT_allVehicleThreats + OT_allHeliThreats + OT_allPlaneThreats))) exitWith {hint "You cannot fast travel in an offensive vehicle";_exit=true};
3334
};
3435
if(_exit) exitWith {};
3536

@@ -118,11 +119,11 @@ OT_FastTravel_MapSingleClickEHId = addMissionEventHandler ["MapSingleClick", {
118119
};
119120
{_x allowDamage false} foreach(crew vehicle player);
120121
private _road = _roads select 0;
121-
_pos = position _road findEmptyPosition [1,120,typeOf (vehicle player)];
122+
_pos = position _road findEmptyPosition [10,120,typeOf (vehicle player)];
122123
vehicle player setPos _pos;
123124
};
124125
}else{
125-
player setpos _pos;
126+
player setpos (_pos findEmptyPosition [2,50]);
126127
};
127128

128129
disableUserInput false;

addons/overthrow_main/functions/actions/fn_transferLegit.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ _doTransfer = {
6464
}else{
6565
{
6666
private _count = 0;
67-
params ["_cls","_num"];
67+
_x params ["_cls","_num"];
6868
if(_cls in OT_allItems) then {
6969
while {_count < _num} do {
7070
if(!(_veh canAdd [_cls,_count+1])) exitWith {_full = true;};

addons/overthrow_main/functions/factions/GUER/fn_GUERLoop.sqf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ if ((date select 3) != _lasthr) then {
8080
_sellprice = round(([OT_nation,_input,0] call OT_fnc_getSellPrice) * 1.2);
8181
_container = _pos nearestObject OT_item_CargoContainer;
8282
if(_container isEqualTo objNull) then {
83-
_p = _pos findEmptyPosition [0,100,OT_item_CargoContainer];
83+
_p = _pos findEmptyPosition [5,100,OT_item_CargoContainer];
8484
_container = OT_item_CargoContainer createVehicle _p;
8585
[_container,(server getVariable ["generals",[]]) select 0] call OT_fnc_setOwner;
8686
clearWeaponCargoGlobal _container;
@@ -112,7 +112,7 @@ if ((date select 3) != _lasthr) then {
112112
_output = _data select 3;
113113
_container = _pos nearestObject OT_item_CargoContainer;
114114
if(_container isEqualTo objNull) then {
115-
_p = _pos findEmptyPosition [0,100,OT_item_CargoContainer];
115+
_p = _pos findEmptyPosition [5,100,OT_item_CargoContainer];
116116
_container = OT_item_CargoContainer createVehicle _p;
117117
[_container,(server getVariable ["generals",[]]) select 0] call OT_fnc_setOwner;
118118
clearWeaponCargoGlobal _container;
@@ -293,7 +293,7 @@ if ((date select 4) != _lastmin) then {
293293
if(_timespent isEqualTo 0) then {
294294
private _veh = OT_factoryPos nearestObject OT_item_CargoContainer;
295295
if(_veh isEqualTo objNull) then {
296-
_p = OT_factoryPos findEmptyPosition [0,100,OT_item_CargoContainer];
296+
_p = OT_factoryPos findEmptyPosition [5,100,OT_item_CargoContainer];
297297
if(count _p > 0) then {
298298
_veh = OT_item_CargoContainer createVehicle _p;
299299
[_veh,(server getVariable ["generals",[]]) select 0] call OT_fnc_setOwner;
@@ -345,7 +345,7 @@ if ((date select 4) != _lastmin) then {
345345
server setVariable ["GEURproducing",""];
346346

347347
if(!(_currentCls isKindOf "Bag_Base") && _currentCls isKindOf "AllVehicles") then {
348-
_p = OT_factoryVehicleSpawn findEmptyPosition [0,100,_currentCls];
348+
_p = OT_factoryVehicleSpawn findEmptyPosition [5,100,_currentCls];
349349
if(count _p > 0) then {
350350
_veh = _currentCls createVehicle _p;
351351
[_veh,(server getVariable ["generals",[]]) select 0] call OT_fnc_setOwner;
@@ -362,7 +362,7 @@ if ((date select 4) != _lastmin) then {
362362
}else{
363363
private _veh = OT_factoryPos nearestObject OT_item_CargoContainer;
364364
if(_veh isEqualTo objNull) then {
365-
_p = OT_factoryPos findEmptyPosition [0,100,OT_item_CargoContainer];
365+
_p = OT_factoryPos findEmptyPosition [5,100,OT_item_CargoContainer];
366366
_veh = OT_item_CargoContainer createVehicle _p;
367367
[_veh,(server getVariable ["generals",[]]) select 0] call OT_fnc_setOwner;
368368
clearWeaponCargoGlobal _veh;

addons/overthrow_main/functions/factions/NATO/fn_NATOConvoy.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if ([_topos,_fromregion] call OT_fnc_regionIsConnected) then {
2020
if (!isNull _road) then {
2121
_roadscon = roadsConnectedto _road;
2222
if (count _roadscon isEqualTo 2) then {
23-
_posVeh = (getpos _road) findEmptyPosition [0,15,_vehtypes select 0];
23+
_posVeh = (getpos _road) findEmptyPosition [5,25,_vehtypes select 0];
2424
if(count _posVeh > 0) then {
2525
_convoypos = _posVeh;
2626
_dir = [_road, _roadscon select 0] call BIS_fnc_DirTo;

addons/overthrow_main/functions/factions/NATO/fn_NATOMissionDeployFOB.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if(_isAir) then {
5454
_ao = [_posTarget,[350,500],_attackdir + (random 90)] call SHK_pos_fnc_pos;
5555
_tgroup = creategroup blufor;
5656

57-
_spawnpos = _close findEmptyPosition [0,100,OT_NATO_Vehicle_AirTransport_Small];
57+
_spawnpos = _close findEmptyPosition [5,100,OT_NATO_Vehicle_AirTransport_Small];
5858
_veh = OT_NATO_Vehicle_AirTransport_Small createVehicle _spawnpos;
5959
_veh setDir _dir;
6060
_tgroup addVehicle _veh;
@@ -121,7 +121,7 @@ if(_isAir) then {
121121
if (!isNull _road) then {
122122
_convoypos = (getpos _road);
123123
};
124-
_spawnpos = _convoypos findEmptyPosition [0,100,OT_NATO_Vehicle_Transport_Light];
124+
_spawnpos = _convoypos findEmptyPosition [5,100,OT_NATO_Vehicle_Transport_Light];
125125
_veh = OT_NATO_Vehicle_Transport_Light createVehicle _spawnpos;
126126
_group addVehicle _veh;
127127

addons/overthrow_main/functions/factions/NATO/fn_NATOMissionReconDestroy.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if(_isAir) then {
5555
_ao = [_posTarget,[350,500],_attackdir + (random 90)] call SHK_pos_fnc_pos;
5656
_tgroup = creategroup blufor;
5757

58-
_spawnpos = _close findEmptyPosition [0,100,OT_NATO_Vehicle_AirTransport_Small];
58+
_spawnpos = _close findEmptyPosition [5,100,OT_NATO_Vehicle_AirTransport_Small];
5959
_veh = OT_NATO_Vehicle_AirTransport_Small createVehicle _spawnpos;
6060
_veh setDir _dir;
6161
_tgroup addVehicle _veh;

0 commit comments

Comments
 (0)