From d63d7af4984fc0b6f30fe8faf6f164eb12263013 Mon Sep 17 00:00:00 2001 From: Giallustio Date: Thu, 8 Oct 2015 12:36:55 +0200 Subject: [PATCH] civ traffic fixed and missing privates --- .../core/fnc/civ/traffic_create.sqf | 2 +- .../core/fnc/civ/traffic_hd.sqf | 2 +- .../core/fnc/mil/addWP.sqf | 22 ++++----- .../core/fnc/mil/check_cap.sqf | 19 ++++---- .../core/fnc/mil/check_rinf.sqf | 25 ++++++---- .../core/fnc/mil/create_group.sqf | 36 +++++---------- .../core/fnc/mil/create_hideout.sqf | 16 ++++++- .../core/fnc/mil/create_static.sqf | 8 ++-- .../core/fnc/mil/hd_hideout.sqf | 3 ++ .../core/fnc/mil/patrol_addWP.sqf | 31 ++++--------- .../core/fnc/mil/patrol_create.sqf | 46 +++++++------------ .../core/fnc/mil/send.sqf | 20 ++++---- .../core/fnc/rep/hd.sqf | 9 ++-- .../core/fnc/rep/hh.sqf | 6 ++- .../core/fnc/rep/killed.sqf | 16 +++---- 15 files changed, 124 insertions(+), 137 deletions(-) diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_create.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_create.sqf index 8486d2634..69a798645 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_create.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_create.sqf @@ -41,6 +41,6 @@ _unit_type createUnit [_pos, _group, "this moveinDriver _veh;this assignAsDriver _veh setVariable ["driver",leader _group]; _veh addEventHandler ["HandleDamage", btc_fnc_civ_traffic_hd]; -{_x call BTC_fnc_rep_add_eh;_x setVariable ["traffic",_veh];} foreach units _group; +{_x call btc_fnc_rep_add_eh;_x setVariable ["traffic",_veh];} foreach units _group; [_group,_area] call btc_fnc_civ_traffic_add_WP; \ No newline at end of file diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_hd.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_hd.sqf index 1513485bf..58522e27a 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_hd.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_hd.sqf @@ -5,10 +5,10 @@ _veh = _this select 0; _damage = _this select 2; if !(canMove _veh) then { - btc_civ_veh_active = btc_civ_veh_active - 1; [_veh,(_veh getVariable ["driver",_veh])] spawn { waitUntil {sleep 5; ({_x distance (_this select 0) < 600} count playableUnits == 0)}; {deleteVehicle _x;} foreach _this; + btc_civ_veh_active = btc_civ_veh_active - 1; }; }; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/addWP.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/addWP.sqf index 3a9d3c227..e2590f7b2 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/addWP.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/addWP.sqf @@ -1,4 +1,7 @@ //[_group,_city,600] call btc_fnc_addWP; + +private ["_group","_city","_area","_wp","_pos","_rpos","_in_house"]; + _group = _this select 0; _city = _this select 1; _area = _this select 2; @@ -6,8 +9,7 @@ _wp = _this select 3; _pos = []; -switch (typeName _city) do -{ +switch (typeName _city) do { case "ARRAY" :{_pos = _city;}; case "STRING":{_pos = getMarkerPos _city;}; case "OBJECT":{_pos = position _city;}; @@ -17,26 +19,21 @@ _rpos = [_pos, _area] call btc_fnc_randomize_pos; _in_house = false; -switch (true) do -{ - case (_wp < 0.3) : - { +switch (true) do { + case (_wp < 0.3) : { private ["_houses","_house","_n_pos","_max_pos","_unit"]; _houses = [_city,_area] call btc_fnc_getHouses; - if (count _houses > 0) then - { + if (count _houses > 0) then { _in_house = true; _house = _houses select (floor random count _houses); [_group,_house] spawn btc_fnc_house_addWP; _group setVariable ["inHouse",_house]; } else {[_group,_rpos,_area,"SAFE"] call btc_fnc_task_patrol;}; }; - case (_wp > 0.3 && _wp < 0.75) : - { + case (_wp > 0.3 && _wp < 0.75) : { [_group,_rpos,(_area*2),"AWARE"] call btc_fnc_task_patrol; }; - case (_wp > 0.75) : - { + case (_wp > 0.75) : { private ["_wpa"]; _wpa = _group addWaypoint [_rpos, 0]; _wpa setWaypointType "SENTRY"; @@ -45,4 +42,5 @@ switch (true) do _wpa setWaypointFormation "WEDGE"; }; }; + true \ No newline at end of file diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_cap.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_cap.sqf index 9fc73780a..be42cd736 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_cap.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_cap.sqf @@ -1,4 +1,6 @@ +private ["_cap_to"]; + if (btc_hideout_cap_checking) exitWith {}; btc_hideout_cap_checking = true; @@ -17,27 +19,26 @@ if (count _cap_to == 0) exitWith {if (btc_debug_log) then {diag_log "btc_fnc_mil private ["_hd","_in_range"]; _hd = _x; _in_range = []; - { - if (_hd distance _x < btc_hideout_range) then {_in_range = _in_range + [_x];}; - } foreach btc_city_all; + {if (_hd distance _x < btc_hideout_range) then {_in_range = _in_range + [_x];};} foreach btc_city_all; if (count _in_range == 0) exitWith {if (btc_debug_log) then {diag_log format ["btc_fnc_mil_check_cap: exit no in range = %1",_hd getVariable "id"];};}; + private ["_closest","_dist","_pos"]; + _closest = objNull; _dist = 999999; _pos = getPos _hd; - { - if (_x distance _pos < _dist && {!(_x getVariable ["occupied",false])}) then {_closest = _x;_dist = _x distance _pos;}; - } foreach _in_range;diag_log format ["btc_fnc_mil_check_cap: _in_range = %1",_in_range]; - + {if (_x distance _pos < _dist && {!(_x getVariable ["occupied",false])}) then {_closest = _x;_dist = _x distance _pos;};} foreach _in_range; + + if (btc_debug_log) then {diag_log format ["btc_fnc_mil_check_cap: _in_range = %1",_in_range];}; + if (isNull _closest) exitWith {if (btc_debug_log) then {diag_log format ["btc_fnc_mil_check_cap: exit null _closest = %1",_hd getVariable "id"];};}; if (btc_debug_log) then {diag_log format ["btc_fnc_mil_check_cap: SEND FROM = %1 TO %2 [int %3]",_hd getVariable "id",_closest getVariable ["name","error"],_closest getVariable ["initialized",false]];}; _hd setVariable ["cap_time",time]; - if (_closest getVariable ["initialized",false]) then - { + if (_closest getVariable ["initialized",false]) then { /*[_hd,_closest,1,"I_Truck_02_transport_F"] spawn btc_fnc_mil_send; sleep 1; [_hd,_closest,1,"I_Truck_02_transport_F"] spawn btc_fnc_mil_send; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_rinf.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_rinf.sqf index c6f35ad74..4460aa869 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_rinf.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/check_rinf.sqf @@ -1,12 +1,21 @@ + +private ["_city","_pos","_hideout"]; + _city = objNull; -if (count _this > 0) then {_city = _this;} else -{ +if (count _this > 0) then {_city = _this;} else { private ["_useful","_id"]; _useful = []; + //"NameVillage","NameCity","NameCityCapital","NameLocal","Hill" { - //"NameVillage","NameCity","NameCityCapital","NameLocal","Hill" - if (!(_x getVariable ["active",false]) && {_x distance (getMarkerPos btc_respawn_marker) > btc_hideout_safezone} && {!(_x getVariable ["has_ho",false])} && (_x getVariable ["type",""] == "NameLocal" || {_x getVariable ["type",""] == "Hill"} || {_x getVariable ["type",""] == "NameVillage"})) then {_useful = _useful + [_x];}; + if ( + !(_x getVariable ["active",false]) && {_x distance (getMarkerPos btc_respawn_marker) > btc_hideout_safezone} && + {!(_x getVariable ["has_ho",false])} && + ( + _x getVariable ["type",""] == "NameLocal" || + {_x getVariable ["type",""] == "Hill"} || {_x getVariable ["type",""] == "NameVillage"} + ) + ) then {_useful = _useful + [_x];}; } foreach btc_city_all; _id = floor random count _useful; _city = _useful select _id; @@ -32,8 +41,7 @@ _city setVariable ["has_ho",true]; _city setVariable ["ho_pos",_pos]; _city setVariable ["ho_units_spawned",false]; -if (btc_debug) then -{ +if (btc_debug) then { //Marker _marker = createmarker [format ["btc_hideout_%1", _pos], _pos]; format ["btc_hideout_%1", _pos] setmarkertypelocal "mil_unknown"; @@ -42,10 +50,7 @@ if (btc_debug) then }; -if (btc_debug_log) then -{ - diag_log format ["btc_fnc_mil_create_hideout: _this = %1 ; POS %2 ID %3",_this,_pos,btc_hideouts_id]; -}; +if (btc_debug_log) then {diag_log format ["btc_fnc_mil_create_hideout: _this = %1 ; POS %2 ID %3",_this,_pos,btc_hideouts_id];}; btc_hideouts_id = btc_hideouts_id + 1; btc_hideouts = btc_hideouts + [_hideout]; \ No newline at end of file diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_group.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_group.sqf index aea6666bf..1015a84bc 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_group.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_group.sqf @@ -1,4 +1,6 @@ +private ["_city","_area","_n","_wp","_pos","_rpos","_unit_type","_group","_in_house"]; + _city = _this select 0; _area = _this select 1; _n = _this select 2; @@ -6,8 +8,7 @@ _wp = _this select 3; _pos = []; -switch (typeName _city) do -{ +switch (typeName _city) do { case "ARRAY" :{_pos = _city;}; case "STRING":{_pos = getMarkerPos _city;}; case "OBJECT":{_pos = position _city;}; @@ -22,26 +23,21 @@ _group createUnit [_unit_type, _rpos, [], 0, "NONE"]; (leader _group) setpos _rpos; _in_house = false; -switch (true) do -{ - case (_wp < 0.3) : - { +switch (true) do { + case (_wp < 0.3) : { private ["_houses","_house","_n_pos","_max_pos","_unit"]; _houses = [_rpos,50] call btc_fnc_getHouses; - if (count _houses > 0) then - { + if (count _houses > 0) then { _in_house = true; _house = _houses select (floor random count _houses); [_group,_house] spawn btc_fnc_house_addWP; _group setVariable ["inHouse",_house]; } else {[_group,_rpos,_area,"SAFE"] spawn btc_fnc_task_patrol;}; }; - case (_wp > 0.3 && _wp < 0.75) : - { + case (_wp > 0.3 && _wp < 0.75) : { [_group,_rpos,(_area*2),"AWARE"] spawn btc_fnc_task_patrol; }; - case (_wp > 0.75) : - { + case (_wp > 0.75) : { private ["_wpa"]; _wpa = _group addWaypoint [_rpos, 0]; _wpa setWaypointType "SENTRY"; @@ -49,10 +45,8 @@ switch (true) do _wpa setWaypointBehaviour "AWARE"; }; }; -if (!_in_house) then -{ - for "_i" from 0 to _n do - { +if (!_in_house) then { + for "_i" from 0 to _n do { _unit_type = btc_type_units select (floor random count btc_type_units); _group createUnit [_unit_type, _rpos, [], 0, "NONE"]; sleep 0.5; @@ -60,16 +54,10 @@ if (!_in_house) then //_group createUnit [btc_type_medic, _pos, [], 0, "NONE"]; }; -if ((position leader _group) distance [0,0,0] < 50) then -{ - {_x setpos _rpos;} foreach units _group; -}; +if ((position leader _group) distance [0,0,0] < 50) then {{_x setpos _rpos;} foreach units _group;}; {_x call btc_fnc_mil_unit_create;} foreach units _group; -if (btc_debug_log) then -{ - diag_log format ["btc_fnc_mil_create_group: _this = %1 ; POS %2 UNITS N %3",_this,_rpos,count units _group]; -}; +if (btc_debug_log) then {diag_log format ["btc_fnc_mil_create_group: _this = %1 ; POS %2 UNITS N %3",_this,_rpos,count units _group];}; _group \ No newline at end of file diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_hideout.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_hideout.sqf index dfa12ac25..af1954d1f 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_hideout.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_hideout.sqf @@ -1,3 +1,6 @@ + +private ["_city","_pos","_hideout"]; + _city = objNull; if (count _this > 0) then {_city = _this;} else { @@ -5,7 +8,16 @@ if (count _this > 0) then {_city = _this;} else { _useful = []; { //"NameVillage","NameCity","NameCityCapital","NameLocal","Hill" - if (!(_x getVariable ["active",false]) && {_x distance (getMarkerPos btc_respawn_marker) > btc_hideout_safezone} && {!(_x getVariable ["has_ho",false])} && (_x getVariable ["type",""] == "NameLocal" || {_x getVariable ["type",""] == "Hill"} || {_x getVariable ["type",""] == "NameVillage"})) then {_useful = _useful + [_x];}; + if ( + !(_x getVariable ["active",false]) && + {_x distance (getMarkerPos btc_respawn_marker) > btc_hideout_safezone} && + {!(_x getVariable ["has_ho",false])} && + ( + _x getVariable ["type",""] == "NameLocal" || + {_x getVariable ["type",""] == "Hill"} || + {_x getVariable ["type",""] == "NameVillage"} + ) + ) then {_useful = _useful + [_x];}; } foreach btc_city_all; _id = floor random count _useful; _city = _useful select _id; @@ -35,7 +47,7 @@ _city setVariable ["ho_units_spawned",false]; if (btc_debug) then { //Marker - _marker = createmarker [format ["btc_hideout_%1", _pos], _pos]; + createmarker [format ["btc_hideout_%1", _pos], _pos]; format ["btc_hideout_%1", _pos] setmarkertypelocal "mil_unknown"; format ["btc_hideout_%1", _pos] setMarkerTextLocal format ["Hideout %1", btc_hideouts_id]; format ["btc_hideout_%1", _pos] setMarkerSizeLocal [0.8, 0.8]; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_static.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_static.sqf index 953e45385..cfddd0d39 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_static.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/create_static.sqf @@ -1,3 +1,6 @@ + +private ["_pos","_type","_dir","_static","_group","_unit_type","_gunner"]; + _pos = _this select 0; _type = _this select 1; _dir = 0; if (count _this > 2) then {_dir = _this select 2;}; @@ -16,7 +19,4 @@ _gunner setCombatMode "RED"; _gunner call btc_fnc_mil_unit_create; -if (btc_debug_log) then -{ - diag_log format ["btc_fnc_mil_create_static: _this = %1 ; POS %2 _type %3",_this,_pos,_type]; -}; \ No newline at end of file +if (btc_debug_log) then {diag_log format ["btc_fnc_mil_create_static: _this = %1 ; POS %2 _type %3",_this,_pos,_type];}; \ No newline at end of file diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/hd_hideout.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/hd_hideout.sqf index 27b426557..aea941e62 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/hd_hideout.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/hd_hideout.sqf @@ -1,3 +1,6 @@ + +private ["_hideout","_damage","_ammo","_explosive"]; + _hideout = _this select 0; _damage = _this select 2; _ammo = _this select 4; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_addWP.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_addWP.sqf index 931a86aeb..503d62f11 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_addWP.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_addWP.sqf @@ -1,12 +1,13 @@ +private ["_group","_city","_area","_players"]; + _group = _this select 0; _city = _group getVariable ["city",objNull]; _area = _this select 1; _players = if (isMultiplayer) then {playableUnits} else {switchableUnits}; -if ({_x distance _city < (_area/2) || _x distance leader _group < (_area/2)} count _players == 0) exitWith //playableUnits -{ +if ({_x distance _city < (_area/2) || _x distance leader _group < (_area/2)} count _players == 0) exitWith { if (vehicle leader _group != leader _group) then {deleteVehicle (vehicle leader _group)}; {deleteVehicle _x;} foreach units _group;deleteGroup _group; btc_patrol_active = btc_patrol_active - 1; @@ -15,17 +16,13 @@ if ({_x distance _city < (_area/2) || _x distance leader _group < (_area/2)} cou _cities = []; {if (_x distance _city < _area) then {_cities = _cities + [_x];};} foreach btc_city_all; _pos = []; -if (count _cities == 0) then {_pos = getPos _city;} else -{ +if (count _cities == 0) then {_pos = getPos _city;} else { _pos = getPos (_cities select (floor random count _cities)); }; private ["_wp","_wp_1"]; -while {(count (waypoints _group)) > 0} do -{ - deleteWaypoint ((waypoints _group) select 0); -}; +while {(count (waypoints _group)) > 0} do {deleteWaypoint ((waypoints _group) select 0);}; if ((vehicle leader _group) isKindOf "Air" || (vehicle leader _group) isKindOf "LandVehicle") then {(vehicle leader _group) setFuel 1;}; _group setBehaviour "SAFE"; @@ -36,10 +33,8 @@ _wp setWaypointCombatMode "RED"; _wp setWaypointSpeed "LIMITED"; _wp setWaypointFormation "STAG COLUMN"; -if !((vehicle leader _group) isKindOf "Air") then -{ - for "_i" from 0 to (2 + (floor (random 3))) do - { +if !((vehicle leader _group) isKindOf "Air") then { + for "_i" from 0 to (2 + (floor (random 3))) do { private ["_wp", "_newPos"]; _newPos = [(_pos select 0) + (random 150 - random 150),(_pos select 1) + (random 150 - random 150),0]; @@ -53,15 +48,9 @@ if !((vehicle leader _group) isKindOf "Air") then _wp_1 setWaypointType "MOVE"; _wp_1 setWaypointCompletionRadius 20; _wp_1 setWaypointStatements ["true", format ["_spawn = [group this,%1] spawn btc_fnc_mil_patrol_addWP;",_area]]; -} -else -{ - _wp setWaypointStatements ["true", format ["_spawn = [group this,%1] spawn btc_fnc_mil_patrol_addWP;",_area]]; -}; -if (btc_debug) then -{ - if (!isNil {_group getVariable "btc_patrol_id"}) then - { +} else {_wp setWaypointStatements ["true", format ["_spawn = [group this,%1] spawn btc_fnc_mil_patrol_addWP;",_area]];}; +if (btc_debug) then { + if (!isNil {_group getVariable "btc_patrol_id"}) then { _marker = createmarker [format ["Patrol_fant_%1", _group getVariable "btc_patrol_id"] , [(_pos select 0) + random 30,(_pos select 1) + random 30,0]]; format ["Patrol_fant_%1", _group getVariable "btc_patrol_id"] setmarkertype "mil_dot"; format ["Patrol_fant_%1", _group getVariable "btc_patrol_id"] setMarkerText format ["P %1", _group getVariable "btc_patrol_id"]; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_create.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_create.sqf index 56398ba67..6cba4ad28 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_create.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/patrol_create.sqf @@ -1,3 +1,6 @@ + +private ["_random","_city","_area","_cities","_useful","_pos","_group"]; + _random = _this select 0;//0 random, 1 inf, 2 moto, 3 heli _city = _this select 1; _area = _this select 2; @@ -6,17 +9,12 @@ if (isNil "btc_patrol_id") then {btc_patrol_id = 0;}; btc_patrol_active = btc_patrol_active + 1; -if (btc_debug_log) then -{ - diag_log format ["btc_fnc_mil_patrol_create: _random = %1 _city %2 _area %3 btc_patrol_active = %4",_random,_city,_area,btc_patrol_active]; -}; +if (btc_debug_log) then {diag_log format ["btc_fnc_mil_patrol_create: _random = %1 _city %2 _area %3 btc_patrol_active = %4",_random,_city,_area,btc_patrol_active];}; -if (_random == 0) then -{ +if (_random == 0) then { private ["_n"]; _n = random 100; - switch (true) do - { + switch (true) do { case (_n < 40) : {_random = 1;}; case (_n > 40 && _n < 90) : {_random = 2;}; case (_n > 90 && _n < 96) : {_random = 3;}; @@ -26,13 +24,10 @@ if (_random == 0) then _cities = []; {if (_x distance _city < _area) then {_cities = _cities + [_x];};} foreach btc_city_all; _useful = []; -{ - if !(_x getVariable ["active",false]) then {_useful = _useful + [getPos _x];}; -} foreach _cities; -if (count _useful == 0) then -{ - while {count _useful == 0} do - { +{if !(_x getVariable ["active",false]) then {_useful = _useful + [getPos _x];};} foreach _cities; + +if (count _useful == 0) then { + while {count _useful == 0} do { private "_pos"; _pos = [getPos _city, _area] call btc_fnc_randomize_pos; if ({_x distance _pos < 500} count playableUnits == 0) then {_useful = _useful + [_pos];}; @@ -47,15 +42,11 @@ _group setVariable ["no_cache",true]; _group setVariable ["btc_patrol",true]; _group setVariable ["btc_patrol_id",btc_patrol_id];btc_patrol_id = btc_patrol_id + 1; -switch (true) do -{ - case (_random == 1) : - { +switch (true) do { + case (_random == 1) : { _n_units = 4 + (round random 8); - _group createUnit [(btc_type_units select 0), _pos, [], 0, "NONE"];(leader _group) setpos _pos; - for "_i" from 1 to _n_units do - { + for "_i" from 1 to _n_units do { private ["_unit_type"]; _unit_type = btc_type_units select (floor random count btc_type_units); _group createUnit [_unit_type, _pos, [], 0, "NONE"]; @@ -63,9 +54,8 @@ switch (true) do }; _spawn = [_group,_area] spawn btc_fnc_mil_patrol_addWP; }; - case (_random == 2) : - { - private ["_newZone","_cargo"]; + case (_random == 2) : { + private ["_veh_type","_newZone","_veh","_cargo"]; _veh_type = btc_type_motorized select (floor (random (count btc_type_motorized))); _newZone = []; if (count (_pos nearRoads 150) > 0) then {_newZone = getPos ((_pos nearRoads 150) select 0)} else {_newZone = [_pos, 0, 500, 13, 0, 60 * (pi / 180), 0] call BIS_fnc_findSafePos;}; @@ -73,10 +63,8 @@ switch (true) do [_veh,_group,false,"",btc_type_crewmen] call BIS_fnc_spawnCrew; _group selectLeader (driver _veh); _cargo = (_veh emptyPositions "cargo") - 1; - if (_cargo > 0) then - { - for "_i" from 0 to _cargo do - { + if (_cargo > 0) then { + for "_i" from 0 to _cargo do { _unit_type = btc_type_units select (round (random ((count btc_type_units) - 1))); _unit_type createUnit [_pos, _group, "this moveinCargo _veh;this assignAsCargo _veh;"]; }; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/send.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/send.sqf index 0cfae8611..bc24dd70d 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/send.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/mil/send.sqf @@ -1,12 +1,13 @@ //[_hd,_closest,1,"I_Truck_02_transport_F"] spawn btc_fnc_mil_send; + +private ["_pos","_dest"]; + _pos = getPos (_this select 0); _dest = getPos (_this select 1); -switch (_this select 2) do -{ - case 0 : - { - private ["_group"]; +switch (_this select 2) do { + case 0 : { + private ["_group","_wp_0","_wp"]; _group = [_pos,150,(3 + random 6),1] call btc_fnc_mil_create_group; _group setVariable ["no_cache",true]; while {(count (waypoints _group)) > 0} do { deleteWaypoint ((waypoints _group) select 0); }; @@ -19,9 +20,8 @@ switch (_this select 2) do _wp setWaypointFormation "COLUMN"; _wp setWaypointStatements ["true", "(group this) spawn btc_fnc_data_add_group;"]; }; - case 1 : - { - private ["_group","_veh_type","_return_pos","_veh"]; + case 1 : { + private ["_group","_veh_type","_return_pos","_veh","_gunner","_commander","_cargo","_wp","_wp_1","_wp_3"]; _group = createGroup btc_enemy_side; _group setVariable ["no_cache",true]; _veh_type = (_this select 3); @@ -34,8 +34,8 @@ switch (_this select 2) do btc_type_crewmen createUnit [_pos, _group, "this moveinDriver _veh;this assignAsDriver _veh;"]; if (_gunner > 0) then {btc_type_crewmen createUnit [_pos, _group, "this moveinGunner _veh;this assignAsGunner _veh;"];}; if (_commander > 0) then {btc_type_crewmen createUnit [_pos, _group, "this moveinCommander _veh;this assignAsCommander _veh;"];}; - for "_i" from 0 to _cargo do - { + for "_i" from 0 to _cargo do { + private "_unit_type"; _unit_type = btc_type_units select (floor random count btc_type_units); _unit_type createUnit [_pos, _group, "this moveinCargo _veh;this assignAsCargo _veh;"]; }; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hd.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hd.sqf index 00c6dab1d..f83044fa3 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hd.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hd.sqf @@ -1,13 +1,14 @@ + +private ["_unit","_part","_dam","_injurer","_ammo"]; + _unit = _this select 0; _part = _this select 1; _dam = _this select 2; _injurer = _this select 3; _ammo = _this select 4; -if (_part == "body") then -{ - if (isPlayer _injurer) then - { +if (_part == "body") then { + if (isPlayer _injurer && {_dam > 0.3}) then { btc_rep_malus_civ_hd call btc_fnc_rep_change; if (btc_global_reputation < 600) then {[getpos _unit] spawn btc_fnc_rep_eh_effects;}; if (btc_debug_log) then {diag_log format ["REP HD = GREP %1 THIS = %2",btc_global_reputation,_this];}; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hh.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hh.sqf index bb9018ccb..0f3c12b86 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hh.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/hh.sqf @@ -1,5 +1,7 @@ + +private "_healer"; + _healer = _this select 1; -if (isPlayer _healer) then -{ +if (isPlayer _healer) then { btc_rep_bonus_civ_hh spawn btc_fnc_rep_change;if (btc_debug_log) then {diag_log format ["REP HH = GREP %1 THIS = %2",btc_global_reputation,_this];}; }; diff --git a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/killed.sqf b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/killed.sqf index 23235e3af..b6709bc16 100644 --- a/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/killed.sqf +++ b/=BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/killed.sqf @@ -1,18 +1,18 @@ + +private ["_unit","_killer"]; + _unit = _this select 0; _killer = _this select 1; -if (isPlayer _killer) then -{ +if (isPlayer _killer) then { btc_rep_malus_civ_killed call btc_fnc_rep_change; if (btc_global_reputation < 600) then {[getpos _unit] spawn btc_fnc_rep_eh_effects;}; if (btc_debug_log) then {diag_log format ["REP KILLED = GREP %1 THIS = %2",btc_global_reputation,_this];}; }; -if !(isNil {_unit getVariable ["traffic",objNull]}) then -{ - btc_civ_veh_active = btc_civ_veh_active - 1; - [getPos _unit,(_unit getVariable ["traffic",objNull])] spawn - { - waitUntil {sleep 5; ({_x distance (_this select 0) < 600} count playableUnits == 0)}; +if !(isNil {_unit getVariable ["traffic",objNull]}) then { + [getPos _unit,(_unit getVariable ["traffic",objNull])] spawn { + waitUntil {sleep 5; ({_x distance (_this select 0) < 300} count playableUnits == 0)}; deleteVehicle (_this select 1); + btc_civ_veh_active = btc_civ_veh_active - 1; }; }; \ No newline at end of file